/usr/share/munin/plugins/ntp_offset is in munin-node 1.4.6-3ubuntu3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | #!/bin/sh
# -*- 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
Unknown license
=head1 NOTES
Loosely based on ntp_ plugin, but reworked to shell.
=head1 MAGIC MARKERS
 #%# family=auto
 #%# capabilities=autoconf
=cut
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]')"
    set - $syspeer
    peer=$1
    # Times in ms, therefore cdefs to divide to obtain seconds
    # delay=$8
    # offset=$9
    # jitter=$10
    cat <<EOF
graph_title NTP timing statistics for system peer
graph_args --base 1000 --vertical-label seconds --lower-limit 0
graph_category time
graph_info Currently our peer is $peer.  Please refer to ntp docs and ntpc docs for further explanations of these numbers.
delay.label Delay
delay.draw LINE2
delay.cdef delay,1000,/
offset.label Offset
offset.draw LINE2
offset.cdef offset,1000,/
jitter.label Jitter
jitter.draw LINE2
jitter.cdef jitter,1000,/
EOF
    case $nodelay in
	1) echo "delay.graph no";;
    esac
}
do_ () {
    # Fetch operation
    syspeer="$(ntpq -n -p | grep '^[*o]')"
    set - $syspeer
    # peer=$1
    # Times in ms, therefore cdefs to divide to obtain seconds
    shift # Avoid having to use $10
    delay=${7:-U}
    offset=${8:-U}
    jitter=${9:-U}
    cat <<EOF
delay.value $delay
offset.value $offset
jitter.value $jitter
EOF
}
case $1 in
    autoconf|config|'')
       do_$1
       exit $?
       ;;
    *)
       echo "Don't know how to do that" >&2
       exit 1
       ;;
esac
echo 'What am I doing here?' >&2
exit 1
# vim:syntax=sh
 |