Free Software

Back to resources.
Back to web site.

 

ntpstat.pl - MRTG Script to Display Clock Drift

5/13/2003

Send a notice to this e-mail address when software is updated:

Overview

This script outputs data useful for generating an MRTG graph of NTP clock drift on an ongoing basis. It is useful to get a visual indication of hardware clock accuracy as well as whether your clock is being sync'd successfully.

As MRTG doesn't do negatives, positive drift is one color and negative another.

It's a very poorly written script, but seems to do a good job.

Downloading

The perl script can be found here. Refer to the next section for configuration information.

ntpstat.pl  (~1k)

Implementation

Place the ntpstat.pl file in the directory where you normally run MRTG scripts from.

Add an mrtg.cfg entry like this:

# NTP Clock Offset
Target[ntpoff]: `/usr/local/mrtg-2/bin/ntpstat.pl`
XSize[ntpoff]: 360
YSize[ntpoff]: 75
Options[ntpoff]: gauge,growright,nopercent
Title[ntpoff]: NTP Clock Offset
MaxBytes[ntpoff]: 20480000
PageTop[ntpoff]: <H1>NTP Clock Offset</H1>
LegendO[ntpoff]: Negative Drift
LegendI[ntpoff]: Positive Drift
Legend2[ntpoff]: Negative Drift
Legend1[ntpoff]: Positive Drift
YLegend[ntpoff]: drift msecs
ShortLegend[ntpoff]: &nbsp;msecs
Colours[ntpoff]: DKBLUE#61A0DF,DKBLUE#0000DD,DARKGREEN#006600,VIOLET#FF00FF

Sample Graphs


`Monthly' Graph (2 Hour Average)
month
Max Positive Drift  36.0  msecs Average Positive Drift  2.0  msecs Current Positive Drift  26.0  msecs
Max Negative Drift  9.0  msecs Average Negative Drift  2.0  msecs Current Negative Drift  0.0  msecs

`Yearly' Graph (1 Day Average)
year
Max Positive Drift  16.0  msecs Average Positive Drift  0.0  msecs Current Positive Drift  5.0  msecs
Max Negative Drift  12.0  msecs Average Negative Drift  1.0  msecs Current Negative Drift  2.0  msecs

Feedback / Questions

There's not much to this script, but if you find it useful or have suggestions, please let us know.

E-Mail: contact@csma.biz.

 

 

Copyright (c) 2003, Corey S. McFadden & Associates. All rights reserved.
 For more information, please contact contact@csma.biz. Served via ewrgga-hst01 .