#!/bin/sh : << =cut =head1 NAME ntp_offset - Plugin to monitor NTP time offset =head1 CONFIGURATION The following environment variables are used by this plugin: nodelay - add "delay_graph no" to RRD graph configuration =head2 EXAMPLE CONFIGURATION [ntp_*] env.nodelay 1 - Set to 1 to remove delay =head1 AUTHOR Unknown author =head1 LICENSE GPLv2 =head1 NOTES Loosely based on ntp_ plugin, but reworked to shell. =head1 MAGIC MARKERS #%# family=auto #%# capabilities=autoconf =cut nodelay=${nodelay:-} do_autoconf () { ntpq -c help >/dev/null 2>&1 || { echo 'no (no ntpq program)'; exit 0; } case "$(ntpq -n -p 2>/dev/null | wc -l)" in 0) echo 'no (unable to list peers)' exit 0 ;; 1|2) echo 'no (no peers?)' exit 0 ;; *) echo yes exit 0 ;; esac } do_config () { syspeer="$(ntpq -n -p | grep '^[*o]')" # shellcheck disable=SC2086 set - $syspeer peer=$1 # Times in ms, therefore cdefs to divide to obtain seconds # delay=$8 # offset=$9 # jitter=$10 cat <&2 exit 1 ;; esac echo 'What am I doing here?' >&2 exit 1