The standard way of checking a service in Zabbix checks that the service is running, but I wanted to know not only that the NTPD service was running but that the time was synchronized. ntpstat is a great utility that does both, checks that the ntpd service is running and then tells you whether the server is synchronized. ntpstat will report the synchronization state of the NTP daemon running on the local machine. ntpstat returns 0 if clock is synchronized. ntpstat returns 1 if clock is not synchronized. ntpstat returns 2 if clock state is unknown, for example if ntpd can’t be contacted.
I created a Zabbix item to use ntpstat. Here are the 2 ways I have used this new check:
The first way to use ntpstat with Zabbix is to simply create an item using the system.run function.
Name - ntpstat status Type - Zabbix agent (active) Key - system.run[ntpstat &> /dev/null ; echo $?] Type of Information - Text
Ensure EnableRemoteCommands=1 is set in your zabbix_agentd.conf file for this to work.
The second way to create the item is to use custom user parameters. This requires a file modification on the monitored instance, so if you have a lot of instances to monitor or do not have a good way to automate this file modification, you may want to stick with option 1
I like creating new userparameter files for custom parameters.
/etc/zabbix/zabbix_agend.d/userparameter_custom_linux.conf UserParameter=custom.net.ntpstat,ntpstat &> /dev/null ; echo $?
Then create an item similar to above but with a change to the key
Name - ntpstat status Type - Zabbix agent (active) Key - custom.net.ntpstat Type of Information - Numeric (unsigned) Data Type - Decimal
Once your custom userparameter file is placed you’ll need to restart the zabbix agent. The last step with either item creation option is to create a trigger that alerts when the returned value is not 0.
I like this check much better than my original one that just alerted when the ntpd service was down. Now I get alerted before time synchronization issues become an issue for the applications.
This was tested on both CentOS 6.7 and CentOS 7.1, but this should work on your Linux distro of choice as long as you have ntpstat installed.
Hope this helps
Remove the networking interface rules file, it will be regenerated
Update your interface configuration file
Remove the MACADDR and the UUID entries
Save and exit the file
Restart the networking service