AB,
thanks for your feedback.
I already tried to play with 'occurrences' parameter, indeed it's
currently used in this specific check:
$ cat /etc/sensu/conf.d/check_vps_bth.json
{
"checks": {
"bth_http_check": {
"command": "check-http.rb -t 30 -u http://<REMOVED>",
"interval": 300,
"occurrences": 3,
"subscribers": [ "vps-client" ],
"handler": "handler_tg"
}
}
}
Logs taken from sensu-client:
...
{"timestamp":"2017-01-01T11:23:42.695616+0100","level":"info","message":"publishing
check result","payload":{"clie
nt":"vps-client","check":{"command":"check-http.rb -t 30 -u
http://<REMOVED>","occurrences":3,"handle
r":"handler_tg","name":"bth_http_check","issued":1483266220,"executed":1483266220,"duration":2.39,"output":"CheckH
ttp OK: 200, 22540 bytes\n","status":0}}}
{"timestamp":"2017-01-01T11:28:40.306685+0100","level":"info","message":"received
check request","check":{"command
":"check-http.rb -t 30 -u
http://<REMOVED>","occurrences":3,"handler":"handler_tg","name":"bth_http_c
heck","issued":1483266520}}
{"timestamp":"2017-01-01T11:28:48.602332+0100","level":"info","message":"publishing
check result","payload":{"clie
nt":"vps-client","check":{"command":"check-http.rb -t 30 -u
http://<REMOVED>","occurrences":3,"handle
r":"handler_tg","name":"bth_http_check","issued":1483266520,"executed":1483266520,"duration":8.295,"output":"Check
Http OK: 200, 22540 bytes\n","status":0}}}
{"timestamp":"2017-01-01T11:33:40.309080+0100","level":"info","message":"received
check request","check":{"command
":"check-http.rb -t 30 -u
http://<REMOVED>","occurrences":3,"handler":"handler_tg","name":"bth_http_c
heck","issued":1483266820}}
{"timestamp":"2017-01-01T11:34:10.762051+0100","level":"info","message":"publishing
check result","payload":{"clie
nt":"vps-client","check":{"command":"check-http.rb -t 30 -u
http://<REMOVED>","occurrences":3,"handle
r":"handler_tg","name":"bth_http_check","issued":1483266820,"executed":1483266820,"duration":30.452,"output":"Chec
kHttp CRITICAL: Request timed out\n","status":2}}}
...
I've received the notification at 11:34:10AM, the same timestamp
reported in logs (last record).
So can you confirm that, due to the ""occurrences": 3," config of the check,
sensu tried 3 times to perform the check and only after triggered the
handler action?
Why these '3 times' are not reported in log?
-f
···
On Mon, Jan 2, 2017 at 9:21 AM, AB <anders@brandwatch.com> wrote:
Hi fRANz,
based on the thread tittle I would say just to use "occurances" in the check
definition.
https://sensuapp.org/docs/latest/reference/plugins#check-definition-attributes