Hello, thanks for the library.
I'm creating a new watcher in Elasticsearch and 2 things, don't seem to work.
The webhook adds a Request item to the Json body which causes an validation error.
The interval trigger is missing.
{
"trigger" : {
"schedule" : {
"interval" : "10s"
}
},
"input": {
"search": {
"request": {
"body": {
"query": {
"term": {
"alarmType": {
"value": "critical"
}
}
}
}
}
}
},
"condition": {
"always": {}
},
"actions": {
"webAction": {
"webhook": {
"port": 5000,
"host": "localhost",
"path": "/api/WatcherEvents/CriticalAlarm",
"method": "post",
"headers": {
"Content-Type": "application/json;charset=utf-8"
},
"body": "\"{{ctx.payload.hits.total}}\""
}
}
}
}
var response = client.PutWatch("critical-alarm-watch", p => p
.Trigger(t => t
.Schedule(s => s
.Hourly(h => h
.Minute(0, 20)
)
)
)
.Input(i => i
.Search(s => s
.Request(r => r
.Body<AlarmMessage>(b => b
.Query(q => q.Term(qt => qt.AlarmType, "critical"))
)
)
)
)
.Condition(c => c.Always())
.Actions(a => a.Add("webAction",
new WebhookAction
{
Request = new WatcherHttpRequest
{
Method = HttpMethod.Post,
Host= "localhost",
Port= 5000,
Path= "/api/WatcherEvents/CriticalAlarm",
Headers= header,
Body= "\"{{ctx.payload.hits.total}}\""
}
}
))