mackerel

package
v0.43.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

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 NewAPI added in v0.14.1

func NewAPI(rawurl string, apiKey string, verbose bool) (*API, error)

NewAPI creates a new instance of API.

func (*API) CreateGraphDefs added in v0.10.0

func (api *API) CreateGraphDefs(payloads []CreateGraphDefsPayload) error

CreateGraphDefs register graph defs

func (*API) CreateHost

func (api *API) CreateHost(hostSpec HostSpec) (string, error)

CreateHost register the host to mackerel

func (*API) FindHost

func (api *API) FindHost(id string) (*Host, error)

FindHost find the host

func (*API) FindHostByCustomIdentifier added in v0.31.0

func (api *API) FindHostByCustomIdentifier(customIdentifier string) (*Host, error)

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

func (api *API) ReportCheckMonitors(hostID string, reports []*checks.Report) error

ReportCheckMonitors sends reports of *checks.Checker() to Mackrel API server.

func (*API) RetireHost added in v0.20.0

func (api *API) RetireHost(hostID string) error

RetireHost retires the host

func (*API) UpdateHost

func (api *API) UpdateHost(hostID string, hostSpec HostSpec) error

UpdateHost updates the host information on Mackerel.

func (*API) UpdateHostStatus added in v0.17.0

func (api *API) UpdateHostStatus(hostID string, status string) error

UpdateHostStatus updates the status of the host

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

type Error struct {
	StatusCode int
	Message    string
}

Error represents API error

func (*Error) Error added in v0.18.0

func (aperr *Error) Error() string

func (*Error) IsClientError added in v0.18.0

func (aperr *Error) IsClientError() bool

IsClientError 4xx

func (*Error) IsServerError added in v0.18.0

func (aperr *Error) IsServerError() bool

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"`
}

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

type Time added in v0.16.0

type Time time.Time

Time is a type for sending time information to Mackerel API server. It is encoded as an epoch seconds integer in JSON.

func (Time) MarshalJSON added in v0.16.0

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL