Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Monitor custom software/package with watchdog?

    Scheduled Pinned Locked Moved General pfSense Questions
    9 Posts 2 Posters 761 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Y
      yegor
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • stephenw10S
        stephenw10 Netgate Administrator
        last edited by

        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.

        Y 1 Reply Last reply Reply Quote 0
        • Y
          yegor @stephenw10
          last edited by yegor

          @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

          1 Reply Last reply Reply Quote 0
          • stephenw10S
            stephenw10 Netgate Administrator
            last edited by

            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.

            Y 1 Reply Last reply Reply Quote 1
            • Y
              yegor @stephenw10
              last edited by yegor

              @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.

              1 Reply Last reply Reply Quote 0
              • stephenw10S
                stephenw10 Netgate Administrator
                last edited by

                It depends what you change but a service item like that should not be overwritten.

                Y 1 Reply Last reply Reply Quote 0
                • Y
                  yegor @stephenw10
                  last edited by

                  @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?

                  1 Reply Last reply Reply Quote 0
                  • stephenw10S
                    stephenw10 Netgate Administrator
                    last edited by

                    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.xml

                    Probably better to ask in development though.

                    Also see: https://docs.netgate.com/pfsense/en/latest/development/develop-packages.html

                    Y 1 Reply Last reply Reply Quote 1
                    • Y
                      yegor @stephenw10
                      last edited by

                      @stephenw10 Will do, thanks for your help!

                      1 Reply Last reply Reply Quote 1
                      • First post
                        Last post
                      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.