Documentation ¶
Index ¶
- type Alert
- type BlockDevice
- type CPU
- type Client
- func (c *Client) CloseAlert(alertID string, reason string) (*Alert, error)
- func (c *Client) CreateDashboard(param *Dashboard) (*Dashboard, error)
- func (c *Client) CreateGraphAnnotation(annotation *GraphAnnotation) (*GraphAnnotation, error)
- func (c *Client) CreateGraphDefs(payloads []*GraphDefsParam) error
- func (c *Client) CreateHost(param *CreateHostParam) (string, error)
- func (c *Client) CreateMonitor(param Monitor) (Monitor, error)
- func (c *Client) DeleteDashboard(dashboardID string) (*Dashboard, error)
- func (c *Client) DeleteGraphAnnotation(annotationID string) (*GraphAnnotation, error)
- func (c *Client) DeleteMonitor(monitorID string) (Monitor, error)
- func (c *Client) FetchHostMetricValues(hostID string, metricName string, from int64, to int64) ([]MetricValue, error)
- func (c *Client) FetchLatestMetricValues(hostIDs []string, metricNames []string) (LatestMetricValues, error)
- func (c *Client) FetchServiceMetricValues(serviceName string, metricName string, from int64, to int64) ([]MetricValue, error)
- func (c *Client) FindAlerts() ([]*Alert, error)
- func (c *Client) FindDashboard(dashboardID string) (*Dashboard, error)
- func (c *Client) FindDashboards() ([]*Dashboard, error)
- func (c *Client) FindGraphAnnotations(service string, from int64, to int64) ([]GraphAnnotation, error)
- func (c *Client) FindHost(id string) (*Host, error)
- func (c *Client) FindHosts(param *FindHostsParam) ([]*Host, error)
- func (c *Client) FindMonitors() ([]Monitor, error)
- func (c *Client) FindServices() ([]*Service, error)
- func (c *Client) GetOrg() (*Org, error)
- func (c *Client) PostHostMetricValues(metricValues [](*HostMetricValue)) error
- func (c *Client) PostHostMetricValuesByHostID(hostID string, metricValues [](*MetricValue)) error
- func (c *Client) PostJSON(path string, payload interface{}) (*http.Response, error)
- func (c *Client) PostServiceMetricValues(serviceName string, metricValues [](*MetricValue)) error
- func (c *Client) PutJSON(path string, payload interface{}) (*http.Response, error)
- func (c *Client) Request(req *http.Request) (resp *http.Response, err error)
- func (c *Client) RetireHost(id string) error
- func (c *Client) UpdateDashboard(dashboardID string, param *Dashboard) (*Dashboard, error)
- func (c *Client) UpdateGraphAnnotation(annotationID string, annotation *GraphAnnotation) (*GraphAnnotation, error)
- func (c *Client) UpdateHost(hostID string, param *UpdateHostParam) (string, error)
- func (c *Client) UpdateHostRoleFullnames(hostID string, roleFullnames []string) error
- func (c *Client) UpdateHostStatus(hostID string, status string) error
- func (c *Client) UpdateMonitor(monitorID string, param Monitor) (Monitor, error)
- type Cloud
- type CreateHostParam
- type Dashboard
- type FileSystem
- type FindHostsParam
- type GraphAnnotation
- type GraphDefsMetric
- type GraphDefsParam
- type HeaderField
- type Host
- type HostMeta
- type HostMetricValue
- type Interface
- type Kernel
- type LatestMetricValues
- type Memory
- type MetricValue
- type Monitor
- type MonitorConnectivity
- type MonitorExpression
- type MonitorExternalHTTP
- type MonitorHostMetric
- type MonitorServiceMetric
- type Org
- type Roles
- type Service
- type UpdateHostParam
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { ID string `json:"id,omitempty"` Status string `json:"status,omitempty"` MonitorID string `json:"monitorId,omitempty"` Type string `json:"type,omitempty"` HostID string `json:"hostId,omitempty"` Value float64 `json:"value,omitempty"` Message string `json:"message,omitempty"` Reason string `json:"reason,omitempty"` OpenedAt int64 `json:"openedAt,omitempty"` ClosedAt int64 `json:"closedAt,omitempty"` }
Alert information
type Client ¶
type Client struct { BaseURL *url.URL APIKey string Verbose bool UserAgent string AdditionalHeaders http.Header }
Client api client for mackerel
func NewClientWithOptions ¶
NewClientWithOptions returns new mackerel.Client
func (*Client) CloseAlert ¶
CloseAlert close alert
func (*Client) CreateDashboard ¶
CreateDashboard creating dashboard
func (*Client) CreateGraphAnnotation ¶
func (c *Client) CreateGraphAnnotation(annotation *GraphAnnotation) (*GraphAnnotation, error)
CreateGraphAnnotation creates graph annotation.
func (*Client) CreateGraphDefs ¶
func (c *Client) CreateGraphDefs(payloads []*GraphDefsParam) error
CreateGraphDefs create graph defs
func (*Client) CreateHost ¶
func (c *Client) CreateHost(param *CreateHostParam) (string, error)
CreateHost creating host
func (*Client) CreateMonitor ¶
CreateMonitor creating monitor
func (*Client) DeleteDashboard ¶
DeleteDashboard delete dashboard
func (*Client) DeleteGraphAnnotation ¶
func (c *Client) DeleteGraphAnnotation(annotationID string) (*GraphAnnotation, error)
DeleteGraphAnnotation deletes graph annotation.
func (*Client) DeleteMonitor ¶
DeleteMonitor update monitor
func (*Client) FetchHostMetricValues ¶
func (c *Client) FetchHostMetricValues(hostID string, metricName string, from int64, to int64) ([]MetricValue, error)
FetchHostMetricValues retrieves the metric values for a Host
func (*Client) FetchLatestMetricValues ¶
func (c *Client) FetchLatestMetricValues(hostIDs []string, metricNames []string) (LatestMetricValues, error)
FetchLatestMetricValues fetch latest metrics
func (*Client) FetchServiceMetricValues ¶
func (c *Client) FetchServiceMetricValues(serviceName string, metricName string, from int64, to int64) ([]MetricValue, error)
FetchServiceMetricValues retrieves the metric values for a Service
func (*Client) FindDashboard ¶
FindDashboard find dashboard
func (*Client) FindDashboards ¶
FindDashboards find dashboards
func (*Client) FindGraphAnnotations ¶
func (c *Client) FindGraphAnnotations(service string, from int64, to int64) ([]GraphAnnotation, error)
FindGraphAnnotations fetches graph annotation.
func (*Client) FindHosts ¶
func (c *Client) FindHosts(param *FindHostsParam) ([]*Host, error)
FindHosts find hosts
func (*Client) FindMonitors ¶
FindMonitors find monitors
func (*Client) FindServices ¶
FindServices finds services.
func (*Client) PostHostMetricValues ¶
func (c *Client) PostHostMetricValues(metricValues [](*HostMetricValue)) error
PostHostMetricValues post host metrics
func (*Client) PostHostMetricValuesByHostID ¶
func (c *Client) PostHostMetricValuesByHostID(hostID string, metricValues [](*MetricValue)) error
PostHostMetricValuesByHostID post host metrics
func (*Client) PostServiceMetricValues ¶
func (c *Client) PostServiceMetricValues(serviceName string, metricValues [](*MetricValue)) error
PostServiceMetricValues post service metrics
func (*Client) RetireHost ¶
RetireHost retuire the host
func (*Client) UpdateDashboard ¶
UpdateDashboard update dashboard
func (*Client) UpdateGraphAnnotation ¶
func (c *Client) UpdateGraphAnnotation(annotationID string, annotation *GraphAnnotation) (*GraphAnnotation, error)
UpdateGraphAnnotation updates graph annotation.
func (*Client) UpdateHost ¶
func (c *Client) UpdateHost(hostID string, param *UpdateHostParam) (string, error)
UpdateHost updates host
func (*Client) UpdateHostRoleFullnames ¶
UpdateHostRoleFullnames updates host roles
func (*Client) UpdateHostStatus ¶
UpdateHostStatus updates host status
type Cloud ¶
type Cloud struct { Provider string `json:"provider,omitempty"` MetaData interface{} `json:"metadata,omitempty"` }
Cloud cloud
type CreateHostParam ¶
type CreateHostParam struct { Name string `json:"name,omitempty"` DisplayName string `json:"displayName,omitempty"` Meta HostMeta `json:"meta,omitempty"` Interfaces []Interface `json:"interfaces,omitempty"` RoleFullnames []string `json:"roleFullnames,omitempty"` CustomIdentifier string `json:"customIdentifier,omitempty"` }
CreateHostParam parameters for CreateHost
type Dashboard ¶
type Dashboard struct { ID string `json:"id,omitempty"` Title string `json:"title,omitempty"` BodyMarkDown string `json:"bodyMarkdown,omitempty"` URLPath string `json:"urlPath,omitempty"` CreatedAt int64 `json:"createdAt,omitempty"` UpdatedAt int64 `json:"updatedAt,omitempty"` }
Dashboard information
type FindHostsParam ¶
type FindHostsParam struct { Service string Roles []string Name string Statuses []string CustomIdentifier string }
FindHostsParam parameters for FindHosts
type GraphAnnotation ¶
type GraphAnnotation struct { ID string `json:"id,omitempty"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` From int64 `json:"from,omitempty"` To int64 `json:"to,omitempty"` Service string `json:"service,omitempty"` Roles []string `json:"roles,omitempty"` }
GraphAnnotation represents parameters to post graph annotation.
type GraphDefsMetric ¶
type GraphDefsMetric struct { Name string `json:"name"` DisplayName string `json:"displayName"` IsStacked bool `json:"isStacked"` }
GraphDefsMetric graph metric
type GraphDefsParam ¶
type GraphDefsParam struct { Name string `json:"name"` DisplayName string `json:"displayName"` Unit string `json:"unit"` Metrics []*GraphDefsMetric `json:"metrics"` }
GraphDefsParam parameters for posting graph definitions
type HeaderField ¶
HeaderField represents key-value pairs in an HTTP header for external http monitoring.
type Host ¶
type Host struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` DisplayName string `json:"displayName,omitempty"` CustomIdentifier string `json:"customIdentifier,omitempty"` Type string `json:"type,omitempty"` Status string `json:"status,omitempty"` Memo string `json:"memo,omitempty"` Roles Roles `json:"roles,omitempty"` RoleFullnames []string `json:"roleFullnames,omitempty"` IsRetired bool `json:"isRetired,omitempty"` CreatedAt int32 `json:"createdAt,omitempty"` Meta HostMeta `json:"meta,omitempty"` Interfaces []Interface `json:"interfaces,omitempty"` }
Host host information
func (*Host) DateFromCreatedAt ¶
DateFromCreatedAt returns time.Time
func (*Host) DateStringFromCreatedAt ¶
DateStringFromCreatedAt returns date string
func (*Host) GetRoleFullnames ¶
GetRoleFullnames getrolefullnames
func (*Host) IPAddresses ¶
IPAddresses returns ipaddresses
type HostMeta ¶
type HostMeta struct { AgentRevision string `json:"agent-revision,omitempty"` AgentVersion string `json:"agent-version,omitempty"` BlockDevice BlockDevice `json:"block_device,omitempty"` CPU CPU `json:"cpu,omitempty"` Filesystem FileSystem `json:"filesystem,omitempty"` Kernel Kernel `json:"kernel,omitempty"` Memory Memory `json:"memory,omitempty"` Cloud Cloud `json:"cloud,omitempty"` }
HostMeta host meta informations
type HostMetricValue ¶
type HostMetricValue struct { HostID string `json:"hostId,omitempty"` *MetricValue }
HostMetricValue host metric value
type Interface ¶
type Interface struct { Name string `json:"name,omitempty"` IPAddress string `json:"ipAddress,omitempty"` IPv4Addresses []string `json:"ipv4Addresses,omitempty"` IPv6Addresses []string `json:"ipv6Addresses,omitempty"` MacAddress string `json:"macAddress,omitempty"` }
Interface network interface
type LatestMetricValues ¶
type LatestMetricValues map[string]map[string]*MetricValue
LatestMetricValues latest metric value
type MetricValue ¶
type MetricValue struct { Name string `json:"name,omitempty"` Time int64 `json:"time,omitempty"` Value interface{} `json:"value,omitempty"` }
MetricValue metric value
type Monitor ¶
type Monitor interface { MonitorType() string MonitorID() string MonitorName() string // contains filtered or unexported methods }
Monitor represents interface to which each monitor type must confirm to.
type MonitorConnectivity ¶
type MonitorConnectivity struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Memo string `json:"memo,omitempty"` Type string `json:"type,omitempty"` IsMute bool `json:"isMute,omitempty"` NotificationInterval uint64 `json:"notificationInterval,omitempty"` Scopes []string `json:"scopes,omitempty"` ExcludeScopes []string `json:"excludeScopes,omitempty"` }
MonitorConnectivity represents connectivity monitor.
func (*MonitorConnectivity) MonitorID ¶
func (m *MonitorConnectivity) MonitorID() string
MonitorID returns monitor id.
func (*MonitorConnectivity) MonitorName ¶
func (m *MonitorConnectivity) MonitorName() string
MonitorName returns monitor name.
func (*MonitorConnectivity) MonitorType ¶
func (m *MonitorConnectivity) MonitorType() string
MonitorType returns monitor type.
type MonitorExpression ¶
type MonitorExpression struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Memo string `json:"memo,omitempty"` Type string `json:"type,omitempty"` IsMute bool `json:"isMute,omitempty"` NotificationInterval uint64 `json:"notificationInterval,omitempty"` Expression string `json:"expression,omitempty"` Operator string `json:"operator,omitempty"` Warning float64 `json:"warning"` Critical float64 `json:"critical"` }
MonitorExpression represents expression monitor.
func (*MonitorExpression) MonitorID ¶
func (m *MonitorExpression) MonitorID() string
MonitorID returns monitor id.
func (*MonitorExpression) MonitorName ¶
func (m *MonitorExpression) MonitorName() string
MonitorName returns monitor name.
func (*MonitorExpression) MonitorType ¶
func (m *MonitorExpression) MonitorType() string
MonitorType returns monitor type.
type MonitorExternalHTTP ¶
type MonitorExternalHTTP struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Memo string `json:"memo,omitempty"` Type string `json:"type,omitempty"` IsMute bool `json:"isMute,omitempty"` NotificationInterval uint64 `json:"notificationInterval,omitempty"` Method string `json:"method,omitempty"` URL string `json:"url,omitempty"` MaxCheckAttempts uint64 `json:"maxCheckAttempts,omitempty"` Service string `json:"service,omitempty"` ResponseTimeCritical float64 `json:"responseTimeCritical,omitempty"` ResponseTimeWarning float64 `json:"responseTimeWarning,omitempty"` ResponseTimeDuration float64 `json:"responseTimeDuration,omitempty"` RequestBody string `json:"requestBody,omitempty"` ContainsString string `json:"containsString,omitempty"` CertificationExpirationCritical uint64 `json:"certificationExpirationCritical,omitempty"` CertificationExpirationWarning uint64 `json:"certificationExpirationWarning,omitempty"` SkipCertificateVerification bool `json:"skipCertificateVerification,omitempty"` // Empty list of headers and nil are different. You have to specify empty // list as headers explicitly if you want to remove all headers instead of // using nil. Headers []HeaderField `json:"headers"` }
MonitorExternalHTTP represents external HTTP monitor.
func (*MonitorExternalHTTP) MonitorID ¶
func (m *MonitorExternalHTTP) MonitorID() string
MonitorID returns monitor id.
func (*MonitorExternalHTTP) MonitorName ¶
func (m *MonitorExternalHTTP) MonitorName() string
MonitorName returns monitor name.
func (*MonitorExternalHTTP) MonitorType ¶
func (m *MonitorExternalHTTP) MonitorType() string
MonitorType returns monitor type.
type MonitorHostMetric ¶
type MonitorHostMetric struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Memo string `json:"memo,omitempty"` Type string `json:"type,omitempty"` IsMute bool `json:"isMute,omitempty"` NotificationInterval uint64 `json:"notificationInterval,omitempty"` Metric string `json:"metric,omitempty"` Operator string `json:"operator,omitempty"` Warning float64 `json:"warning"` Critical float64 `json:"critical"` Duration uint64 `json:"duration,omitempty"` MaxCheckAttempts uint64 `json:"maxCheckAttempts,omitempty"` Scopes []string `json:"scopes,omitempty"` ExcludeScopes []string `json:"excludeScopes,omitempty"` }
MonitorHostMetric represents host metric monitor.
func (*MonitorHostMetric) MonitorID ¶
func (m *MonitorHostMetric) MonitorID() string
MonitorID returns monitor id.
func (*MonitorHostMetric) MonitorName ¶
func (m *MonitorHostMetric) MonitorName() string
MonitorName returns monitor name.
func (*MonitorHostMetric) MonitorType ¶
func (m *MonitorHostMetric) MonitorType() string
MonitorType returns monitor type.
type MonitorServiceMetric ¶
type MonitorServiceMetric struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Memo string `json:"memo,omitempty"` Type string `json:"type,omitempty"` IsMute bool `json:"isMute,omitempty"` NotificationInterval uint64 `json:"notificationInterval,omitempty"` Service string `json:"service,omitempty"` Metric string `json:"metric,omitempty"` Operator string `json:"operator,omitempty"` Warning float64 `json:"warning"` Critical float64 `json:"critical"` Duration uint64 `json:"duration,omitempty"` MaxCheckAttempts uint64 `json:"maxCheckAttempts,omitempty"` }
MonitorServiceMetric represents service metric monitor.
func (*MonitorServiceMetric) MonitorID ¶
func (m *MonitorServiceMetric) MonitorID() string
MonitorID returns monitor id.
func (*MonitorServiceMetric) MonitorName ¶
func (m *MonitorServiceMetric) MonitorName() string
MonitorName returns monitor name.
func (*MonitorServiceMetric) MonitorType ¶
func (m *MonitorServiceMetric) MonitorType() string
MonitorType returns monitor type.
type Service ¶
type Service struct { Name string `json:"name,omitempty"` Memo string `json:"memo,omitempty"` Roles []string `json:"roles,omitempty"` }
Service represents Mackerel "service".
type UpdateHostParam ¶
type UpdateHostParam CreateHostParam
UpdateHostParam parameters for UpdateHost