Documentation ¶
Index ¶
- type API
- func (api *API) CreateGraphDefs(payloads []CreateGraphDefsPayload) error
- func (api *API) CreateHost(hostSpec HostSpec) (string, error)
- func (api *API) FindHost(id string) (*Host, error)
- func (api *API) FindHostByCustomIdentifier(customIdentifier string) (*Host, error)
- func (api *API) PostMetricsValues(metricsValues [](*CreatingMetricsValue)) error
- func (api *API) PutMetadata(hostID string, namespace string, metadata interface{}) (*http.Response, error)
- func (api *API) ReportCheckMonitors(hostID string, reports []*checks.Report) error
- func (api *API) RetireHost(hostID string) error
- func (api *API) UpdateHost(hostID string, hostSpec HostSpec) error
- func (api *API) UpdateHostStatus(hostID string, status string) error
- type CreateGraphDefsPayload
- type CreateGraphDefsPayloadMetric
- type CreatingMetricsValue
- type Error
- type Host
- type HostSpec
- type Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { BaseURL *url.URL APIKey string Verbose bool UA string DefaultHeaders http.Header }
API is the main interface of Mackerel API.
func (*API) CreateGraphDefs ¶ added in v0.10.0
func (api *API) CreateGraphDefs(payloads []CreateGraphDefsPayload) error
CreateGraphDefs register graph defs
func (*API) CreateHost ¶
CreateHost register the host to mackerel
func (*API) FindHostByCustomIdentifier ¶ added in v0.31.0
FindHostByCustomIdentifier find the host by the custom identifier
func (*API) PostMetricsValues ¶
func (api *API) PostMetricsValues(metricsValues [](*CreatingMetricsValue)) error
PostMetricsValues post metrics
func (*API) PutMetadata ¶ added in v0.40.0
func (api *API) PutMetadata(hostID string, namespace string, metadata interface{}) (*http.Response, error)
PutMetadata creates or updates metadata of a host.
func (*API) ReportCheckMonitors ¶ added in v0.16.0
ReportCheckMonitors sends reports of *checks.Checker() to Mackrel API server.
func (*API) RetireHost ¶ added in v0.20.0
RetireHost retires the host
func (*API) UpdateHost ¶
UpdateHost updates the host information on Mackerel.
type CreateGraphDefsPayload ¶ added in v0.10.0
type CreateGraphDefsPayload struct { Name string `json:"name"` DisplayName string `json:"displayName"` Unit string `json:"unit"` Metrics []CreateGraphDefsPayloadMetric `json:"metrics"` }
CreateGraphDefsPayload payload for post graph defs
type CreateGraphDefsPayloadMetric ¶ added in v0.10.0
type CreateGraphDefsPayloadMetric struct { Name string `json:"name"` DisplayName string `json:"displayName"` IsStacked bool `json:"isStacked"` }
CreateGraphDefsPayloadMetric repreesnt graph defs of each metric
type CreatingMetricsValue ¶
type CreatingMetricsValue struct { HostID string `json:"hostId"` Name string `json:"name"` Time float64 `json:"time"` Value interface{} `json:"value"` }
CreatingMetricsValue parameters of metric values
type Error ¶ added in v0.18.0
Error represents API error
func (*Error) IsClientError ¶ added in v0.18.0
IsClientError 4xx
func (*Error) IsServerError ¶ added in v0.18.0
IsServerError 5xx
type Host ¶
type Host struct { ID string `json:"id"` Name string `json:"name"` Type string `json:"type"` // TODO ENUM Status string `json:"status"` CustomIdentifier string `json:"customIdentifier"` }
Host XXX
type HostSpec ¶ added in v0.17.0
type HostSpec struct { Name string `json:"name"` Meta map[string]interface{} `json:"meta"` Interfaces interface{} `json:"interfaces"` RoleFullnames []string `json:"roleFullnames"` Checks []string `json:"checks"` DisplayName string `json:"displayName,omitempty"` CustomIdentifier string `json:"customIdentifier,omitempty"` }
HostSpec is host specifications sent Mackerel server per hour