Sensu handler fail to send email with change in occurrences from default (1) to 3 on specific check


#1

Team,

I have the specific check configure to run “standby” with handle to send email when I change the “occurrences” from 1 to 3 then handler failed to send the email.

If check is configure with occurrences set to 1 then handler send the email without any problem.

Following are my configuration on client and log data from sensu-server.log :

Any help will be great favor. For any questions let me know.

Check:

“windows-memeory-usage”:{

“command”: “c:\opt\sensu\embedded\bin\ruby.exe C:\opt\sensu\plugins\windows\check-memory.rb -w :::params.ram.warning|85::: -c :::params.ram.critical|95:::”,

“subscribers”: [

“Windows”

],

"standalone": true,

“interval”: 60,

“occurrences”: 3,

“handlers”: [“default”, “ops-sev-email”]

}

Handler:

“handlers”: {

“default”: {

“type”: “set”,

“handlers”: [

“stdout”

]

},

“stdout”: {

“type”: “pipe”,

“command”: “cat”

},

“ops-sev-email”: {

“type”: “pipe”,

“command”: “/opt/sensu/embedded/bin/ruby /etc/sensu/handlers/notification/mailer.rb”

}

}

}

Following is check configuration on sensu server for check definition (only difference is “standalone” is not define).

“windows-memeory-usage”:{

“command”: “c:\opt\sensu\embedded\bin\ruby.exe C:\opt\sensu\plugins\windows\check-memory.rb -w :::params.ram.warning|85::: -c :::params.ram.critical|95:::”,

“subscribers”: [

“Windows”

],

“interval”: 60,

“occurrences”: 3,

“handlers”: [“default”, “ops-sev-email”]

}

Data from sensu-server.log:

{“timestamp”:“2015-02-03T12:17:48.010762-0600”,“level”:“info”,“message”:“handling event”,“event”:{“id”:“27905b22-6921-4527-8851-97ab4d7e93e1”,“client”:{“name”:“l3vm61.l3.pluck.com”,“address”:“172.27.112.64 172.27.112.82”,“subscriptions”:[“Base”,“Stage”,“Windows”,“Webservers”,“l3vm61”],“version”:“0.13.0”,“timestamp”:1422987637},“check”:{“command”:“c:\opt\sensu\embedded\bin\ruby.exe C:\opt\sensu\plugins\windows\check-memory.rb -w :::params.ram.warning|85::: -c :::params.ram.critical|95:::”,“subscribers”:[“Windows”],“standalone”:true,“interval”:60,“occurrences”:3,“handlers”:[“default”,“ops-sev-email”],“name”:“windows-memeory-usage”,“issued”:1422987639,“executed”:1422987639,“duration”:1.56,“output”:“CheckRam WARNING: 94.8% RAM utilization\r\n”,“status”:1,“history”:[“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“2”,“1”]},“occurrences”:1,“action”:“create”},“handler”:{“type”:“pipe”,“command”:"/opt/sensu/embedded/bin/ruby /etc/sensu/handlers/notification/mailer.rb",“name”:“ops-sev-email”}}

{“timestamp”:“2015-02-03T12:17:48.882860-0600”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:"/opt/sensu/embedded/bin/ruby /etc/sensu/handlers/notification/mailer.rb",“name”:“ops-sev-email”},“output”:“not enough occurrences: l3vm61.l3.pluck.com/windows-memeory-usage\n”}

{“timestamp”:“2015-02-03T12:18:35.421721-0600”,“level”:“info”,“message”:“handling event”,“event”:{“id”:“9cca84cc-af0d-4fa1-8412-ab06654fb7ad”,“client”:{“name”:“l3vm61.l3.pluck.com”,“address”:“172.27.112.64 172.27.112.82”,“subscriptions”:[“Base”,“Stage”,“Windows”,“Webservers”,“l3vm61”],“version”:“0.13.0”,“timestamp”:1422987677},“check”:{“name”:“windows-memeory-usage”,“issued”:1422987513,“command”:“c:\opt\sensu\embedded\bin\ruby.exe C:\opt\sensu\plugins\windows\check-memory.rb -w :::params.ram.warning|85::: -c :::params.ram.critical|95:::”,“subscribers”:[“Windows”],“standalone”:true,“interval”:60,“occurrences”:3,“handlers”:[“default”,“ops-sev-email”],“executed”:1422987686,“duration”:1.513,“output”:“CheckRam WARNING: 93.83% RAM utilization\r\n”,“status”:1,“history”:[“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“2”,“1”,“1”]},“occurrences”:1,“action”:“create”},“handler”:{“type”:“pipe”,“command”:"/opt/sensu/embedded/bin/ruby /etc/sensu/handlers/notification/mailer.rb",“name”:“ops-sev-email”}}

{“timestamp”:“2015-02-03T12:18:36.324131-0600”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:"/opt/sensu/embedded/bin/ruby /etc/sensu/handlers/notification/mailer.rb",“name”:“ops-sev-email”},“output”:“not enough occurrences: l3vm61.l3.pluck.com/windows-memeory-usage\n”}

{“timestamp”:“2015-02-03T12:18:47.993931-0600”,“level”:“info”,“message”:“handling event”,“event”:{“id”:“ccde3083-693d-45d6-a9a3-0ff6457d3c80”,“client”:{“name”:“l3vm61.l3.pluck.com”,“address”:“172.27.112.64 172.27.112.82”,“subscriptions”:[“Base”,“Stage”,“Windows”,“Webservers”,“l3vm61”],“version”:“0.13.0”,“timestamp”:1422987697},“check”:{“command”:“c:\opt\sensu\embedded\bin\ruby.exe C:\opt\sensu\plugins\windows\check-memory.rb -w :::params.ram.warning|85::: -c :::params.ram.critical|95:::”,“subscribers”:[“Windows”],“standalone”:true,“interval”:60,“occurrences”:3,“handlers”:[“default”,“ops-sev-email”],“name”:“windows-memeory-usage”,“issued”:1422987699,“executed”:1422987699,“duration”:1.529,“output”:“CheckRam WARNING: 93.83% RAM utilization\r\n”,“status”:1,“history”:[“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“1”,“2”,“1”,“1”,“1”]},“occurrences”:1,“action”:“create”},“handler”:{“type”:“pipe”,“command”:"/opt/sensu/embedded/bin/ruby /etc/sensu/handlers/notification/mailer.rb",“name”:“ops-sev-email”}}

-Sanjay