Guest User

Untitled

a guest
Jul 23rd, 2018
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #
  2. # Add more ways you'd like to be able to monitor things.
  3. #
  4.  
  5. Monitor.config do |config|
  6. # load the config for the MySQL connection
  7. config.configuration_file "configuration.yaml"
  8. config.path = "/home/penso"
  9. config.log_file "monitoring.log"
  10. end
  11.  
  12. Monitor.alert do |monitor|
  13. monitor.query = "SELECT ... FROM ..."
  14. # This generate an exit(2) for NAGIOS
  15. monitor.results.first.to_i.should.be > 0
  16.  
  17. monitor.error_if("RailsModel.count < 10") do |error|
  18. error.alert "fabienpenso@gmail.com"
  19. end
  20.  
  21. # This allows more selective errors
  22. monitor.error_if("result.first.to_i < 10") do |error|
  23. error.alert "fabienpenso@gmail.com"
  24. error.exit(1)
  25. error.exit_message "Should have at least bla bla"
  26. end
  27.  
  28. monitor.error_if("result.first.to_i < 5") do |error|
  29. error.alert "fabienpenso@gmail.com"
  30. error.exit(2)
  31. error.exit_message "Should have at least bla bla"
  32. end
  33. end
Add Comment
Please, Sign In to add comment