2

I've got Monit configuration with:

check system example.com
    if loadavg (1min) > 4 then alert
    if loadavg (5min) > 2 then alert

I want to get rid of messages every time backup is running at night, but I do not want to turn it off completely.

How to add check for gzip/bzip2 process runing like:

`ps aux | grep '\[gb\]zip'`

or disable that one check at some time?

Jacek Kaniuk
  • 194
  • 1
  • 11

3 Answers3

6

You can tell Monit to stop monitoring during certain times (ie while your backup is running). It uses the same syntax as cron. There are good examples in Monit Documentation in the Service Poll Times section. You probably want something like:

check system example.com
not every "* 2-4 * * *"

This will stop monitoring every night from 2am-4am

Ian
  • 176
  • 1
  • 1
2

You should "unmonitor" the system load check during the backup interval.

monit unmonitor example.com

You can do this for a specific duration with an at script or just cron, if you know your backup window time.

Resume the monitoring after the backup window:

monit monitor example.com

ewwhite
  • 194,921
  • 91
  • 434
  • 799
  • That sounds good but I've got problem with it (root, shell): # monit unmonitor example.com monit: action failed -- You are not authorized to access monit. Either you supplied the wrong credentials (e.g. bad password), or your browser doesn't understand how to sup – Jacek Kaniuk Oct 04 '11 at 11:46
  • What's the output of `monit status` ? – ewwhite Oct 04 '11 at 12:02
  • monit: cannot read status from the monit daemon. Monit listens on 0 0.0.0.0:2812 and is not blocked on firewall or anything – Jacek Kaniuk Oct 04 '11 at 12:17
  • status, unmonitor etc. are "Optional action arguments for non-daemon mode", but my monit runs as daemon – Jacek Kaniuk Oct 04 '11 at 12:22
1

Stop monit when run backup.

Like:

  ==backup.sh==
  /usr/local/etc/rc.d/monit stop
  ...do backup...
  /usr/local/etc/rc.d/monit start
Korjavin Ivan
  • 2,230
  • 2
  • 25
  • 39