I am running
two NTP servers for the project
pool.ntp.org, one located in
France, the second here in
California. I am monitoring my servers with
Munin. Munin comes with plenty of plugins to monitor the temperature of your computer, your disks, your CPU, etc, etc. It also comes with plugins to monitor your NTP daemon, but there is no plugin to monitor how much your NTP server is used. Since I am running open servers I was interested in finding out how much my servers where used.
Here is the perl code for the plugin I wrote for Munin to gather the packet inforamtion. To install this plugin just copy the following code into a file named
npt_iostats into the directory
/usr/local/etc/munin/plugins (Your Linux distribution may have a different path) and restart your munin daemon. The graphs your are going to obtain will look like that.

http://us.time.bsdhost.net/stats_png/ntp_iostats-day.png
You can find more graphs
here and here.
#!/usr/local/bin/perl -w
#
# Munin plugin to monitor NTP IOs
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by lrrd-config)
#
use strict;
my $NTPDC = "/usr/sbin/ntpdc";
if ($ARGV[0] and $ARGV[0] eq "autoconf") {
`$NTPDC -c help >/dev/null 2>/dev/null`;
if ($? eq "0") {
if (`$NTPDC -c "hostnames no" -c peers | wc -l` > 0) {
print "yes\n";
exit 0;
} else {
print "no (could not read peer list)\n";
exit 0;
}
} else {
print "no ($NTPDC not found)\n";
exit 1;
}
}
if ($ARGV[0] and $ARGV[0] eq "config") {
print "graph_title NTP iostats\n";
print "graph_args --base 1000 --lower-limit 0\n";
print "graph_vlabel packets / \${graph_period}\n";
print "send.label Send\n";
print "send.type DERIVE\n";
print "send.min 0\n";
print "received.label Received\n";
print "received.type DERIVE\n";
print "received.min 0\n";
exit(0);
}
my %h;
foreach (`$NTPDC -c iostats`) {
chop;
my ($k, $v) = split(/\s*:\s*/);
$h{$k} = $v;
}
print 'send.value ', int($h{"packets sent"}), "\n";
print 'received.value ', int($h{"received packets"}), "\n";
exit 0;
#!/usr/local/bin/perl -w
#
# Munin plugin to monitor NTP IOs
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by lrrd-config)
#
use strict;
my $NTPDC = "/usr/sbin/ntpdc";
if ($ARGV[0] and $ARGV[0] eq "autoconf") {
`$NTPDC -c help >/dev/null 2>/dev/null`;
if ($? eq "0") {
if (`$NTPDC -c "hostnames no" -c peers | wc -l` > 0) {
print "yes\n";
exit 0;
} else {
print "no (could not read peer list)\n";
exit 0;
}
} else {
print "no ($NTPDC not found)\n";
exit 1;
}
}
if ($ARGV[0] and $ARGV[0] eq "config") {
print "graph_title NTP iostats\n";
print "graph_args --base 1000 --lower-limit 0\n";
print "graph_vlabel packets / \${graph_period}\n";
print "send.label Send\n";
print "send.type DERIVE\n";
print "send.min 0\n";
print "received.label Received\n";
print "received.type DERIVE\n";
print "received.min 0\n";
exit(0);
}
my %h;
foreach (`$NTPDC -c iostats`) {
chop;
my ($k, $v) = split(/\s*:\s*/);
$h{$k} = $v;
}
print 'send.value ', int($h{"packets sent"}), "\n";
print 'received.value ', int($h{"received packets"}), "\n";
exit 0;
If you want to know more about NTP
What is NTP?
NTP FAQ
NTP Project homepage
Various NTP documentation