Add kapacitor alert node structs

pull/10616/head
Chris Goller 2017-02-08 22:18:23 -06:00
parent 9e0340a63d
commit 926dfae5c8
2 changed files with 26 additions and 9 deletions

View File

@ -107,7 +107,8 @@ type AlertRule struct {
ID string `json:"id,omitempty"` // ID is the unique ID of the alert ID string `json:"id,omitempty"` // ID is the unique ID of the alert
Query QueryConfig `json:"query"` // Query is the filter of data for the alert. Query QueryConfig `json:"query"` // Query is the filter of data for the alert.
Every string `json:"every"` // Every how often to check for the alerting criteria Every string `json:"every"` // Every how often to check for the alerting criteria
Alerts []string `json:"alerts"` // AlertServices name all the services to notify (e.g. pagerduty) Alerts []string `json:"alerts"` // Alerts name all the services to notify (e.g. pagerduty)
AlertNodes []KapacitorNode `json:"alertNodes"` // AlertNodes define additional arguments to alerts
Message string `json:"message"` // Message included with alert Message string `json:"message"` // Message included with alert
Details string `json:"details"` // Details is generally used for the Email alert. If empty will not be added. Details string `json:"details"` // Details is generally used for the Email alert. If empty will not be added.
Trigger string `json:"trigger"` // Trigger is a type that defines when to trigger the alert Trigger string `json:"trigger"` // Trigger is a type that defines when to trigger the alert
@ -173,6 +174,20 @@ type QueryConfig struct {
RawText string `json:"rawText,omitempty"` RawText string `json:"rawText,omitempty"`
} }
// KapacitorNode adds arguments and properties to an alert
type KapacitorNode struct {
Name string `json:"name"`
Args []string `json:"args"`
Properties []*KapacitorProperty `json:"properties"`
// In the future we could add chaining methods here.
}
// KapacitorProperty modifies the node they are called on
type KapacitorProperty struct {
Name string `json:"name"`
Args []string `json:"args"`
}
// Server represents a proxy connection to an HTTP server // Server represents a proxy connection to an HTTP server
type Server struct { type Server struct {
ID int // ID is the unique ID of the server ID int // ID is the unique ID of the server

View File

@ -1714,6 +1714,8 @@
"items": { "items": {
"type": "string", "type": "string",
"enum": [ "enum": [
"post",
"tcp",
"hipchat", "hipchat",
"opsgenie", "opsgenie",
"pagerduty", "pagerduty",