Multiple Actions - IF <resource> <operator> <value> THEN <action1> OR|AND <action2>
Issue #818
new
It would be a very nice feature if i we can use multiple actions.
for example:
####
#
# Alert Puppet DB Crash
#
## check if puppetdb crashes comes into log
check file puppetserver.log with path /var/log/puppetlabs/puppetserver/puppetserver.log
start program = "/usr/bin/systemctl start puppetdb ; /usr/bin/systemctl start puppetserver"
stop program = "/usr/bin/systemctl stop puppetdb ; /usr/bin/systemctl stop puppetserver"
restart program = "/usr/bin/systemctl restart puppetdb ; /usr/bin/systemctl restart puppetserver"
if match "c.p.h.c.i.PersistentSyncHttpClient" then restart
if 3 restarts within 5 cycles then timeout
depends on puppetdb
alert root@localhost
## check & rescue puppetdb
check process puppetdb with pidfile /var/run/puppetlabs/puppetdb/puppetdb.pid
group puppetdb
start program = "/usr/bin/systemctl start puppetdb"
stop program = "/usr/bin/systemctl stop puppetdb"
restart program = "/usr/bin/systemctl restart puppetdb"
if failed uid puppetdb then unmonitor
if failed gid puppetdb then unmonitor
if failed port 8080 then restart
if 3 restarts within 5 cycles then timeout
depends on puppetserver
alert root@localhost
## check & rescue puppetserver
check file puppetserver with path /usr/lib/systemd/system/puppetserver.service
group puppet
start program = "/usr/bin/systemctl start puppetserver"
stop program = "/usr/bin/systemctl stop püppetserver"
restart program = "/usr/bin/systemctl restart puppetserver"
if failed permission 644 then unmonitor
if failed uid root then unmonitor
if failed gid root then unmonitor
if failed port 8140 then restart
if 3 restarts within 5 cycles then timeout
depends on puppetdb
alert root@localhost
Sometimes Puppet Crash with an special Log Entry:" c.p.h.c.i.PersistentSyncHttpClient" and if it crashed so we have to restart the PuppetDB (puppetserver) and the PuppetMaster (puppetserver) but it does not work for me because i can restart only one service or i've to create another start/stop script...
Hello,
you try to restart the "puppetserver" and "puppetdb" service outside Monit.
From my point of view something like the following should restart all services inside Monit.
You should not define a "depends on" to both, you define a dependency loop.
From my point of view the "puppetserver" should depend on "puppetdb".
By stopping "puppetdb" the "puppetserver" will stopped also.
And starting the "puppetserver" will start the "puppetdb" first. To use different start/stop services is the reason I removed the “restart program” statement.
A suggestion only,
Lutz
p.s.
The command “monit restart puppetdb“ will stop “puppetserver” and “puppetdb”, but start “puppetdb” only, unfortunatly.