Documentation
¶
Index ¶
- Constants
- Variables
- func SendPulse(url, payload string) (string, error)
- type Cert
- type Check
- type Checks
- type Client
- func (c *Client) Calls() uint
- func (c *Client) GetCheck(token string, withMetrics bool) (*Check, error)
- func (c *Client) GetChecks() (Checks, error)
- func (c *Client) GetDowntimes(token string, detailed bool) (Downtimes, error)
- func (c *Client) GetMetrics(token string, options MetricsOptions) (*Metrics, error)
- func (c *Client) GetNodes() (Nodes, error)
- func (c *Client) GetNodesIPs() ([]string, error)
- func (c *Client) GetNodesIPsV4() ([]string, error)
- func (c *Client) GetNodesIPsV6() ([]string, error)
- func (c *Client) GetRecipients() (Recipients, error)
- func (c *Client) GetStatusPages() (StatusPages, error)
- func (c *Client) SetUserAgent(app, version string)
- type Date
- type Downtime
- type DowntimeCheck
- type DowntimeIPv4Check
- type DowntimeIPv6Check
- type DowntimeRequest
- type DowntimeResponse
- type DowntimeTimings
- type Downtimes
- type Event
- type EventDown
- type EventPerformanceDrop
- type EventSSLExpiration
- type EventSSLInvalid
- type EventSSLRenewed
- type EventSSLValid
- type EventUp
- type Metrics
- type MetricsOptions
- type Node
- type Nodes
- type PerformanceApdex
- type PerformanceMetrics
- type Recipient
- type Recipients
- type RequestStats
- type ResponseTimeStats
- type SSL
- type SSLRenew
- type SSLStatus
- type StatusPage
- type StatusPages
- type TimingStats
- type Webhook
- type WebhookEvent
Constants ¶
const ( EVENT_DOWN = "check.down" EVENT_UP = "check.up" EVENT_SSL_INVALID = "check.ssl_invalid" EVENT_SSL_VALID = "check.ssl_valid" EVENT_SSL_EXPIRTAION = "check.ssl_expiration" EVENT_SSL_RENEWED = "check.ssl_renewed" EVENT_PERFORMANCE_DROP = "check.performance_drop" )
Variables ¶
Functions ¶
Types ¶
type Cert ¶
type Cert struct { Subject string `json:"subject"` Issuer string `json:"issuer"` From Date `json:"from"` To Date `json:"to"` Algorithm string `json:"algorithm"` }
Cert contains SSL certificate info
type Check ¶
type Check struct { Token string `json:"token"` URL string `json:"url"` Alias string `json:"alias"` LastStatus int `json:"last_status"` Uptime float64 `json:"uptime"` IsDown bool `json:"down"` DownSince Date `json:"down_since"` UpSince Date `json:"up_since"` Error string `json:"error"` Period int `json:"period"` Apdex float64 `json:"apdex_t"` StringMatch string `json:"string_match"` IsEnabled bool `json:"enabled"` IsPublished bool `json:"published"` LastCheckAt Date `json:"last_check_at"` NextCheckAt Date `json:"next_check_at"` CreatedAt Date `json:"created_at"` MuteUntil Date `json:"mute_until"` FaviconURL string `json:"favicon_url"` HTTPVerb string `json:"http_verb"` HTTPBody string `json:"http_body"` Recipients []string `json:"recipients"` DisabledLocations []string `json:"disabled_locations"` CustomHeaders map[string]string `json:"custom_headers"` SSL *SSLStatus `json:"ssl,omitempty"` Metrics *Metrics `json:"metrics,omitempty"` }
Check contains check info
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is Updown API client
func (*Client) GetDowntimes ¶
GetDowntimes returns all the downtimes of a check
func (*Client) GetMetrics ¶
func (c *Client) GetMetrics(token string, options MetricsOptions) (*Metrics, error)
GetMetrics returns detailed metrics about the check
func (*Client) GetNodesIPs ¶
GetNodesIPs returns list all updown.io servers addresses
func (*Client) GetNodesIPsV4 ¶
GetNodesIPsV4 returns list all updown.io servers IPv4 addresses
func (*Client) GetNodesIPsV6 ¶
GetNodesIPsV6 returns list all updown.io servers IPv6 addresses
func (*Client) GetRecipients ¶
func (c *Client) GetRecipients() (Recipients, error)
GetRecipients returns list all the possible alert recipients/channels on your account
func (*Client) GetStatusPages ¶
func (c *Client) GetStatusPages() (StatusPages, error)
GetStatusPages returns list all your status pages
func (*Client) SetUserAgent ¶
SetUserAgent sets client user agent
type Downtime ¶
type Downtime struct { ID string `json:"id"` DetailsURL string `json:"details_url"` Error string `json:"error"` StartedAt Date `json:"started_at"` EndedAt Date `json:"ended_at"` Duration int `json:"duration"` IsPartial bool `json:"partial"` DownResults []*DowntimeCheck `json:"down_results"` UpResults []*DowntimeCheck `json:"up_results"` }
Downtime contains info about downtime
type DowntimeCheck ¶
type DowntimeCheck struct { ID string `json:"id"` Status string `json:"status"` DetailsURL string `json:"details_url"` Request *DowntimeRequest `json:"request"` Response *DowntimeResponse `json:"response"` }
type DowntimeIPv4Check ¶
type DowntimeIPv4Check struct { Status string `json:"status"` IP string `json:"ip"` Code int `json:"code"` Timings *DowntimeTimings `json:"timings"` ReceivedHeaders map[string]string `json:"received_headers"` }
DowntimeIPv4Check contains info about check through IPv4 network
type DowntimeIPv6Check ¶
type DowntimeIPv6Check struct { Status string `json:"status"` IP string `json:"ip"` Code int `json:"code"` Timings *DowntimeTimings `json:"timings"` }
DowntimeIPv6Check contains info about check through IPv6 network
type DowntimeRequest ¶
type DowntimeRequest struct { SentAt Date `json:"sent_at"` HTTPMethod string `json:"http_method"` HTTPVersion string `json:"http_version"` SentHeaders map[string]string `json:"sent_headers"` Node string `json:"node"` }
DowntimeRequest contains info with downtime check request
type DowntimeResponse ¶
type DowntimeResponse struct { ReceivedAt Date `json:"received_at"` FinalURL string `json:"final_url"` Code int `json:"code"` IP string `json:"ip"` ReceivedHeaders map[string]string `json:"received_headers"` }
DowntimeResponse contains info with downtime check response
type DowntimeTimings ¶
type DowntimeTimings struct { NameLookup float64 `json:"namelookup"` Connection float64 `json:"connection"` Handshake float64 `json:"handshake"` Response float64 `json:"response"` Total float64 `json:"total"` }
DowntimeTimings contains downtime check timings
type Event ¶
type Event struct { Type string `json:"event"` Time Date `json:"time"` Description string `json:"description"` Check *Check `json:"check"` }
Event contains basic event data
type EventPerformanceDrop ¶
type EventPerformanceDrop struct { Event ApdexDropped string `json:"apdex_dropped"` LastMetrics *PerformanceMetrics `json:"last_metrics"` }
EventPerformanceDrop sent when the Apdex drops more than 30% below the lowest of the last 5 hours
type EventSSLExpiration ¶
EventSSLExpiration sent when your SSL certificate approaches expiration date (1, 7, 14, and 30 days before for 1y certs)
type EventSSLInvalid ¶
EventSSLInvalid sent when the SSL certificate is considered invalid
type EventSSLRenewed ¶
EventSSLRenewed sent when the SSL certificate was renewed close to expiration (recovery for check.ssl_expiration)
type EventSSLValid ¶
EventSSLValid sent when SSL certificate is valid again (recovery after a check.ssl_invalid event)
type Metrics ¶
type Metrics struct { Uptime float64 `json:"uptime"` Apdex float64 `json:"apdex"` Timings *TimingStats `json:"timings"` Requests *RequestStats `json:"requests"` }
Metrics is apdex metrics
type MetricsOptions ¶
MetricsOptions is options for metrics request
type Node ¶
type Node struct { IP string `json:"ip"` IPv6 string `json:"ip6"` City string `json:"city"` Country string `json:"country"` CountryCode string `json:"country_code"` Lat float64 `json:"lat"` Lon float64 `json:"lng"` }
Node contains info about check node
type PerformanceApdex ¶
PerformanceApdex contains apdex metric
type PerformanceMetrics ¶
type PerformanceMetrics struct {
Metrics []*PerformanceApdex
}
PerformanceMetrics is performance drop metrics
func (*PerformanceMetrics) UnmarshalJSON ¶
func (d *PerformanceMetrics) UnmarshalJSON(b []byte) error
UnmarshalJSON parses performance metrics
type Recipient ¶
type Recipient struct { ID string `json:"id"` Type string `json:"type"` Name string `json:"name"` Value string `json:"value"` }
Recipient contains info about alert recipient
type RequestStats ¶
type RequestStats struct { Samples int `json:"samples"` Failures int `json:"failures"` Satisfied int `json:"satisfied"` Tolerated int `json:"tolerated"` ByResponseTime *ResponseTimeStats `json:"by_response_time"` }
RequestStats contains check requests statistics
type ResponseTimeStats ¶
type ResponseTimeStats struct { Under125 int `json:"under125"` Under250 int `json:"under250"` Under500 int `json:"under500"` Under1k int `json:"under1000"` Under2k int `json:"under2000"` Under4k int `json:"under4000"` Under8k int `json:"under8000"` Under16k int `json:"under16000"` Under32k int `json:"under32000"` }
ResponseTimeStats contains check response time statistics
type SSL ¶
type SSL struct { Cert *Cert `json:"cert"` Error string `json:"error"` DaysBeforeExpiration int `json:"days_before_expiration"` }
SSL contains info about SSL certificate and it's status
type SSLStatus ¶
type SSLStatus struct { TestedAt Date `json:"tested_at"` ExpiresAt Date `json:"expires_at"` IsValid bool `json:"valid"` Error string `json:"error"` }
SSLStatus contains info about SSL certificate status
type StatusPage ¶
type StatusPage struct { Token string `json:"token"` URL string `json:"url"` Name string `json:"name"` Description string `json:"description"` Visibility string `json:"visibility"` AccessKey string `json:"access_key"` Checks []string `json:"checks"` }
StatusPage contains info about status check
type TimingStats ¶
type TimingStats struct { Redirect int `json:"redirect"` NameLookup int `json:"namelookup"` Connection int `json:"connection"` Handshake int `json:"handshake"` Response int `json:"response"` Total int `json:"total"` }
Timings check timings info
type Webhook ¶
type Webhook []*WebhookEvent
Webhook contains webhook payload
func ParseWebhook ¶
ParseWebhook parses webhook data
type WebhookEvent ¶
WebhookEvent contains webhook event data