Documentation
¶
Index ¶
- func FormatAlertsTable(alerts []Annotation) string
- type Alert
- type AlertGroupsResponse
- type AlertManagerClient
- type AlertRulerClient
- type Annotation
- type AnnotationsQueryParams
- type Client
- func (c *Client) DeleteAnnotation(annotationID int64) (*resty.Response, error)
- func (c *Client) GetAlertRulesForDashboardID(dashboardID string) ([]ProvisionedAlertRule, error)
- func (c *Client) GetAlertsRules() ([]ProvisionedAlertRule, *resty.Response, error)
- func (c *Client) GetAnnotations(params AnnotationsQueryParams) ([]Annotation, *resty.Response, error)
- func (c *Client) GetDashboard(uid string) (GetDashboardResponse, *resty.Response, error)
- func (c *Client) GetDatasources() (map[string]string, *resty.Response, error)
- func (c *Client) PostAnnotation(annotation PostAnnotation) (PostAnnotationResponse, *resty.Response, error)
- func (c *Client) PostDashboard(dashboard PostDashboardRequest) (GrafanaResponse, *resty.Response, error)
- type CustomTime
- type GetDashboardResponse
- type GrafanaResponse
- type PostAnnotation
- type PostAnnotationResponse
- type PostDashboardRequest
- 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 AlertRulerClient ¶
type AlertRulerClient struct {
// contains filtered or unexported fields
}
func (*AlertRulerClient) GetAlertsForDashboard ¶
func (g *AlertRulerClient) GetAlertsForDashboard(dashboardUID string) (map[string][]interface{}, *resty.Response, error)
ruler API is deprecated https://github.com/grafana/grafana/issues/74434
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
AlertRuler *AlertRulerClient
// contains filtered or unexported fields
}
func NewGrafanaClient ¶
func (*Client) DeleteAnnotation ¶
func (*Client) GetAlertRulesForDashboardID ¶
func (c *Client) GetAlertRulesForDashboardID(dashboardID string) ([]ProvisionedAlertRule, error)
func (*Client) GetAlertsRules ¶
func (c *Client) GetAlertsRules() ([]ProvisionedAlertRule, *resty.Response, error)
func (*Client) GetAnnotations ¶
func (c *Client) GetAnnotations(params AnnotationsQueryParams) ([]Annotation, *resty.Response, error)
func (*Client) GetDashboard ¶
func (c *Client) GetDashboard(uid string) (GetDashboardResponse, *resty.Response, error)
func (*Client) GetDatasources ¶
func (*Client) PostAnnotation ¶
func (c *Client) PostAnnotation(annotation PostAnnotation) (PostAnnotationResponse, *resty.Response, error)
func (*Client) PostDashboard ¶
func (c *Client) PostDashboard(dashboard PostDashboardRequest) (GrafanaResponse, *resty.Response, error)
type CustomTime ¶
func (*CustomTime) UnmarshalJSON ¶
func (ct *CustomTime) UnmarshalJSON(b []byte) error
type GetDashboardResponse ¶
type GrafanaResponse ¶
type GrafanaResponse struct {
ID *uint `json:"id"`
OrgID *uint `json:"orgId"`
Message *string `json:"message"`
Slug *string `json:"slug"`
Version *int `json:"version"`
Status *string `json:"status"`
UID *string `json:"uid"`
URL *string `json:"url"`
}
nolint:revive
type PostAnnotation ¶
type PostAnnotationResponse ¶
type PostDashboardRequest ¶
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.