Documentation
¶
Index ¶
- type CheckResponse
- type CheckResponseHTTPDetails
- type CheckResponseTCPDetails
- type CheckResponseTag
- type CheckResponseType
- type CheckService
- type CheckTeamResponse
- type Client
- type ClientConfig
- type Error
- type OutageSummaryResponse
- type OutageSummaryResponseState
- type OutageSummaryService
- type Response
- type SummaryPerformanceMap
- type SummaryPerformanceResponse
- type SummaryPerformanceSummary
- type TransactionCheckResponse
- type TransactionCheckService
- type TransactionInterval
- type TransactionPerformanceResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckResponse ¶
type CheckResponse struct { ID int `json:"id"` Name string `json:"name"` Resolution int `json:"resolution,omitempty"` SendNotificationWhenDown int `json:"sendnotificationwhendown,omitempty"` NotifyAgainEvery int `json:"notifyagainevery,omitempty"` NotifyWhenBackup bool `json:"notifywhenbackup,omitempty"` Created int64 `json:"created,omitempty"` Hostname string `json:"hostname,omitempty"` Status string `json:"status,omitempty"` LastErrorTime int64 `json:"lasterrortime,omitempty"` LastTestTime int64 `json:"lasttesttime,omitempty"` LastResponseTime int64 `json:"lastresponsetime,omitempty"` LastDownStart int64 `json:"lastdownstart,omitempty"` IntegrationIds []int `json:"integrationids,omitempty"` SeverityLevel string `json:"severity_level,omitempty"` Type CheckResponseType `json:"type,omitempty"` Tags []CheckResponseTag `json:"tags,omitempty"` UserIds []int `json:"userids,omitempty"` Teams []CheckTeamResponse `json:"teams,omitempty"` ResponseTimeThreshold int `json:"responsetime_threshold,omitempty"` ProbeFilters []string `json:"probe_filters,omitempty"` }
CheckResponse represents the JSON response for a check from the Pingdom API.
func (*CheckResponse) HasIgnoreTag ¶
func (cr *CheckResponse) HasIgnoreTag() bool
HasIgnoreTag returns true if the tag "pingdom_exporter_ignored" exists for this check.
func (*CheckResponse) TagsString ¶
func (cr *CheckResponse) TagsString() string
TagsString returns the check tags as a comma-separated string.
func (*CheckResponse) UptimeSLOFromTags ¶
func (cr *CheckResponse) UptimeSLOFromTags(defaultUptimeSLO float64) float64
UptimeSLOFromTags returns the uptime SLO configured to this check via a tag, i.e. "uptime_slo_999" for 99.9 uptime SLO. Returns the argument as the default uptime SLO in case no uptime SLO tag exists for this check.
type CheckResponseHTTPDetails ¶
type CheckResponseHTTPDetails struct { URL string `json:"url,omitempty"` Encryption bool `json:"encryption,omitempty"` Port int `json:"port,omitempty"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` ShouldContain string `json:"shouldcontain,omitempty"` ShouldNotContain string `json:"shouldnotcontain,omitempty"` PostData string `json:"postdata,omitempty"` RequestHeaders map[string]string `json:"requestheaders,omitempty"` }
CheckResponseHTTPDetails represents the details specific to HTTP checks.
type CheckResponseTCPDetails ¶
type CheckResponseTCPDetails struct { Port int `json:"port,omitempty"` StringToSend string `json:"stringtosend,omitempty"` StringToExpect string `json:"stringtoexpect,omitempty"` }
CheckResponseTCPDetails represents the details specific to TCP checks.
type CheckResponseTag ¶
type CheckResponseTag struct { Name string `json:"name"` Type string `json:"type"` Count interface{} `json:"count"` }
CheckResponseTag is an optional tag that can be added to checks.
type CheckResponseType ¶
type CheckResponseType struct { Name string `json:"-"` HTTP *CheckResponseHTTPDetails `json:"http,omitempty"` TCP *CheckResponseTCPDetails `json:"tcp,omitempty"` }
CheckResponseType is the type of the Pingdom check.
func (*CheckResponseType) UnmarshalJSON ¶
func (c *CheckResponseType) UnmarshalJSON(b []byte) error
UnmarshalJSON converts a byte array into a CheckResponseType.
type CheckService ¶
type CheckService struct {
// contains filtered or unexported fields
}
CheckService provides an interface to Pingdom checks.
func (*CheckService) List ¶
func (cs *CheckService) List(params ...map[string]string) ([]CheckResponse, error)
List returns a list of checks from Pingdom. This returns type CheckResponse rather than Check since the Pingdom API does not return a complete representation of a check.
type CheckTeamResponse ¶
CheckTeamResponse holds the team names for each check.
type Client ¶
type Client struct { Token string BaseURL *url.URL Tags string Checks *CheckService TransactionChecks *TransactionCheckService OutageSummary *OutageSummaryService // contains filtered or unexported fields }
Client represents a client to the Pingdom API. This package also provides a NewClient function for convenience to initialize a client with default parameters.
func NewClientWithConfig ¶
func NewClientWithConfig(config ClientConfig) (*Client, error)
NewClientWithConfig returns a Pingdom client.
func (*Client) Do ¶
Do makes an HTTP request and will unmarshal the JSON response in to the passed in interface. If the HTTP response is outside of the 2xx range the response will be returned along with the error.
func (*Client) NewRequest ¶
func (pc *Client) NewRequest(method string, rsc string, params map[string]string) (*http.Request, error)
NewRequest makes a new HTTP Request. The method param should be an HTTP method in all caps such as GET, POST, PUT, DELETE. The rsc param should correspond with a restful resource. Params can be passed in as a map of strings Usually users of the client can use one of the convenience methods such as ListChecks, etc but this method is provided to allow for making other API calls that might not be built in.
type ClientConfig ¶
ClientConfig represents a configuration for a pingdom client.
type Error ¶
type Error struct { StatusCode int `json:"statuscode"` StatusDesc string `json:"statusdesc"` Message string `json:"errormessage"` }
Error represents an error response from the Pingdom API.
type OutageSummaryResponse ¶
type OutageSummaryResponse struct {
States []OutageSummaryResponseState `json:"states"`
}
OutageSummaryResponse represents the JSON response for a outage summary list from the Pingdom API.
type OutageSummaryResponseState ¶
type OutageSummaryResponseState struct { Status string `json:"status"` FromTime int64 `json:"timefrom"` ToTime int64 `json:"timeto"` }
OutageSummaryResponseState represents the JSON response for each outage summary.
type OutageSummaryService ¶
type OutageSummaryService struct {
// contains filtered or unexported fields
}
OutageSummaryService provides an interface to Pingdom outage summary.
func (*OutageSummaryService) List ¶
func (os *OutageSummaryService) List(checkID int, params ...map[string]string) ([]OutageSummaryResponseState, error)
List returns a list of outage summaries from Pingdom.
type Response ¶
type Response struct {
Message string `json:"message"`
}
Response represents a general response from the Pingdom API.
type SummaryPerformanceMap ¶
type SummaryPerformanceMap struct { Hours []SummaryPerformanceSummary `json:"hours,omitempty"` Days []SummaryPerformanceSummary `json:"days,omitempty"` Weeks []SummaryPerformanceSummary `json:"weeks,omitempty"` }
SummaryPerformanceMap is the performance broken down over different time intervals.
type SummaryPerformanceResponse ¶
type SummaryPerformanceResponse struct {
Summary SummaryPerformanceMap `json:"summary"`
}
SummaryPerformanceResponse represents the JSON response for a summary performance from the Pingdom API.
type SummaryPerformanceSummary ¶
type SummaryPerformanceSummary struct { AvgResponse int `json:"avgresponse"` Downtime int `json:"downtime"` StartTime int `json:"starttime"` Unmonitored int `json:"unmonitored"` Uptime int `json:"uptime"` }
SummaryPerformanceSummary is the metrics for a performance summary.
type TransactionCheckResponse ¶
type TransactionCheckResponse struct { ID int `json:"id"` Name string `json:"name"` Interval int `json:"interval,omitempty"` Created int64 `json:"created_at,omitempty"` LastModifiedTime int64 `json:"modified_at,omitempty"` Status string `json:"status,omitempty"` Active bool `json:"active,omitempty"` Region string `json:"region,omitempty"` Type string `json:"type,omitempty"` Tags []string `json:"tags,omitempty"` LastDownStart int64 `json:"last_downtime_start,omitempty"` LastDownEnd int64 `json:"last_downtime_end,omitempty"` }
TransactionCheckResponse represents the JSON response for a check from the Pingdom API.
func (*TransactionCheckResponse) TransactionTagsString ¶
func (tcr *TransactionCheckResponse) TransactionTagsString() string
TransctionTagsString returns the check tags as a comma-separated string.
type TransactionCheckService ¶
type TransactionCheckService struct {
// contains filtered or unexported fields
}
CheckService provides an interface to Pingdom checks.
func (*TransactionCheckService) List ¶
func (tcs *TransactionCheckService) List(params ...map[string]string) ([]TransactionCheckResponse, error)
List returns a list of transaction checks from Pingdom. This returns type CheckResponse rather than Check since the Pingdom API does not return a complete representation of a check.
type TransactionInterval ¶
type TransactionInterval struct { // Steps []TransactionStep `json:"name,omitempty"` ResponseTime int `json:"average_response,omitempty"` From string `json:"from,omitempty"` }
TransactionInterval
type TransactionPerformanceResponse ¶
type TransactionPerformanceResponse struct { ID int `json:"check_id,omitempty"` Name string `json:"name,omitempty"` Resolution string `json:"resolution,omitempty"` Intervals []TransactionInterval `json:"intervals,omitempty"` }