Repository
Munin (master)
Last change
2017-01-22
Graph Categories
Family
auto
Capabilities
Language
Shell
License
NTP

ntp_kernel_err

Example graph: week

Name

ntp_kernel_err - Plugin to monitor the PLL estimated error for the kernel NTP status

Configuration

No configuration

Authors

Unknown author

License

GPLv2

Magic Markers

#%# family=auto
#%# capabilities=autoconf
#!/bin/sh

: <<EOF

=head1 NAME

ntp_kernel_err - Plugin to monitor the PLL estimated error for the
kernel NTP status

=head1 CONFIGURATION

No configuration

=head1 AUTHORS

Unknown author

=head1 LICENSE

GPLv2

=head1 MAGIC MARKERS

 #%# family=auto
 #%# capabilities=autoconf

=cut

EOF

export PATH=/usr/local/sbin:$PATH

if [ "$1" = "autoconf" ]; then
    { ntpq -c kerninfo; ntpdc -c kerninfo; } 2>/dev/null |
    awk 'BEGIN { ev=1; }
         /^estimated error:/ { ev=0; }
         END { if (ev == 0) { print "yes";} else { print "no (command ntpq or ntpdc not found)"; } exit 0; }'
    exit 0
fi

if [ "$1" = "config" ]; then
    echo 'graph_title NTP kernel PLL estimated error (secs)'
    echo 'graph_vlabel est. err (secs)'
    echo 'graph_category time'
    echo 'graph_info The kernels estimated error for the phase-locked loop used by NTP.'
    echo 'ntp_err.label est-error'
    echo 'ntp_err.info Estimated error for the kernel PLL'
    exit 0
fi

printf 'ntp_err.value '

if [ "$(ntpq -c version | grep --extended-regexp --only-matching '[[:digit:]]\.[[:digit:]]\.[[:digit:]]' | tr -d '.')" -ge 427 ]
then
    ntpq -c kerninfo | awk '/^estimated error:/ { print $3 / 1000 }'
else
    ntpdc -c kerninfo | awk '/^estimated error:/ { print $3 }'
fi