ntpd pid file gone in 22.1?

Started by pyrodex, January 27, 2022, 09:20:21 PM

Previous topic - Next topic
So I had MONIT configured to monitor NTP via the pid file that in 21.X was under /var/run/ntpd.pid and with the upgrade to 22.1 it is gone.


root@firewall:/var/run # ps auxww | grep ntp
nobody   41571   0.0  0.1  750856  23484  -  S    14:29     0:00.57 /usr/local/bin/node_exporter --web.listen-address=192.168.14.1:9100 --collector.textfile.directory=/var/tmp/node_exporter --collector.ntp --collector.devstat
root     87267   0.0  0.0   21768   6936  -  Ss   15:17     0:00.02 /usr/local/sbin/ntpd -g -c /var/etc/ntpd.conf
root     74685   0.0  0.0   12740   2348  0  S+   15:19     0:00.00 grep ntp
root@firewall:/var/run # ls -la /var/run/ntp*
ls: No match.
root@firewall:/var/run #


So where is the ntpd file now?

The feature was removed as stated in the release notes.
Quotenetwork time: remove PID file use as it can be unreliable

https://opnsense.org/opnsense-22-1-released/
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

After all the discussion of "pid file doesn't work for me" do we really want that pid file to be back to potentially show a wrong value?


Cheers,
Franco

February 05, 2022, 10:13:27 PM #3 Last Edit: February 05, 2022, 10:18:54 PM by h1d3m3
This broke monit for me too. Monitoring was looking for that file (using PID File) and since it was gone, it would constantly restart ntp thinking it was dead.

Can anyone recommend an alternate means for monit to monitor that ntp is running? (maybe through ntpq -p or something like ntpstat?)

Cheers

No please don't bring the PID file back - caused to much trouble ntpd not starting after reboot.

For monit you can change from PID to process match - just enter ntpd into the match field in the service definition.

Kind regards
Torsten

Thank you, that worked.

I didn't know "matched" was an option. When you use the PID field for a service, the match field option gets hidden. You have to delete the service setting first (starting clean) to show the field again. The result is:

check process ntpd  matching ntpd
   start program = "/usr/local/sbin/pluginctl -s ntpd start"
   stop program = "/usr/local/sbin/pluginctl -s ntpd stop"
   if failed host 127.0.0.1 port 123 type udp then alert