Ad Widget

Collapse

Time drifting

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • swardell
    Junior Member
    • Dec 2009
    • 13

    #1

    Time drifting

    I cant quite see how to create a trigger that fires when the time on a monitored server (host local time) has drifted by a value x (minutes) from either the Zabbix server time or ideally an NTP Servers time, anyone have any suggestions?

    All my servers do a time synch to NTP servers but for some reason I am seeing one drifting and I want to try to catch it
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    Have a look at trigger function fuzzytime(), might be handy.
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • untergeek
      Senior Member
      Zabbix Certified Specialist
      • Jun 2009
      • 512

      #3
      UserParameter=ntp.offset,/home/zabbix/bin/ntp_test.sh

      /home/zabbix/bin/ntp_test.sh
      Code:
      #!/bin/bash
      
      # $Rev:: 691           $:  Revision of last commit
      # $Author:: REDACTED     $:  Author of last commit
      # $Date:: 2009-12-28 1#$:  Date of last commit
      
      TEST=$(/usr/sbin/ntpq -pn 2>&1 | grep -c "Connection refused")
      if [ "$TEST" -gt "0" ]; then
         RETURN=4.99;
      else
         RETURN=$(/usr/sbin/ntpq -pn | /usr/bin/awk 'BEGIN { offset=1000 } $1 ~ /\*/ { offset=$9 } END { print offset }')
      fi
      
      echo $RETURN
      This works for us. We can then define the trigger around the value returned.

      Comment

      • LenR
        Senior Member
        • Sep 2009
        • 1005

        #4
        {hostname.whatever:system.localtime.fuzzytime(60)} =0

        Would trigger if the client time is 60 seconds different from the zabbix server.

        We have our own NTP servers, our zabbix server runs an ntp client to keep synced. I have a trigger for 10 seconds of drift between the zabbix server and the ntp servers.

        BTW, we had to run NTP clients on vm's and adjust kernel parms for various OS levels to stop time drift.

        Comment

        Working...