root / plugins / ntp / ntp_drift @ ddced538
Historique | Voir | Annoter | Télécharger (1,4 ko)
| 1 |
#! /bin/sh |
|---|---|
| 2 |
# -*- sh -*- |
| 3 |
|
| 4 |
: <<=cut |
| 5 |
|
| 6 |
=head1 NAME |
| 7 |
|
| 8 |
ntp_drift - Munin plugin to monitor the NTP drift value. |
| 9 |
|
| 10 |
=head1 APPLICABLE SYSTEMS |
| 11 |
|
| 12 |
Any ntpd host. |
| 13 |
|
| 14 |
=head1 CONFIGURATION |
| 15 |
|
| 16 |
The following configuration parameters are used by this plugin: |
| 17 |
|
| 18 |
[ntp_drift] |
| 19 |
env.driftfile - Path to driftfile. |
| 20 |
|
| 21 |
=head2 DEFAULT CONFIGURATION |
| 22 |
|
| 23 |
[ntp_drift] |
| 24 |
env.driftfile "/var/lib/ntp/ntp.drift" |
| 25 |
|
| 26 |
=head1 USAGE |
| 27 |
|
| 28 |
Link this plugin to /etc/munin/plugins/ and restart the munin-node. |
| 29 |
|
| 30 |
=head1 AUTHOR |
| 31 |
|
| 32 |
HORINOUCHI Masato <thermes+github@confei.to> 2019-07-16 |
| 33 |
|
| 34 |
=head1 LICENSE |
| 35 |
|
| 36 |
Same as munin. |
| 37 |
|
| 38 |
=head1 MAGIC MARKERS |
| 39 |
|
| 40 |
#%# family=auto |
| 41 |
#%# capabilities=autoconf |
| 42 |
|
| 43 |
=cut |
| 44 |
|
| 45 |
driftfile=${driftfile:-'/var/lib/ntp/ntp.drift'}
|
| 46 |
|
| 47 |
do_autoconf () {
|
| 48 |
if [ -r "$driftfile" ]; then |
| 49 |
echo "yes" |
| 50 |
else |
| 51 |
echo "no (could not read driftfile '$driftfile'.)" |
| 52 |
fi |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
do_config () {
|
| 57 |
cat <<'EOM' |
| 58 |
graph_title NTP drift |
| 59 |
graph_args --base 1000 |
| 60 |
graph_vlabel Parts Per Million |
| 61 |
graph_category time |
| 62 |
drift.label Frequency Offset |
| 63 |
graph_info The frequency of the local clock oscillator. A single floating point number, which records the frequency offset measured in parts-per-million (PPM). |
| 64 |
EOM |
| 65 |
} |
| 66 |
|
| 67 |
|
| 68 |
do_ () {
|
| 69 |
if [ -r "$driftfile" ]; then |
| 70 |
echo "drift.value $(cat "$driftfile")" |
| 71 |
else |
| 72 |
echo "drift.value U" |
| 73 |
fi |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
case $1 in |
| 78 |
autoconf|config|'') |
| 79 |
do_"$1" |
| 80 |
;; |
| 81 |
*) |
| 82 |
echo "Don't know how to do that" >&2 |
| 83 |
exit 1 |
| 84 |
;; |
| 85 |
esac |
