Documentation ¶
Overview ¶
Package pingdom provides a client interface to the Pingdom API. This currently only supports working with basic HTTP and ping checks.
Construct a new Pingdom client:
client, err := pingdom.NewClientWithConfig(pingdom.ClientConfig{ Username: "SOLARWINDS_USER", Password: "SOLARWINDS_PASSWD", APIKey: "pingdom_api_key", })
Using a Pingdom client, you can access supported services.
CheckService ¶
This service manages pingdom Checks which are represented by the `Check` struct. When creating or updating Checks you must specify at a minimum the `Name`, `Hostname` and `Resolution`. Other fields are optional but if not set will be given the zero values for the underlying type.
More information on Checks from Pingdom: https://www.pingdom.com/features/api/documentation/#ResourceChecks
Get a list of all checks:
checks, err := client.Checks.List() fmt.Println("Checks:", checks) // [{ID Name} ...]
Create a new HTTP check:
newCheck := pingdom.Check{Name: "Test Check", Hostname: "example.com", Resolution: 5} check, err := client.Checks.Create(&newCheck) fmt.Println("Created check:", check) // {ID, Name}
Create a new HTTP check with alerts for specified users:
newCheck := pingdom.Check{Name: "Test Check", Hostname: "example.com", Resolution: 5, UserIds: []int{12345}} check, err := client.Checks.Create(&newCheck) fmt.Println("Created check:", check) // {ID, Name}
Create a new Ping check:
newCheck := pingdom.PingCheck{Name: "Test Check", Hostname: "example.com", Resolution: 5} check, err := client.Checks.Create(&newCheck) fmt.Println("Created check:", check) // {ID, Name}
Get details for a specific check:
checkDetails, err := client.Checks.Read(12345)
Update a check:
updatedCheck := pingdom.Check{Name: "Updated Check", Hostname: "example2.com", Resolution: 5} msg, err := client.Checks.Update(12345, &updatedCheck)
Delete a check:
msg, err := client.Checks.Delete(12345)
Index ¶
- Variables
- type AGCMNotification
- type APNSNotification
- type Check
- type CheckResponse
- type CheckResponseDNSDetails
- type CheckResponseHTTPDetails
- type CheckResponseTCPDetails
- type CheckResponseTag
- type CheckResponseType
- type CheckService
- func (cs *CheckService) Create(check Check) (*CheckResponse, error)
- func (cs *CheckService) Delete(id int) (*PingdomResponse, error)
- func (cs *CheckService) List(params ...map[string]string) ([]CheckResponse, error)
- func (cs *CheckService) Read(id int) (*CheckResponse, error)
- func (cs *CheckService) Results(id int, params ...map[string]string) (*ResultsResponse, error)
- func (cs *CheckService) SummaryPerformance(request SummaryPerformanceRequest) (*SummaryPerformanceResponse, error)
- func (cs *CheckService) Update(id int, check Check) (*PingdomResponse, error)
- type CheckTeamResponse
- type Client
- func (pc *Client) Do(req *http.Request, v interface{}) (*http.Response, error)
- func (pc *Client) NewJSONRequest(method string, rsc string, params string) (*http.Request, error)
- func (pc *Client) NewRequest(method string, rsc string, params map[string]string) (*http.Request, error)
- func (pc *Client) NewRequestMultiParamValue(method string, rsc string, params map[string][]string) (*http.Request, error)
- type ClientConfig
- type Contact
- type ContactAPI
- type ContactService
- func (cs *ContactService) Create(contact ContactAPI) (*Contact, error)
- func (cs *ContactService) Delete(id int) (*PingdomResponse, error)
- func (cs *ContactService) List() ([]Contact, error)
- func (cs *ContactService) Read(contactID int) (*Contact, error)
- func (cs *ContactService) Update(id int, contact ContactAPI) (*PingdomResponse, error)
- type ContactTeam
- type DNSCheck
- type EmailNotification
- type HttpCheck
- type ListOccurrenceQuery
- type Maintenance
- type MaintenanceCheckResponse
- type MaintenanceDelete
- type MaintenanceResponse
- type MaintenanceService
- func (cs *MaintenanceService) Create(maintenance Maintenance) (*MaintenanceResponse, error)
- func (cs *MaintenanceService) Delete(id int) (*PingdomResponse, error)
- func (cs *MaintenanceService) List(params ...map[string]string) ([]MaintenanceResponse, error)
- func (cs *MaintenanceService) MultiDelete(maintenance MaintenanceDelete) (*PingdomResponse, error)
- func (cs *MaintenanceService) Read(id int) (*MaintenanceResponse, error)
- func (cs *MaintenanceService) Update(id int, maintenance Maintenance) (*PingdomResponse, error)
- type MaintenanceWindow
- type MaintenanceWindowDelete
- type NotificationTargets
- type Occurrence
- type OccurrenceService
- func (os *OccurrenceService) Delete(id int64) (*PingdomResponse, error)
- func (os *OccurrenceService) List(query ListOccurrenceQuery) ([]Occurrence, error)
- func (os *OccurrenceService) MultiDelete(ids []int64) (*PingdomResponse, error)
- func (os *OccurrenceService) Read(id int64) (*Occurrence, error)
- func (os *OccurrenceService) Update(id int64, occurrence Occurrence) (*PingdomResponse, error)
- type PingCheck
- type PingdomError
- type PingdomResponse
- type ProbeResponse
- type ProbeService
- type Result
- type ResultsResponse
- type SMSNotification
- type SummaryPerformanceMap
- type SummaryPerformanceRequest
- type SummaryPerformanceResponse
- type SummaryPerformanceSummary
- type TCPCheck
- type TMSCheck
- type TMSCheckDetailResponse
- type TMSCheckInterval
- type TMSCheckMetaData
- type TMSCheckPerformanceReportResponse
- type TMSCheckResponse
- type TMSCheckSAPI
- type TMSCheckService
- func (cs *TMSCheckService) Create(tmsCheck *TMSCheck) (*TMSCheckDetailResponse, error)
- func (cs *TMSCheckService) Delete(id int) (*PingdomResponse, error)
- func (cs *TMSCheckService) GetPerfomanceReport(id int, params map[string]string) (*TMSCheckPerformanceReportResponse, error)
- func (cs *TMSCheckService) GetStatusReport(id int, params map[string]string) (*TMSCheckStatusReportResponse, error)
- func (cs *TMSCheckService) List(params ...map[string]string) ([]TMSCheckResponse, error)
- func (cs *TMSCheckService) ListStatusReports(params map[string]string) ([]TMSCheckStatusReportResponse, error)
- func (cs *TMSCheckService) Read(id int) (*TMSCheckDetailResponse, error)
- func (cs *TMSCheckService) Update(id int, tmsCheck *TMSCheck) (*TMSCheckDetailResponse, error)
- type TMSCheckStatus
- type TMSCheckStatusReportResponse
- type TMSCheckStep
- type TMSCheckStepReport
- type Team
- type TeamAPI
- type TeamDeleteResponse
- type TeamMemberResponse
- type TeamResponse
- type TeamService
- func (cs *TeamService) Create(team TeamAPI) (*TeamResponse, error)
- func (cs *TeamService) Delete(id int) (*TeamDeleteResponse, error)
- func (cs *TeamService) List() ([]TeamResponse, error)
- func (cs *TeamService) Read(id int) (*TeamResponse, error)
- func (cs *TeamService) Update(id int, team TeamAPI) (*TeamResponse, error)
Constants ¶
This section is empty.
Variables ¶
var ErrBadResolution = errors.New("resolution must be either 'hour', 'day' or 'week'")
ErrBadResolution is an error for when an invalid resolution is specified.
var ErrMissingId = errors.New("required field 'Id' missing")
ErrMissingId is an error for when a required Id field is missing.
Functions ¶
This section is empty.
Types ¶
type AGCMNotification ¶
AGCMNotification represents an AGCM notification
type APNSNotification ¶
type APNSNotification struct { Device string `json:"apns_device"` Name string `json:"device_name"` Severity string `json:"severity"` }
APNSNotification represents an APNS device notification
type Check ¶
Check is an interface representing a Pingdom check. Specific check types should implement the methods of this interface.
type CheckResponse ¶
type CheckResponse struct { ID int `json:"id"` Name string `json:"name"` CustomMessage string `json:"custom_message,omitempty"` 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"` Paused bool `json:"paused,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"` IPv6 bool `json:"ipv6,omitempty"` // Legacy; this is not returned by the API, we backfill the value from the // Teams field. TeamIds []int }
CheckResponse represents the JSON response for a check from the Pingdom API.
type CheckResponseDNSDetails ¶
type CheckResponseDNSDetails struct { ExpectedIP string `json:"expectedip,omitempty"` NameServer string `json:"nameserver,omitempty"` }
CheckResponseDNSDetails represents the details specific to DNS checks.
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"` VerifyCertificate bool `json:"verify_certificate,omitempty"` SSLDownDaysBefore int `json:"ssl_down_days_before,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"` DNS *CheckResponseDNSDetails `json:"dns,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) Create ¶
func (cs *CheckService) Create(check Check) (*CheckResponse, error)
Create a new check. This function will validate the given check param to ensure that it contains correct values before submitting the request Returns a CheckResponse object representing the response from Pingdom. Note that Pingdom does not return a full check object so in the returned object you should only use the ID field.
func (*CheckService) Delete ¶
func (cs *CheckService) Delete(id int) (*PingdomResponse, error)
Delete will delete the check for the given ID.
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.
func (*CheckService) Read ¶
func (cs *CheckService) Read(id int) (*CheckResponse, error)
ReadCheck returns detailed information about a pingdom check given its ID. This returns type CheckResponse rather than Check since the pingdom API does not return a complete representation of a check.
func (*CheckService) Results ¶
func (cs *CheckService) Results(id int, params ...map[string]string) (*ResultsResponse, error)
Results returns raw check results and the list of associated probe IDs used from Pingdom.
func (*CheckService) SummaryPerformance ¶
func (cs *CheckService) SummaryPerformance(request SummaryPerformanceRequest) (*SummaryPerformanceResponse, error)
SummaryPerformance returns a performance summary from Pingdom.
func (*CheckService) Update ¶
func (cs *CheckService) Update(id int, check Check) (*PingdomResponse, error)
Update will update the check represented by the given ID with the values in the given check. You should submit the complete list of values in the given check parameter, not just those that have changed.
type CheckTeamResponse ¶
CheckTeamResponse is a Team returned inside of a Check instance. (We can't use TeamResponse because the ID returned here is an int, not a string).
type Client ¶
type Client struct { APIToken string BaseURL *url.URL Checks *CheckService Contacts *ContactService Maintenances *MaintenanceService Occurrences *OccurrenceService Probes *ProbeService Teams *TeamService TMSCheck *TMSCheckService // contains filtered or unexported fields }
Client represents a client to the Pingdom API.
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) NewJSONRequest ¶
NewJSONRequest 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 should be a json formatted string.
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 Contact ¶
type Contact struct { ID int `json:"id"` Name string `json:"name"` NotificationTargets NotificationTargets `json:"notification_targets"` Owner bool `json:"owner"` Paused bool `json:"paused"` Teams []ContactTeam `json:"teams"` Type string `json:"type"` }
Contact represents a Pingdom Contact.
func (*Contact) RenderForJSONAPI ¶
RenderForJSONAPI returns the JSON formatted version of this object that may be submitted to Pingdom
func (*Contact) ValidContact ¶
ValidContact determines whether a Contact contains valid fields.
type ContactAPI ¶
ContactAPI is an interface representing a Pingdom Contact.
type ContactService ¶
type ContactService struct {
// contains filtered or unexported fields
}
ContactService provides an interface to Pingdom contacts.
func (*ContactService) Create ¶
func (cs *ContactService) Create(contact ContactAPI) (*Contact, error)
Create adds a new contact.
func (*ContactService) Delete ¶
func (cs *ContactService) Delete(id int) (*PingdomResponse, error)
Delete removes a contact from Pingdom.
func (*ContactService) List ¶
func (cs *ContactService) List() ([]Contact, error)
List returns a list of all contacts and their contact details.
func (*ContactService) Read ¶
func (cs *ContactService) Read(contactID int) (*Contact, error)
Read return a contact object from Pingdom.
func (*ContactService) Update ¶
func (cs *ContactService) Update(id int, contact ContactAPI) (*PingdomResponse, error)
Update a contact's core properties not contact targets.
type ContactTeam ¶
ContactTeam represents an alerting team from the view of a Contact
type DNSCheck ¶
type DNSCheck struct { ExpectedIP string `json:"expectedip,omitempty"` Hostname string `json:"hostname,omitempty"` IPV6 bool `json:"ipv6,omitempty"` IntegrationIds []int `json:"integrationids,omitempty"` Name string `json:"name"` NameServer string `json:"nameserver,omitempty"` NotifyAgainEvery int `json:"notifyagainevery,omitempty"` NotifyWhenBackup bool `json:"notifywhenbackup,omitempty"` Paused bool `json:"paused,omitempty"` ProbeFilters string `json:"probe_filters,omitempty"` Resolution int `json:"resolution,omitempty"` SendNotificationWhenDown int `json:"sendnotificationwhendown,omitempty"` Tags string `json:"tags,omitempty"` TeamIds []int `json:"teamids,omitempty"` UserIds []int `json:"userids,omitempty"` }
DNSCheck represents a Pingdom DNS check.
func (*DNSCheck) PostParams ¶
PostParams returns a map of parameters for a DNSCheck that can be sent along with an HTTP POST request. Same as PUT.
type EmailNotification ¶
EmailNotification represents an email address notification
type HttpCheck ¶
type HttpCheck struct { CustomMessage string `json:"custom_message,omitempty"` Encryption bool `json:"encryption,omitempty"` Hostname string `json:"hostname,omitempty"` IPV6 bool `json:"ipv6,omitempty"` IntegrationIds []int `json:"integrationids,omitempty"` Name string `json:"name"` NotifyAgainEvery int `json:"notifyagainevery,omitempty"` NotifyWhenBackup bool `json:"notifywhenbackup,omitempty"` Password string `json:"password,omitempty"` Paused bool `json:"paused,omitempty"` Port int `json:"port,omitempty"` PostData string `json:"postdata,omitempty"` ProbeFilters string `json:"probe_filters,omitempty"` RequestHeaders map[string]string `json:"requestheaders,omitempty"` Resolution int `json:"resolution,omitempty"` ResponseTimeThreshold int `json:"responsetime_threshold,omitempty"` SSLDownDaysBefore *int `json:"ssl_down_days_before,omitempty"` SendNotificationWhenDown int `json:"sendnotificationwhendown,omitempty"` ShouldContain string `json:"shouldcontain,omitempty"` ShouldNotContain string `json:"shouldnotcontain,omitempty"` Tags string `json:"tags,omitempty"` TeamIds []int `json:"teamids,omitempty"` Url string `json:"url,omitempty"` UserIds []int `json:"userids,omitempty"` Username string `json:"username,omitempty"` VerifyCertificate *bool `json:"verify_certificate,omitempty"` }
HttpCheck represents a Pingdom HTTP check.
func (*HttpCheck) PostParams ¶
PostParams returns a map of parameters for an HttpCheck that can be sent along with an HTTP POST request. They are the same than the Put params, but empty strings cleared out, to avoid Pingdom API reject the request.
type ListOccurrenceQuery ¶
type Maintenance ¶
type Maintenance interface { PutParams() map[string]string PostParams() map[string]string Valid() error }
Maintenance is a Pingdom maintenance window.
type MaintenanceCheckResponse ¶
MaintenanceCheckResponse represents Check reply in json MaintenanceResponse.
type MaintenanceDelete ¶
MaintenanceDelete is the set of parameters to a Pingdom maintenance delete request.
type MaintenanceResponse ¶
type MaintenanceResponse struct { ID int `json:"id"` Description string `json:"description"` From int64 `json:"from"` To int64 `json:"to"` RecurrenceType string `json:"recurrencetype"` RepeatEvery int `json:"repeatevery"` EffectiveTo int64 `json:"effectiveto"` Checks MaintenanceCheckResponse `json:"checks"` }
MaintenanceResponse represents the JSON response for a maintenance from the Pingdom API.
type MaintenanceService ¶
type MaintenanceService struct {
// contains filtered or unexported fields
}
MaintenanceService provides an interface to Pingdom maintenance windows.
func (*MaintenanceService) Create ¶
func (cs *MaintenanceService) Create(maintenance Maintenance) (*MaintenanceResponse, error)
Create creates a new Maintenance.
func (*MaintenanceService) Delete ¶
func (cs *MaintenanceService) Delete(id int) (*PingdomResponse, error)
Delete will delete the Maintenance for the given ID.
func (*MaintenanceService) List ¶
func (cs *MaintenanceService) List(params ...map[string]string) ([]MaintenanceResponse, error)
List returns the response holding a list of Maintenance windows.
func (*MaintenanceService) MultiDelete ¶
func (cs *MaintenanceService) MultiDelete(maintenance MaintenanceDelete) (*PingdomResponse, error)
MultiDelete will delete the Maintenance for the given ID.
func (*MaintenanceService) Read ¶
func (cs *MaintenanceService) Read(id int) (*MaintenanceResponse, error)
Read returns a Maintenance for a given ID.
func (*MaintenanceService) Update ¶
func (cs *MaintenanceService) Update(id int, maintenance Maintenance) (*PingdomResponse, error)
Update is used to update an existing Maintenance. Only the 'Description', and 'To' fields can be updated.
type MaintenanceWindow ¶
type MaintenanceWindow struct { Description string `json:"description"` From int64 `json:"from"` To int64 `json:"to"` RecurrenceType string `json:"recurrencetype,omitempty"` RepeatEvery int `json:"repeatevery,omitempty"` EffectiveTo int64 `json:"effectiveto,omitempty"` UptimeIDs string `json:"uptimeids,omitempty"` TmsIDs string `json:"tmsids,omitempty"` }
MaintenanceWindow represents a Pingdom Maintenance Window.
func (*MaintenanceWindow) PostParams ¶
func (ck *MaintenanceWindow) PostParams() map[string]string
PostParams returns a map of parameters for an Maintenance Window that can be sent along with an HTTP POST request. They are the same than the Put params, but empty strings cleared out, to avoid Pingdom API reject the request.
func (*MaintenanceWindow) PutParams ¶
func (ck *MaintenanceWindow) PutParams() map[string]string
PutParams returns a map of parameters for an MaintenanceWindow that can be sent along.
func (*MaintenanceWindow) Valid ¶
func (ck *MaintenanceWindow) Valid() error
Valid determines whether the MaintenanceWindow contains valid fields. This can be used to guard against sending illegal values to the Pingdom API.
type MaintenanceWindowDelete ¶
type MaintenanceWindowDelete struct {
MaintenanceIDs string `json:"maintenanceids"`
}
MaintenanceWindowDelete represents delete request parameters.
func (*MaintenanceWindowDelete) DeleteParams ¶
func (ck *MaintenanceWindowDelete) DeleteParams() map[string]string
DeleteParams returns a map of parameters for an MaintenanceWindow that can be sent along.
func (*MaintenanceWindowDelete) ValidDelete ¶
func (ck *MaintenanceWindowDelete) ValidDelete() error
ValidDelete determines whether a delete request contains valid parameters.
type NotificationTargets ¶
type NotificationTargets struct { SMS []SMSNotification `json:"sms,omitempty"` Email []EmailNotification `json:"email,omitempty"` APNS []APNSNotification `json:"apns,omitempty"` AGCM []AGCMNotification `json:"agcm,omitempty"` }
NotificationTargets represents different ways a contact could be notified of alerts
type Occurrence ¶
type Occurrence struct { Id int64 `json:"id"` MaintenanceId int64 `json:"maintenanceid"` From int64 `json:"from"` To int64 `json:"to"` Duration int `json:"duration"` DurationUnit string `json:"durationunit"` }
func (*Occurrence) RenderForJSONAPI ¶
func (o *Occurrence) RenderForJSONAPI() string
func (*Occurrence) Valid ¶
func (o *Occurrence) Valid() error
type OccurrenceService ¶
type OccurrenceService struct {
// contains filtered or unexported fields
}
func (*OccurrenceService) Delete ¶
func (os *OccurrenceService) Delete(id int64) (*PingdomResponse, error)
Delete will delete the Occurrence for the given ID.
func (*OccurrenceService) List ¶
func (os *OccurrenceService) List(query ListOccurrenceQuery) ([]Occurrence, error)
func (*OccurrenceService) MultiDelete ¶
func (os *OccurrenceService) MultiDelete(ids []int64) (*PingdomResponse, error)
MultiDelete will delete the Occurrence for the given ID.
func (*OccurrenceService) Read ¶
func (os *OccurrenceService) Read(id int64) (*Occurrence, error)
func (*OccurrenceService) Update ¶
func (os *OccurrenceService) Update(id int64, occurrence Occurrence) (*PingdomResponse, error)
Update is used to update an existing Occurrence. Only the 'From', and 'To' fields can be updated.
type PingCheck ¶
type PingCheck struct { Hostname string `json:"hostname,omitempty"` IntegrationIds []int `json:"integrationids,omitempty"` Name string `json:"name"` NotifyAgainEvery int `json:"notifyagainevery,omitempty"` NotifyWhenBackup bool `json:"notifywhenbackup,omitempty"` Paused bool `json:"paused,omitempty"` ProbeFilters string `json:"probe_filters,omitempty"` Resolution int `json:"resolution,omitempty"` ResponseTimeThreshold int `json:"responsetime_threshold,omitempty"` SendNotificationWhenDown int `json:"sendnotificationwhendown,omitempty"` Tags string `json:"tags,omitempty"` TeamIds []int `json:"teamids,omitempty"` UserIds []int `json:"userids,omitempty"` }
PingCheck represents a Pingdom ping check.
func (*PingCheck) PostParams ¶
PostParams returns a map of parameters for a PingCheck that can be sent along with an HTTP POST request. Same as PUT.
type PingdomError ¶
type PingdomError struct { StatusCode int `json:"statuscode"` StatusDesc string `json:"statusdesc"` Message string `json:"errormessage"` }
PingdomError represents an error response from the Pingdom API.
func (*PingdomError) Error ¶
func (r *PingdomError) Error() string
Return string representation of the PingdomError.
type PingdomResponse ¶
type PingdomResponse struct {
Message string `json:"message"`
}
PingdomResponse represents a general response from the Pingdom API.
type ProbeResponse ¶
type ProbeResponse struct { ID int `json:"id"` Country string `json:"country"` City string `json:"city"` Name string `json:"name"` Active bool `json:"active"` Hostname string `json:"hostname"` IP string `json:"ip"` IPv6 string `json:"ipv6"` CountryISO string `json:"countryiso"` Region string `json:"region"` }
ProbeResponse represents the JSON response for probes from the Pingdom API.
type ProbeService ¶
type ProbeService struct {
// contains filtered or unexported fields
}
ProbeService provides an interface to Pingdom probes.
func (*ProbeService) List ¶
func (cs *ProbeService) List(params ...map[string]string) ([]ProbeResponse, error)
List return a list of probes from Pingdom.
type Result ¶
type Result struct { ProbeID int `json:"probeid"` Time int `json:"time"` Status string `json:"status"` ResponseTime int `json:"responsetime"` StatusDesc string `json:"statusdesc"` StatusDescLong string `json:"statusdesclong"` }
Result reprensents the JSON response for a detailed check result.
type ResultsResponse ¶
type ResultsResponse struct { ActiveProbes []int `json:"activeprobes"` Results []Result `json:"results"` }
ResultsResponse represents the JSON response for detailed check results from the Pingdom API.
type SMSNotification ¶
type SMSNotification struct { CountryCode string `json:"country_code"` Number string `json:"number"` Provider string `json:"provider"` Severity string `json:"severity"` }
SMSNotification represents a text message notification
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 SummaryPerformanceRequest ¶
type SummaryPerformanceRequest struct { From int Id int IncludeUptime bool Order string Probes string Resolution string To int }
SummaryPerformanceRequest is the API request to Pingdom for a SummaryPerformance.
func (SummaryPerformanceRequest) GetParams ¶
func (csr SummaryPerformanceRequest) GetParams() (params map[string]string)
GetParams returns a map of params for a Pingdom SummaryPerformanceRequest.
func (SummaryPerformanceRequest) Valid ¶
func (csr SummaryPerformanceRequest) Valid() error
Valid determines whether a SummaryPerformanceRequest contains valid fields for the Pingdom API.
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 TCPCheck ¶
type TCPCheck struct { CustomMessage string `json:"custom_message,omitempty"` Hostname string `json:"hostname,omitempty"` IPV6 bool `json:"ipv6,omitempty"` IntegrationIds []int `json:"integrationids,omitempty"` Name string `json:"name"` NotifyAgainEvery int `json:"notifyagainevery,omitempty"` NotifyWhenBackup bool `json:"notifywhenbackup,omitempty"` Paused bool `json:"paused,omitempty"` Port int `json:"port"` ProbeFilters string `json:"probe_filters,omitempty"` Resolution int `json:"resolution,omitempty"` ResponseTimeThreshold int `json:"responsetime_threshold,omitempty"` SendNotificationWhenDown int `json:"sendnotificationwhendown,omitempty"` StringToExpect string `json:"stringtoexpect,omitempty"` StringToSend string `json:"stringtosend,omitempty"` Tags string `json:"tags,omitempty"` TeamIds []int `json:"teamids,omitempty"` UserIds []int `json:"userids,omitempty"` }
TCPCheck represents a Pingdom TCP check.
func (*TCPCheck) PostParams ¶
PostParams returns a map of parameters for a TCPCheck that can be sent along with an HTTP POST request. Same as PUT.
type TMSCheck ¶
type TMSCheck struct { Name string `json:"name,omitempty"` Steps []TMSCheckStep `json:"steps,omitempty"` Active bool `json:"active"` ContactIDs []int `json:"contact_ids,omitempty"` CustomMessage string `json:"custom_message,omitempty"` IntegrationIDs []int `json:"integration_ids,omitempty"` Interval int64 `json:"interval,omitempty"` Metadata *TMSCheckMetaData `json:"metadata,omitempty"` Region string `json:"region,omitempty"` SendNotificationWhenDown int `json:"send_notification_when_down,omitempty"` SeverityLevel string `json:"severity_level,omitempty"` Tags []string `json:"tags,omitempty"` TeamIDs []int `json:"team_ids,omitempty"` }
func (*TMSCheck) RenderForJSONAPI ¶
RenderForJSONAPI returns the JSON formatted version of this object that may be submitted to Pingdom
type TMSCheckDetailResponse ¶
type TMSCheckDetailResponse struct { TMSCheck ID int `json:"id,omitempty"` Type string `json:"type,omitempty"` LastDowntimeStart int64 `json:"last_downtime_start,omitempty"` LastDowntimeEnd int64 `json:"last_downtime_end,omitempty"` CreatedAt int64 `json:"created_at,omitempty"` ModifiedAt int64 `json:"modified_at,omitempty"` Status string `json:"status,omitempty"` }
TMSCheckDetailResponse represents the JSON response for a TMS Check from the Pingdom API.
type TMSCheckInterval ¶
type TMSCheckInterval struct { AverageResponse int64 `json:"average_response,omitempty"` Downtime int64 `json:"downtime,omitempty"` From string `json:"from,omitempty"` Steps []TMSCheckStepReport `json:"steps,omitempty"` Unmonitored int64 `json:"unmonitored,omitempty"` Uptime int64 `json:"uptime,omitempty"` }
type TMSCheckMetaData ¶
type TMSCheckPerformanceReportResponse ¶
type TMSCheckPerformanceReportResponse struct { CheckID int `json:"check_id,omitempty"` Name string `json:"name,omitempty"` Resolution string `json:"resolution,omitempty"` Intervals []TMSCheckInterval `json:"intervals,omitempty"` }
type TMSCheckResponse ¶
type TMSCheckResponse struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` Active bool `json:"active,omitempty"` Status string `json:"status,omitempty"` Interval int `json:"interval,omitempty"` Region string `json:"region,omitempty"` Tags []string `json:"tags,omitempty"` LastDowntimeStart int64 `json:"last_downtime_start,omitempty"` LastDowntimeEnd int64 `json:"last_downtime_end,omitempty"` CreatedAt int64 `json:"created_at,omitempty"` ModifiedAt int64 `json:"modified_at,omitempty"` }
TMSCheckResponse represents the JSON response for a TMS Check from the Pingdom API.
type TMSCheckSAPI ¶
TMSCheckSAPI is an interface representing a Pingdom team.
type TMSCheckService ¶
type TMSCheckService struct {
// contains filtered or unexported fields
}
func (*TMSCheckService) Create ¶
func (cs *TMSCheckService) Create(tmsCheck *TMSCheck) (*TMSCheckDetailResponse, error)
func (*TMSCheckService) Delete ¶
func (cs *TMSCheckService) Delete(id int) (*PingdomResponse, error)
func (*TMSCheckService) GetPerfomanceReport ¶
func (cs *TMSCheckService) GetPerfomanceReport(id int, params map[string]string) (*TMSCheckPerformanceReportResponse, error)
func (*TMSCheckService) GetStatusReport ¶
func (cs *TMSCheckService) GetStatusReport(id int, params map[string]string) (*TMSCheckStatusReportResponse, error)
func (*TMSCheckService) List ¶
func (cs *TMSCheckService) List(params ...map[string]string) ([]TMSCheckResponse, error)
List return a list of TMS checks from Pingdom.
func (*TMSCheckService) ListStatusReports ¶
func (cs *TMSCheckService) ListStatusReports(params map[string]string) ([]TMSCheckStatusReportResponse, error)
func (*TMSCheckService) Read ¶
func (cs *TMSCheckService) Read(id int) (*TMSCheckDetailResponse, error)
func (*TMSCheckService) Update ¶
func (cs *TMSCheckService) Update(id int, tmsCheck *TMSCheck) (*TMSCheckDetailResponse, error)
type TMSCheckStatus ¶
type TMSCheckStatusReportResponse ¶
type TMSCheckStatusReportResponse struct { CheckID int `json:"check_id,omitempty"` Name string `json:"name,omitempty"` States []TMSCheckStatus `json:"states,omitempty"` }
type TMSCheckStep ¶
type TMSCheckStepReport ¶
type TMSCheckStepReport struct { AverageResponse int64 `json:"average_response,omitempty"` Step TMSCheckStep `json:"step,omitempty"` }
type Team ¶
type Team struct { ID int `json:"id"` Name string `json:"name"` MemberIDs []int `json:"member_ids,omitempty"` }
Team represents a Pingdom Team Data.
func (*Team) RenderForJSONAPI ¶
RenderForJSONAPI returns the JSON formatted version of this object that may be submitted to Pingdom
type TeamDeleteResponse ¶
type TeamDeleteResponse struct {
Message string `json:"message"`
}
TeamDeleteResponse represents the JSON response for delete team from the Pingdom API.
type TeamMemberResponse ¶
type TeamMemberResponse struct { ID int `json:"id"` Name string `json:"name"` Type string `json:"type"` }
TeamMemberResponse represents the JSON response for contacts in alerting teams from the Pingdom API.
type TeamResponse ¶
type TeamResponse struct { ID int `json:"id"` Name string `json:"name,omitempty"` Members []TeamMemberResponse `json:"members,omitempty"` }
TeamResponse represents the JSON response for alerting teams from the Pingdom API.
type TeamService ¶
type TeamService struct {
// contains filtered or unexported fields
}
TeamService provides an interface to Pingdom teams.
func (*TeamService) Create ¶
func (cs *TeamService) Create(team TeamAPI) (*TeamResponse, error)
Create is used to create a new team.
func (*TeamService) Delete ¶
func (cs *TeamService) Delete(id int) (*TeamDeleteResponse, error)
Delete will delete the Team for the given ID.
func (*TeamService) List ¶
func (cs *TeamService) List() ([]TeamResponse, error)
List return a list of teams from Pingdom.
func (*TeamService) Read ¶
func (cs *TeamService) Read(id int) (*TeamResponse, error)
Read return a team object from Pingdom.
func (*TeamService) Update ¶
func (cs *TeamService) Update(id int, team TeamAPI) (*TeamResponse, error)
Update is used to update existing team.