Repository
Munin (contrib)
Last change
2019-05-26
Graph Categories
Family
auto
Capabilities
Keywords
Language
Shell
License
NTP
Authors

ntp_drift

Name

ntp_drift - Munin plugin to monitor the NTP drift value.

Applicable Systems

Any ntpd host.

Configuration

The following configuration parameters are used by this plugin:

[ntp_drift]
env.driftfile - Path to driftfile.

Default Configuration

[ntp_drift]
env.driftfile "/var/lib/ntp/ntp.drift"

Usage

Link this plugin to /etc/munin/plugins/ and restart the munin-node.

Author

HORINOUCHI Masato <thermes+github@confei.to> 2019-07-16

License

Same as munin.

Magic Markers

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

#! /bin/sh
# -*- sh -*-

: <<=cut

=head1 NAME

ntp_drift - Munin plugin to monitor the NTP drift value.

=head1 APPLICABLE SYSTEMS

Any ntpd host.

=head1 CONFIGURATION

The following configuration parameters are used by this plugin:

 [ntp_drift]
 env.driftfile - Path to driftfile.

=head2 DEFAULT CONFIGURATION

 [ntp_drift]
 env.driftfile "/var/lib/ntp/ntp.drift"

=head1 USAGE

Link this plugin to /etc/munin/plugins/ and restart the munin-node.

=head1 AUTHOR

HORINOUCHI Masato <thermes+github@confei.to> 2019-07-16

=head1 LICENSE

Same as munin.

=head1 MAGIC MARKERS

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

=cut

driftfile=${driftfile:-'/var/lib/ntp/ntp.drift'}

do_autoconf () {
    if [ -r "$driftfile" ]; then
        echo "yes"
    else
        echo "no (could not read driftfile '$driftfile'.)"
    fi
}


do_config () {
    cat <<'EOM'
graph_title NTP drift
graph_args --base 1000
graph_vlabel Parts Per Million
graph_category time
drift.label Frequency Offset
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).
EOM
}


do_ () {
    if [ -r "$driftfile" ]; then
        echo "drift.value $(cat "$driftfile")"
    else
        echo "drift.value U"
    fi
}


case $1 in
    autoconf|config|'')
        do_"$1"
        ;;
    *)
        echo "Don't know how to do that" >&2
        exit 1
        ;;
esac