Documentation
¶
Overview ¶
Package grafana is an http client for api calls authenticated with not supported by github.com/grafana/grafana-api-golang-client TODO: make a PR to gapi and drop this duplicate implementation
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { ID int `json:"id"` OrgID int `json:"orgId"` Title string `json:"title"` Condition string `json:"condition"` Data []AlertQuery `json:"data,omitempty"` Updated time.Time `json:"updated"` // IntervalSeconds is in seconds IntervalSeconds int `json:"intervalSeconds"` Version int `json:"version"` UID string `json:"uid"` NamespaceUID string `json:"namespace_uid"` NamespaceID int `json:"namespace_id"` RuleGroup string `json:"rule_group"` NoDataState string `json:"no_data_state"` ExecErrState string `json:"exec_err_state"` }
Alert contains a Grafana alert data
type AlertQuery ¶
type AlertQuery struct { RefID string `json:"refId"` QueryType string `json:"queryType"` RelativeTimeRange struct { From time.Duration `json:"from"` To time.Duration `json:"to"` } DatasourceUID string `json:"datasourceUid"` Model interface{} `json:"model"` }
AlertQuery contains Grafana alert model
type AlertRule ¶
type AlertRule struct { Expr string `json:"expr"` For string `json:"for"` // Annotations is a map of key/value pairs Annotations map[string]string `json:"annotations"` // GrafanaAlert is a struct Alert Alert `json:"grafana_alert"` }
AlertRule contains Grafana alert rule
type Client ¶
type Client struct { APIKey string // contains filtered or unexported fields }
Client is a Grafana API client.
func (*Client) AllRuleGroups ¶
func (c *Client) AllRuleGroups() (RuleGroupsByFolder, error)
AllRuleGroups fetches all rules group names in folders
type HTTPClient ¶
HTTPClient is an interface to go http package
type RuleGroup ¶
type RuleGroup struct { Name string `json:"name"` Interval string `json:"interval"` Rules []AlertRule `json:"rules,omitempty"` }
RuleGroup contains alert rules in a group for a folder
type RuleGroupsByFolder ¶
RuleGroupsByFolder contains Grafana rule groups for a Folder type RuleGroupsByFolder map[string][]RuleGroupName
Click to show internal directories.
Click to hide internal directories.