Forum Discussion

cbenton210_2064's avatar
cbenton210_2064
Icon for Nimbostratus rankNimbostratus
Aug 11, 2016

NTP Health Monitor on V12

Does anyone know a way to setup a Valid NTP health monitor on V12. I have a virtual server setup with 3 Local NTP servers in a pool. Would like to know that there are actually serving time as appose to just the udp on port 123. Is there anyway to achieve this?

 

5 Replies

  • You'd have to create an external monitor of some kind. Something like

        !/bin/bash
        ip=${1}
        ntpdate -q ${ip}
        if [ $? -eq 0 ]
        then
                echo "UP"
        fi
    

    Whatever you echo should be the RECV= variable for the monitor. See https://devcentral.f5.com/articles/ltm-external-monitors-the-basics for info on setting up an external monitor. Script above is very basic, not very good error handling, making sure it isn't already running and so on. Could use some work. The basic is ntpdate will return non-0 if it wasn't able to query the ntp server.

    • StephanManthey's avatar
      StephanManthey
      Icon for MVP rankMVP

      I like your ntpdate based approach (+1). It looks upgrade safe to me compared to the Perl based monitor which requires a library import. (It used to get lost with a software update.) By default the ntpdate runs 4 polls. A single poll should be enough. The number of polls can be controlled via the -p paramter followed by a numerical value. A stratum of 1-15 should be okay. Thats why my current solution looks as follows:

      !/bin/sh
      ntpdate -q -p 1 ${1} 2> /dev/null | grep -Ewo 'stratum\s+([1-9]|1[0-5])' > /dev/null
      return_codes="${PIPESTATUS[*]}"
      
      if [ "${return_codes}" == "0 0" ]
      then
          echo "up"
      fi
      
  • We are unable to use the ntpdate command in an external monitor because the ntpd service is running. F5 support recommends using the ntpq command to check status, but I have not been able to figure out how to do that. Has anyone had any luck?

     

    • mimlo_61970's avatar
      mimlo_61970
      Icon for Cumulonimbus rankCumulonimbus

      ntpdate -q will run even if ntpd is running. The -q is for query only, and will not try to modify the clock.