Good morning everyone,
I’m writing this post after about two weeks of tests without really finding a solution, so I’m turning to you, who are more experienced than me.
Activity: I have two Cisco routers that function as NTP servers (therefore, Zabbix Agent cannot be installed).
I would like to monitor these two NTP servers using Zabbix. To achieve this, I have created two items:
First item: NTP.time
This first item simply prints the time from the NTP server. The time format, of course, is not compatible with Zabbix, so I have set up a preprocessing step using JavaScript to split all parts of the time and convert them into a usable format.
The JavaScript preprocessing splits the SNMP-provided time into year, month, day, hour, minute, and second, converting it into a Unix timestamp.
So far, so good.
Second item: NTP.convert (dependent on NTP.time)
Trigger: NTP Sync diff with Zabbix Server
Leaving aside the fact that the trigger name is incorrect (since fuzzytime does not function to calculate the time difference between the NTP server and the Zabbix server), my question is precisely about this.
I need to detect if there is a time difference greater than 15 seconds between my NTP server and the Zabbix server’s time, and if so, I need a trigger to notify me (and I am not really sure this trigger is working).
I have tried creating a new item within the template with a key of localtime, like the predefined Zabbix Server template, and then created a trigger using the expression:
However, I realized that this expression is incorrect and not supported by Zabbix.
Current status:
Finally, if anyone has experience setting up reliable NTP monitoring in Zabbix using SNMP, I would appreciate any advice on best practices, especially when it comes to handling time conversions and comparisons.
I appreciate any help you can provide. Thank you!
I’m writing this post after about two weeks of tests without really finding a solution, so I’m turning to you, who are more experienced than me.
Activity: I have two Cisco routers that function as NTP servers (therefore, Zabbix Agent cannot be installed).
I would like to monitor these two NTP servers using Zabbix. To achieve this, I have created two items:
First item: NTP.time
Code:
snmp[".1.3.6.1.2.1.197.1.2.9.0"]
The JavaScript preprocessing splits the SNMP-provided time into year, month, day, hour, minute, and second, converting it into a Unix timestamp.
So far, so good.
Second item: NTP.convert (dependent on NTP.time)
Code:
ntp.convert
Code:
fuzzytime(/NTP_SNMP/ntp.convert, 15) = 0
I need to detect if there is a time difference greater than 15 seconds between my NTP server and the Zabbix server’s time, and if so, I need a trigger to notify me (and I am not really sure this trigger is working).
I have tried creating a new item within the template with a key of localtime, like the predefined Zabbix Server template, and then created a trigger using the expression:
Code:
last(NTP) - last(Zabbix Server)
Current status:
- Both ntp.offset and system.localtime are successfully collecting data, and I can see their values correctly in Latest Data. The problem lies in how to configure Zabbix to correctly compare and trigger an alert based on these two values.
- I understand that Zabbix doesn’t support direct mathematical expressions like last(NTP) - last(Zabbix Server) in triggers. I’ve also tried using calculated items but encountered issues configuring them properly. Therefore, I am looking for guidance on the best approach to achieve this.
- Is there a correct way to compare ntp.offset with the server’s system.localtime directly?
- Should I be using a calculated item or another approach to get this difference working properly?
- Any guidance or examples on how to set up a trigger for monitoring this time difference effectively?
Finally, if anyone has experience setting up reliable NTP monitoring in Zabbix using SNMP, I would appreciate any advice on best practices, especially when it comes to handling time conversions and comparisons.
I appreciate any help you can provide. Thank you!
Comment