Dear all,
I would like to add a process checking for Crowdsec in opnsense.
If it fails then restart.
May I know how should I set this up?
Thank you.
Oh...No one knows Monit?
Is there any other places that I can get help please?
You add a Service test which checks for the relevant process. It should be easy if you know the path to it
seems to be in /var/run/crowdsec.pid
Thank you both. :)
Could you please advise how to setup "Service Test settings"?
I don't know how to set condition.
You add a Service Setting, Type Process, PID file is path to crowdsec and you add service crowdsec start to Start field .. I think it doesnt even need a Test or similar.
Quote from: mimugmail on October 02, 2023, 03:04:00 PM
You add a Service Setting, Type Process, PID file is path to crowdsec and you add service crowdsec start to Start field .. I think it doesnt even need a Test or similar.
When I added this it showed me error.
"Should be a valid absolute path to the executable with its arguments."
Is there a good monit tutorial for OPNsense.
Quote from: xpking on October 03, 2023, 05:09:00 PM
Quote from: mimugmail on October 02, 2023, 03:04:00 PM
You add a Service Setting, Type Process, PID file is path to crowdsec and you add service crowdsec start to Start field .. I think it doesnt even need a Test or similar.
When I added this it showed me error.
"Should be a valid absolute path to the executable with its arguments."
/usr/sbin/service ?
You can verify via CLI
Quote from: lilsense on October 05, 2023, 03:21:22 AM
Is there a good monit tutorial for OPNsense.
No, in theory you can do anything with it. Just read the examples in the docs and play a bit
With the help of the OPNsense documentation and chatgpt I was able to get Monit to monitor crowdsec:
Services -> Monit-> Settings -> Service Test Settings Tab -> Add (+)
Name: no_pid
Condition: does not exist
Action: Restart
Services -> Monit-> Settings -> Service Test Settings Tab -> Add (+)
Name: RestartLimit5
Condition: 5 restarts within 5 cycles
Action: Unmonitor
Services -> Monit-> Settings -> Service Settings Tab -> Add (+)
Enable service checks -> Check
Name: crowdsec
Type -> Process
Pid File: /var/run/crowdsec.pid
Start: /usr/local/etc/rc.d/crowdsec start
Stop: /usr/local/etc/rc.d/crowdsec stop
Tests -> no_pid,RestartLimit5
Depends -> Nothing Selected
Description: check to see if crowdsec is running
Note: Match can be left blank.
See screenshots below.
Thx for sharing