Monitor custom software/package with watchdog?
-
Hi folks,
Is there a way to get the watchdog to monitor 3rd party services not listed in the drop down menu of services? How is that drop down menu actually populated?
-
Anything that's listed in the config file as a service and is not blacklisted should appear there.
It will need an rc file to actually start/restart it though. -
@stephenw10 Thanks, but can you please clarify what config file you're talking about?
What I'm trying to do is make this software "watchdog compatible": https://github.com/Control-D-Inc/ctrld
It writes an init script into /usr/local/etc/rc.d/ which makes it into a daemon that starts on boot. It uses -r -P flags, which works well and daemon restarts the service if pid is killed and you can still stop it using the explicit stop command. That's good, but I want to add this to be monitored by watchdog as well, as this is a fairly critical piece of software.
If you can provide some specifics or point me in the right direction, it would be great.
Thanks
-
I mean the main config file.
If you add a section in <installedpackages> like:
<service> <name>ctrld</name> <rcfile>ctrld.sh</rcfile> <executable>ctrld</executable> <description><![CDATA[Control-d]]></description> </service>
It will appear in the watchdog. You would need a valid ctrld.sh rc file though to actually restart it.
-
@stephenw10 Thanks for the info, will dig into this however at first glance the config file doesn't appear to persist. If you edit it manually and make a change in the web GUI, changes are gone.
-
It depends what you change but a service item like that should not be overwritten.
-
@stephenw10 I added your example config block via ssh + vi, it didn't take after any web GUI change (simply pressing save with no edits even). I then installed avahi package to get the config to contain at least one <service> block, and then added yours via Diagnostics -> Edit File, immediately after avahi's. Then it took, and is no longer being removed when using the GUI. see the ctrld service in both Services listing, and Watchdog. Hurray!
Finally, is it a good idea for external software to manipulate the main config file like this? I'm one of the authors, and we want to automate this during the install so the end user doesn't have to do anything, but it feels wrong to just edit an xml config like this - a mistake can bork the instance. Is there a better/more programmatic way of doing this?
-
It would normally get added during the pkg install process, for example:
https://github.com/pfsense/FreeBSD-ports/blob/devel/net/pfSense-pkg-udpbroadcastrelay/files/usr/local/pkg/udpbroadcastrelay.xmlProbably better to ask in development though.
Also see: https://docs.netgate.com/pfsense/en/latest/development/develop-packages.html
-
@stephenw10 Will do, thanks for your help!