#!/bin/sh # -*- sh -*- # # Plugin to monitor NTP time offset. # Loosely based on ntp_ plugin, but reworked to shell. # # Parameters understood: # # config (required) # autoconf (optional - used by munin-node-configure) # # [ntp_*] # env.nodelay 1 - Set to 1 to remove delay # # Magic markers - optional - used by installation scripts and # munin-node-configure: # #%# family=auto #%# capabilities=autoconf do_autoconf () { ntpq -c help >/dev/null 2>&1 || { echo 'no (no ntpq program)'; exit 1; } case "$(ntpq -n -p 2>/dev/null | wc -l)" in 0) echo 'no (unable to list peers)' exit 1 ;; 1|2) echo 'no (no peers?)' exit 1 ;; *) echo yes exit 0 ;; esac } do_config () { syspeer="$(ntpq -n -p | grep '^[*o]')" 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 # vim:syntax=sh