8

I want to have Monit check a web application's health, running a cheap/trivial check frequently and an expensive/nontrivial check less frequently (e.g. 1/5 minutes). How can I tell it to check a given host less frequently than every monitoring interval?

npt
  • 313
  • 3
  • 10

2 Answers2

14

I was looking at the Monit documentation and stumbled across this:

check process dynamo with pidfile /etc/dynamo.pid every 2 cycles
       start program = "/etc/init.d/dynamo start"
       stop program  = "/etc/init.d/dynamo stop"
       if failed port 8840 then alert

So you could specify any number of check cycles between checks for your expensive check. Configure Monit to have the check interval you desire.

Jodie C
  • 733
  • 6
  • 9
2

Two options:

  1. Run a second instance of Monit with a different pid file, different check interval and a different config file.
  2. Wrap the expensive check in a script that will repeat the status of the last check until the next "expensive interval". Adjust the alert count to compensate.
Jodie C
  • 733
  • 6
  • 9