Jump to content
Welcome to our new Citrix community!

How can I monitor for NTP drift?


Recommended Posts

Hi everyone

Can someone please help me to configure monitoring for NTP drift?

We use SolarWinds for monitoring and it has a monitor for Unix via Perl script. It does not work for Netscaler though...

I saved the file as ntpdrift.pl file on Netscaler and it works if I run the following command:

 

>shell /tmp/ntpdrift.pl ntpdate 1.2.3.4

Message: NTP server 1.2.3.4, time offset 0.024 sec.
Statistic: 0.024
Done

 

Cannot get the command policy right for the user to allow shell /tmp/ntpdrift.pl ntpdate 1.2.3.4

Keep getting "ERROR: Not authorized to execute this command [shell perl /tmp/ntpdrift.pl ntpdate 1.2.3.4]"

This is what I have in the command policy: (^shell perl /tmp/ntpdrift.pl ntpdate 1.2.3.4)$

 

 

$ntpdate_cmd=$ARGV[0];
$ntp_server=$ARGV[1];
$time=20;
if ($ntpdate_cmd eq '') {
 print "Message: Can't find \"ntpdate_cmd\" argument.\n";
 exit 1;
 }
if ($ntp_server eq '') {
 print "Message: Can't find \"ntp_server\" argument.\n";
 exit 1;
 }
if (! -e $ntpdate_cmd) {
 print "Message: Can't find ntpdate command. Check if ntp package is installed or path to that ntpdate command.\n";
 exit 1;
 }
$cmd=$ntpdate_cmd." -q ".$ntp_server;
@out=split("\n",`$cmd`);
$exit=`echo $?`;
if ($exit != 0) {
  print "Message: Error occured. Possibly wrong server argument. Try to run command locally: ntpdate -q your_server\n";
  exit 1;
  }
if ($out[0] =~ ", offset ") {
  @str=split(" ",$out[0]);
  $off=$str[5];
  $serv=$str[1];
  chop($off);
  printf ("Message: NTP server %s time offset %.3f sec.\n",$serv,$off);
  printf ("Statistic: %.3f\n",$off);
  exit 0;
  }
  

 

 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...