Monitor and restart custom tasks



  • I start two tasks (dnsmasq & olsr) with custom boot shell scripts and not the gui.
    How do I include my tasks with custom parameters into pfSense's normal mechanism that monitors stopped/crashed tasks and restarts them when needed or perhaps even reboots?  Though I've never had a problem with this yet on any of my pfSense routers after months of uptime, I just wanted to be prepared.
    Thank you,
    -pc



  • Either use the hidden config.xml parameters ( http://faq.pfsense.com/index.php?action=artikel&cat=10&id=38&artlang=en&highlight=hidden ) to start them at boot or maybe add the scripts to your crontab.



  • pfSense does not include service supervision.  You will need to roll your own.



  • Does anyone have a Script to share capable of monitoring task(s) something like this ? …

    1. Verify T.1 Task(s) are active process(es) in good condition as far as can reasonably be determined, if not take T.2 action.
    2. If any T.1 Task(s) are consuming over C% CPU, checked every I time interval, occuring R number of times in a row, then take T.2 action.
    3. Check the system.log every I time interval for occurance(s) of L.1 string list, if found take L.2 action.
    4. If ping times to P.1 host are above P.2 ms, checked every P.3 time interval, occuring P.4 number of times in a row, take P.5 action.

    Example Constants I define: T.1=('olsr','dnsmasq') : T.2=('reboot', 'restart'), C=30 %, I=30 sec, R=3, L.1=('hardware failure','halted') : L.2=('reboot','reboot'), P.1='192.168.1.1', P.2=500 ms, P.3=30 sec, P.4=5, P.5='reset ath0'),  -- actions: 'reboot'=reboot, 'reset ath0'=reset interface, 'restart'=run /usr/local/etc/rc.d/'T.1'.sh but if restart or reset fails or is triggered again within 12hrs then reboot.

    If not, I may post a small bounty.
    Thanks,

    • Pete

Log in to reply