feat(server): add zenoss alert parsing
parent
c7e74cacd7
commit
2a4337c94c
14
kapacitor.go
14
kapacitor.go
|
@ -26,6 +26,7 @@ type AlertNodes struct {
|
|||
ServiceNow []*ServiceNow `json:"serviceNow"` // ServiceNow alert options
|
||||
BigPanda []*BigPanda `json:"bigPanda"` // BigPanda alert options
|
||||
Teams []*Teams `json:"teams"` // Teams alert options
|
||||
Zenoss []*Zenoss `json:"zenoss"` // Zenoss alert options
|
||||
}
|
||||
|
||||
// Post will POST alerts to a destination URL
|
||||
|
@ -162,6 +163,19 @@ type Teams struct {
|
|||
ChannelURL string `json:"channel-url"` // override configuration
|
||||
}
|
||||
|
||||
// Teams properties
|
||||
type Zenoss struct {
|
||||
Action string `json:"action"`
|
||||
Method string `json:"method"`
|
||||
Type string `json:"type"`
|
||||
TID int64 `json:"tid"`
|
||||
|
||||
Device string `json:"device"`
|
||||
Component string `json:"component"`
|
||||
EventClassKey string `json:"evclasskey"`
|
||||
EventClass string `json:"evclass"`
|
||||
}
|
||||
|
||||
// MarshalJSON converts AlertNodes to JSON
|
||||
func (n *AlertNodes) MarshalJSON() ([]byte, error) {
|
||||
type Alias AlertNodes
|
||||
|
|
|
@ -207,6 +207,34 @@ func TestAlertServices(t *testing.T) {
|
|||
want: `alert()
|
||||
.teams()
|
||||
.channelURL('https://outlook.office.com/webhook/...')
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: "Test Zenoss",
|
||||
rule: chronograf.AlertRule{
|
||||
AlertNodes: chronograf.AlertNodes{
|
||||
Zenoss: []*chronograf.Zenoss{{
|
||||
Action: "a",
|
||||
Method: "b",
|
||||
Type: "c",
|
||||
TID: 4,
|
||||
Device: "e",
|
||||
Component: "f",
|
||||
EventClassKey: "g",
|
||||
EventClass: "h",
|
||||
}},
|
||||
},
|
||||
},
|
||||
want: `alert()
|
||||
.zenoss()
|
||||
.action('a')
|
||||
.method('b')
|
||||
.type('c')
|
||||
.TID(4)
|
||||
.device('e')
|
||||
.component('f')
|
||||
.eventClassKey('g')
|
||||
.eventClass('h')
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue