Different warning and critical notification intervals

I’m trying to set up warning and critical checks for disk space that have different notification policies. The criteria is:

  • Warning: Should check every 60 seconds, and send a notification if the condition holds true for 5 occurrences.

  • Critical: Should check every 10 seconds and create an event on first occurrence.

  • Warning notification should not be sent if critical criteria is true.

Here’s what I have, but the warning event triggers regardless of an active critical event. Any help is greatly appreciated.

{

“checks”: {

“warning_disk_check”: {

“command”: “/etc/sensu/plugins/check-disk.rb -w 85”,

“interval”: 60,

“subscribers”: [ “ALL” ],

“handle”: true,

“occurrences”: 5,

“handlers”: [“slack”]

},

“critical_disk_check”: {

“command”: “/etc/sensu/plugins/check-disk.rb -c 95”,

“interval”: 10,

“subscribers”: [ “ALL” ],

“handle”: true,

“occurrences”: 1,

“handlers”: [“slack”]

}

}

}

Thanks!

You could use check dependencies:
http://sensuapp.org/docs/0.16/checks#check-dependencies

To make it so the warning_disk_check will not fire if the
critical_disk_check is active? (make warning dependent on critical)

This.. might make you get duplicate "resolve" messages though? This is
a kinda tricky thing to get right.

···

On Fri, Feb 27, 2015 at 6:29 AM, Bao Nguyen <bnguyen@ctacorp.com> wrote:

I'm trying to set up warning and critical checks for disk space that have
different notification policies. The criteria is:
- Warning: Should check every 60 seconds, and send a notification if the
condition holds true for 5 occurrences.
- Critical: Should check every 10 seconds and create an event on first
occurrence.
- Warning notification should not be sent if critical criteria is true.

Here's what I have, but the warning event triggers regardless of an active
critical event. Any help is greatly appreciated.

{
  "checks": {
    "warning_disk_check": {
      "command": "/etc/sensu/plugins/check-disk.rb -w 85",
      "interval": 60,
      "subscribers": [ "ALL" ],
      "handle": true,
      "occurrences": 5,
      "handlers": ["slack"]
    },
    "critical_disk_check": {
      "command": "/etc/sensu/plugins/check-disk.rb -c 95",
      "interval": 10,
      "subscribers": [ "ALL" ],
      "handle": true,
      "occurrences": 1,
      "handlers": ["slack"]
    }
  }
}

Thanks!