Documentation
¶
Index ¶
- func FormatAlertsTable(alerts []Annotation) string
- type Alert
- type AlertGroupsResponse
- type AlertManagerClient
- type Annotation
- type AnnotationsQueryParams
- type Client
- func (g *Client) GetAlertRulesForDashboardID(dashboardID string) ([]ProvisionedAlertRule, error)
- func (g *Client) GetAlertsForDashboard(dashboardUID string) (map[string][]interface{}, *resty.Response, error)
- func (g *Client) GetAlertsRules() ([]ProvisionedAlertRule, *resty.Response, error)
- func (g *Client) GetAnnotations(params AnnotationsQueryParams) ([]Annotation, *resty.Response, error)
- func (g *Client) PostAnnotation(annotation PostAnnotation) (*resty.Response, error)
- type CustomTime
- type PostAnnotation
- type ProvisionedAlertRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatAlertsTable ¶
func FormatAlertsTable(alerts []Annotation) string
Types ¶
type Alert ¶
type Alert struct { Annotations struct { DashboardUID string `json:"__dashboardUid__"` OrgID string `json:"__orgId__"` PanelID string `json:"__panelId__"` Description string `json:"description"` RunbookURL string `json:"runbook_url"` Summary string `json:"summary"` } `json:"annotations"` EndsAt time.Time `json:"endsAt"` Fingerprint string `json:"fingerprint"` Receivers []struct { Active interface{} `json:"active"` Integrations interface{} `json:"integrations"` Name string `json:"name"` } `json:"receivers"` StartsAt time.Time `json:"startsAt"` Status struct { InhibitedBy []interface{} `json:"inhibitedBy"` SilencedBy []interface{} `json:"silencedBy"` State string `json:"state"` } `json:"status"` UpdatedAt time.Time `json:"updatedAt"` GeneratorURL string `json:"generatorURL"` Labels map[string]string `json:"labels"` }
type AlertGroupsResponse ¶
type AlertGroupsResponse struct { Alerts []Alert `json:"alerts"` Labels struct { Alertname string `json:"alertname"` GrafanaFolder string `json:"grafana_folder"` } `json:"labels"` Receiver struct { Active interface{} `json:"active"` Integrations interface{} `json:"integrations"` Name string `json:"name"` } `json:"receiver"` }
AlertGroupsResponse is response body for "api/alertmanager/grafana/api/v2/alerts/groups"
type AlertManagerClient ¶
type AlertManagerClient struct {
// contains filtered or unexported fields
}
func (*AlertManagerClient) GetAlertGroups ¶
func (g *AlertManagerClient) GetAlertGroups() ([]AlertGroupsResponse, *resty.Response, error)
func (*AlertManagerClient) GetAlterManagerAlerts ¶
func (g *AlertManagerClient) GetAlterManagerAlerts() ([]interface{}, *resty.Response, error)
type Annotation ¶
type Annotation struct { ID int64 `json:"id"` AlertID int64 `json:"alertId"` DashboardID int64 `json:"dashboardId"` DashboardUID string `json:"dashboardUID"` PanelID int64 `json:"panelId"` PrevState string `json:"prevState"` NewState string `json:"newState"` Text string `json:"text"` Time CustomTime `json:"time"` TimeEnd CustomTime `json:"timeEnd"` Created CustomTime `json:"created"` Updated CustomTime `json:"updated"` Tags []interface{} `json:"tags"` Data interface{} `json:"data"` }
type AnnotationsQueryParams ¶
type Client ¶
type Client struct { AlertManager *AlertManagerClient // contains filtered or unexported fields }
func NewGrafanaClient ¶
func (*Client) GetAlertRulesForDashboardID ¶
func (g *Client) GetAlertRulesForDashboardID(dashboardID string) ([]ProvisionedAlertRule, error)
func (*Client) GetAlertsForDashboard ¶
func (g *Client) GetAlertsForDashboard(dashboardUID string) (map[string][]interface{}, *resty.Response, error)
ruler API is deprecated https://github.com/grafana/grafana/issues/74434
func (*Client) GetAlertsRules ¶
func (g *Client) GetAlertsRules() ([]ProvisionedAlertRule, *resty.Response, error)
func (*Client) GetAnnotations ¶
func (g *Client) GetAnnotations(params AnnotationsQueryParams) ([]Annotation, *resty.Response, error)
func (*Client) PostAnnotation ¶
func (g *Client) PostAnnotation(annotation PostAnnotation) (*resty.Response, error)
type CustomTime ¶
func (*CustomTime) UnmarshalJSON ¶
func (ct *CustomTime) UnmarshalJSON(b []byte) error
type PostAnnotation ¶
type ProvisionedAlertRule ¶
type ProvisionedAlertRule struct { ID int64 `json:"id"` UID string `json:"uid"` FolderUID string `json:"folderUID"` Title string `json:"title"` Data []interface{} `json:"data"` ExecErrState string `json:"execErrState"` Labels map[string]string `json:"labels"` RuleGroup string `json:"ruleGroup"` UpdatedAt time.Time `json:"updated"` Annotations map[string]string `json:"annotations"` }
func (ProvisionedAlertRule) String ¶
func (p ProvisionedAlertRule) String() string
Click to show internal directories.
Click to hide internal directories.