monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reload starts new cycle - Ship RPMs with monit integration


From: Jens Bräuer
Subject: Reload starts new cycle - Ship RPMs with monit integration
Date: Sat, 9 Jul 2011 10:11:52 +0200

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 @address@hidden@address@hidden with pidfile 
/var/run/@address@hidden@address@hidden
      start program = "/etc/init.d/@address@hidden@service.api.version@ start"
      stop program = "/etc/init.d/@address@hidden@service.api.version@ 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]