1#!/bin/sh
2# -*- sh -*-
3
4: <<EOF
5
6=head1 NAME
7
8ntp_kernel_pll_tol - Plugin to monitor the kernel's PLL frequency tolerance for
9the NTP status
10
11=head1 CONFIGURATION
12
13No configuration
14
15=head1 AUTHORS
16
17Original authors unknown
18ntp_kernel_pll_freq script patched by azet@azet.org for frequency tolerance support
19
20=head1 LICENSE
21
22Unknown license
23
24=head1 BUGS
25
26None known
27
28=head1 MAGIC MARKERS
29
30 #%# family=auto
31 #%# capabilities=autoconf
32
33=cut
34
35EOF
36
37if [ "$1" = "autoconf" ]; then
38    { ntpq -c kerninfo; ntpdc -c kerninfo; } 2>/dev/null |
39    awk 'BEGIN { ev=1; }
40         /^frequency tolerance:/ { ev=0; }
41         END { if (ev == 0) { print "yes";} else { print "no"; } exit ev; }'
42    exit 0
43fi
44
45if [ "$1" = "config" ]; then
46    echo 'graph_title NTP kernel PLL frequency tolerance (ppm)'
47    echo 'graph_args --alt-autoscale'
48    echo 'graph_vlabel PLL frequency (ppm)'
49    echo 'graph_category time'
50    echo 'graph_info The frequency tolerance of the kernel phase-locked loop used by NTP'
51    echo 'ntp_pll_tol.label pll-tolerance'
52    echo 'ntp_pll_tol.info Phase-locked loop frequency tolerance in parts per million'
53    exit 0
54fi
55
56echo -n 'ntp_pll_tol.value '
57{ ntpq -c kerninfo; ntpdc -c kerninfo; } 2>/dev/null | awk '/^frequency tolerance:/ { print $3 }'
58