I hacked a monitor for checking time servers.  It's ugly, but it works.  
Enjoy.

#!/usr/bin/perl
#
#####################################################################
##                                                                 ##
##  time.monitor                                                   ##
##                                                                 ##
## derived from
##                                                                 ##
##  bootp.monitor                                   Version 1.0.0  ##
##                                                  2000-01-10     ##
##  Copyright (C) 2000                                             ##
##  Peter Holzleitner ([EMAIL PROTECTED])                 ##
##                                                                 ##
#####################################################################
#
# A MON plug-in monitor to test time servers.
#
# Arguments:
#
#  [-d|--debug] serverlist
#
# Requirements:
#
#   This is actually just a mon wrapper for the ntpdate program 
#
# History:
#
#   1.0.0  initial release

use Getopt::Long;

# configure location if necessary
$ntpdate = '/usr/sbin/ntpdate';

GetOptions(\%opt, 'debug', 'hardware');

$redir = '>/dev/null 2>&1';
$redir = '' if $opt{'debug'};

$hwopt = '';
$hwopt = '-h' if $opt{'hardware'};
  
@failures = ();

foreach $host (@ARGV) {
    $res = system("$ntpdate -q $host $redir") / 256;
    print "\nRESULT FOR $host: $res\n\n" if $opt{"debug"};
    push (@failures, $host) if ($res != 0);
    }

exit 0 if (@failures == 0);

print "@failures\n";

exit 1;
-- 

Casey Bralla
Chief Nerd in Residence
The NerdWorld Organisation

Attachment: time.monitor
Description: Perl program

_______________________________________________
mon mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/mon

Reply via email to