Hi everyone,

I package a bunch of applications as RPM file. Part of the post-install process 
is to issue "monit reload" followed by a "monit monitor all". I do this to make 
monit read the (possibly updated) config files under /etc/monit.d. However I 
noticed, that this kicks of a whole new cycle in monit (even though the 
previous cycle is just over).

My rpm post-script reads like

------------------
%post
#! /bin/bash
if [ -x /sbin/service ]; then
   /sbin/service "%{name}" start 2>&1 | logger -t rpm
fi
/usr/bin/monit reload
sleep 2
/usr/bin/monit -g "%{name}" monitor all >/dev/null 2>&1
exit 0
------------------

My monit file for the services read like

------------------
check process @project.name@[email protected]@.process with pidfile 
/var/run/@project.name@[email protected]@.pid
      start program = "/etc/init.d/@project.name@[email protected]@ start"
      stop program = "/etc/init.d/@project.name@[email protected]@ stop"
      if not exist for 5 cycles then alert
      if cpu > 75% for 5 cycles then alert
      if failed host 127.0.0.1 port @service.port@ for 5 cycles then alert
      if not exist for 2 cycles then restart
------------------

The main config file has 

------------------
...
set daemon 60
....
------------------

The intention was, to get the service restarted after 2minutes and get a alert 
after 5minutes. However when I install a couple of those RPMs, where each comes 
with its own "monit reload", I now have 5cycles in 15 seconds. This leads to 
false alarms, that I like to prevent.

I there a best practice in the monit world I could follow? Do you guys have 
recommendations how to solve this?

Thanks a lot in advance,
Jens



--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to