Advertisement
Guest User

sensu-mail alert

a guest
Oct 23rd, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.77 KB | None | 0 0
  1. The occurrences parameter on the check does not work as it should..I'm getting spammed with emails because the default occurrences is 1. Even if i change it to 20 i still get an email for every critical occurrence. I checked sense-client and server logs but nothing which would tell me the reason why this is happening.
  2.  
  3.  
  4. sensu-client.log
  5. {"timestamp":"2014-10-23T17:04:32.091165-0400","level":"info","message":"publishing check result","payload":{"client":"sensu-client-2","check":{"command":"/etc/sensu/plugins/check-procs.rb -p crond -C 1 ","interval":60,"standalone":true,"handlers":["mail"],"occurrences":20,"refresh":100,"name":"cron_check","issued":1414098271,"executed":1414098271,"duration":0.114,"output":"CheckProcs CRITICAL: Found 0 matching processes; cmd /crond/\n","status":2}}}
  6.  
  7.  
  8. sensu-server.log
  9. {"timestamp":"2014-10-23T17:02:49.123269-0400","level":"info","message":"handling event","event":{"id":"26257519-71d2-4859-b0bd-da3fcbdfb449","client":{"name":"sensu-client-2","address":"10.199.8.13","subscriptions":["all"],"version":"0.13.1","timestamp":1414098270},"check":{"command":"/etc/sensu/plugins/check-procs.rb -p crond -C 1 ","interval":60,"standalone":true,"handlers":["mail"],"occurrences":20,"refresh":100,"name":"cron_check","issued":1414098271,"executed":1414098271,"duration":0.114,"output":"CheckProcs CRITICAL: Found 0 matching processes; cmd /crond/\n","status":2,"history":["0","0","2","2","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","2"]},"occurrences":1,"action":"create"},"handler":{"type":"pipe","command":"mail -s 'sensu-alert' akshay.anilkapoor@ruckuswireless.com","severities":["critical"],"name":"mail"}}
  10.  
  11.  
  12. {"timestamp":"2014-10-23T17:02:54.847716-0400","level":"info","message":"determining stale clients"}
  13. {"timestamp":"2014-10-23T17:02:57.525943-0400","level":"info","message":"publishing check request","payload":{"name":"cpu_check","issued":1414098177,"command":"/etc/sensu/plugins/memory-metrics.rb"},"subscribers":["cpu"]}
  14. {"timestamp":"2014-10-23T17:03:04.993603-0400","level":"info","message":"pruning aggregations"}
  15. {"timestamp":"2014-10-23T17:03:07.529663-0400","level":"info","message":"publishing check request","payload":{"name":"cpu_check","issued":1414098187,"command":"/etc/sensu/plugins/memory-metrics.rb"},"subscribers":["cpu"]}
  16. {"timestamp":"2014-10-23T17:03:17.532337-0400","level":"info","message":"publishing check request","payload":{"name":"cpu_check","issued":1414098197,"command":"/etc/sensu/plugins/memory-metrics.rb"},"subscribers":["cpu"]}
  17. {"timestamp":"2014-10-23T17:03:24.851117-0400","level":"info","message":"determining stale clients"}
  18. {"timestamp":"2014-10-23T17:03:24.994703-0400","level":"info","message":"pruning aggregations"}
  19. {"timestamp":"2014-10-23T17:03:27.534657-0400","level":"info","message":"publishing check request","payload":{"name":"cpu_check","issued":1414098207,"command":"/etc/sensu/plugins/memory-metrics.rb"},"subscribers":["cpu"]}
  20. {"timestamp":"2014-10-23T17:03:37.537498-0400","level":"info","message":"publishing check request","payload":{"name":"cpu_check","issued":1414098217,"command":"/etc/sensu/plugins/memory-metrics.rb"},"subscribers":["cpu"]}
  21. {"timestamp":"2014-10-23T17:03:44.996150-0400","level":"info","message":"pruning aggregations"}
  22. {"timestamp":"2014-10-23T17:03:47.540493-0400","level":"info","message":"publishing check request","payload":{"name":"cpu_check","issued":1414098227,"command":"/etc/sensu/plugins/memory-metrics.rb"},"subscribers":["cpu"]}
  23.  
  24. {"timestamp":"2014-10-23T17:03:49.122165-0400","level":"info","message":"handling event","event":{"id":"c9b9faf6-ce5a-4762-b47c-afe1e9d3b187","client":{"name":"sensu-client-2","address":"10.199.8.13","subscriptions":["all"],"version":"0.13.1","timestamp":1414098330},"check":{"command":"/etc/sensu/plugins/check-procs.rb -p crond -C 1 ","interval":60,"standalone":true,"handlers":["mail"],"occurrences":20,"refresh":100,"name":"cron_check","issued":1414098331,"executed":1414098331,"duration":0.114,"output":"CheckProcs CRITICAL: Found 0 matching processes; cmd /crond/\n","status":2,"history":["0","2","2","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","2","2"]},"occurrences":2,"action":"create"},"handler":{"type":"pipe","command":"mail -s 'sensu-alert' akshay.anilkapoor@ruckuswireless.com","severities":["critical"],"name":"mail"}}
  25.  
  26.  
  27.  
  28. --> Handler definition on the server handler_mail.json
  29. {
  30. "handlers": {
  31. "mail": {
  32. "type":"pipe",
  33. "command": "mail -s 'sensu-alert' a@b.com",
  34. "severities": [ "critical" ]
  35. }
  36. }
  37. }
  38.  
  39.  
  40. --> Check on the client
  41. {
  42. "checks": {
  43. "cron_check": {
  44. "command": "/etc/sensu/plugins/check-procs.rb -p crond -C 1 ",
  45. "interval": 60,
  46. "standalone": true,
  47. "handlers": [ "mail" ],
  48. "occurrences": 20,
  49. "refresh": 100
  50. }
  51. }
  52. }
  53.  
  54. Thanks!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement