Notification Interval

I am new to Sensu and currently attempting to change the notification interval when a check changes state. At the moment my checks are working, however when the state changes to critical for example the email notification to every subsequent check. I have attempted to added occurrences and refresh options but it doesn’t seem to be taken into consideration. An example of my configs are below, i have removed the options I have attempted to leave them as basic as possible.

check_cron.json

{

“checks”: {

“cron”: {

“command”: “check-process.rb -p cron”,

“subscribers”: [

“controller”

],

“interval”: 60,

“handlers”:[“default”, “email”]

}

}

}

handler_email.json

{

“handlers”: {

“email”: {

“type”: “pipe”,

“command”: “mailx -s ‘sensu event’ root@localhost”

}

}

}

Any help/advice would be greatly appreciated. I am ideally looking to increase the notification interval to every 60 minutes or even on state change.

To quote Kyle, "I recommend moving on to using a more standard email hander:

https://github.com/sensu-plugins/sensu-plugins-mailer "

If you use the plugin mailer, it uses the parameter
refresh

``

to determine the delay between emails. Details can be found at https://sensuapp.org/docs/0.24/reference/plugins.html#example-check-plugin-definition

By default it sends a new email every 30 occurrences.

Thus you could have a check like this:
{
“checks”: {
“check-ram-windows”: {
“command”: “check-windows-ram.rb.bat -w 90”,
“handlers”: [
“default”,
“mailer”,
“graphite_notify”
],
“interval”: 60,
“subscribers”: [
“windows”
],
“standalone”: false,
“occurrences”: 3,
“refresh”: 14400
}
}
}

``

This will alert after 3 occurrences, and repeat the email after 14,400 seconds or 4 hours

Cheers,

Joel

···

On Thursday, 9 June 2016 11:24:39 UTC+1, DC wrote:

I am new to Sensu and currently attempting to change the notification interval when a check changes state. At the moment my checks are working, however when the state changes to critical for example the email notification to every subsequent check. I have attempted to added occurrences and refresh options but it doesn’t seem to be taken into consideration. An example of my configs are below, i have removed the options I have attempted to leave them as basic as possible.

check_cron.json

{

“checks”: {

“cron”: {

“command”: “check-process.rb -p cron”,

“subscribers”: [

“controller”

],

“interval”: 60,

“handlers”:[“default”, “email”]

}

}

}

handler_email.json

{

“handlers”: {

“email”: {

“type”: “pipe”,

“command”: “mailx -s ‘sensu event’ root@localhost”

}

}

}

Any help/advice would be greatly appreciated. I am ideally looking to increase the notification interval to every 60 minutes or even on state change.