Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
General Discussion
»
Help on using monit to restart igmp-proxy when that service is down
« previous
next »
Print
Pages: [
1
]
Author
Topic: Help on using monit to restart igmp-proxy when that service is down (Read 1617 times)
ijsboeker
Newbie
Posts: 6
Karma: 1
Help on using monit to restart igmp-proxy when that service is down
«
on:
March 04, 2022, 10:13:37 pm »
Hi everybody,
I would like to use monit to monitor the igmp-proxy service and if it is down, restart it (let's say 5 times to prevent a loop).
Have tried to follow some examples (but there is no example in OPNSense documentation for monitoring a service/process directly) and the monit documentation but haven't got it to work yet.
Somebody has some pointers for me?
Any help is appreciated. Thanks and regards,
Joris.
Logged
Greelan
Hero Member
Posts: 1028
Karma: 72
Re: Help on using monit to restart igmp-proxy when that service is down
«
Reply #1 on:
March 04, 2022, 11:03:25 pm »
This may help:
https://forum.opnsense.org/index.php?topic=18745.msg97953#msg97953
It monitors for the PID, and if it doesn’t exist runs relevant commands. Obv you would need to adapt for igmp-proxy.
Logged
ijsboeker
Newbie
Posts: 6
Karma: 1
Re: Help on using monit to restart igmp-proxy when that service is down
«
Reply #2 on:
March 14, 2022, 02:42:24 pm »
Thank you Greelan!
I found another reference on the forum on using PID for this but that did not include the same amount of info on how to exactly implement this. I will give this a spin and if I get it working I will post it here for future reference.
Logged
ijsboeker
Newbie
Posts: 6
Karma: 1
Re: Help on using monit to restart igmp-proxy when that service is down
«
Reply #3 on:
March 14, 2022, 06:24:51 pm »
Had a look into it this afternoon, but unfortunately the igmpproxy service does not use a PID file. Not in /var/run or anywhere else on the system.
But I have got this to work by using a custom Service monitor & a shell script checking if the 'igmpproxy' service is running. The Service Test is a duplicate of 'NonZeroStatus' but then adapted to do a restart when there is a non-zero exit instead of just an alert.
Script file (/root/igmpproxy-checker.sh):
Code:
[Select]
#!/bin/sh
if pgrep igmpproxy > /dev/null
then
exit 0
else
exit 1
fi
I have attached pictures of the Monit custom Service & Service Test settings.
One odd thing that I found is that I had to use 'onestart' instead of just 'start' to get the igmpproxy restarted. Don't exactly know whay that is, but at least it works for me now.
Thanks again Greelan for giving me a nudge in the right direction.
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
English Forums
»
General Discussion
»
Help on using monit to restart igmp-proxy when that service is down