Help Check Jitter


Hy, I have written a script in perl , for checking the jitter betwen nagios and a server.
The problem is that , nagios wouldn`t work with it, it says “no output”. But i have no erors at compilation, it works fine.
Please help.

#! /usr/bin/perl -w use strict; use Getopt::Long; use vars qw($opt_w $opt_c $opt_s $opt_H $opt_p $opt_v $type $param ); use lib "/usr/local/nagios/libexec"; use Time::HiRes; use Net::Ping; use utils qw(%ERRORS $TIMEOUT);

Getopt::Long::Configure(‘bundling’, ‘no_ignore_case’);
(“V|version” => &version,
“h|help” => &help,
“w|warning=s” => $opt_w,
“c|critical=s” => $opt_c,
“H|host=s” => $opt_H,
“s|size=s” => $opt_s,
“p|packets=s” => $opt_p,
“v|verbrose” => $opt_v,
“t|type” => $type

my $host = 'localhost';
my $ret;
my $duration;
my $ip;
my $p;
my @multiping;
my $count=10;#no of pings
my ($sec,$minut,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);

printf “%4d-%02d-%02d %02d:%02d:%02d\n”,$year+1900,$mon+1,$mday,$hour,$minu t,$sec;

my $i;my $j=0;
my $max=0;
my $min=10000;
my $timeout=4;
my $size = 64;
my @results;
my $sum=0;

if (defined($opt_H)){$host=$opt_H;};
if (defined($opt_p)){$count=$opt_p;};
if (defined($opt_s)){$size=$opt_s;};

normal ping;

$p = Net::Ping->new("icmp",$timeout,$size);    $p ->hires();
($ret, $duration, $ip) = $p->ping($host, 5.5);

for ($i=0;$i<$count;$i++){#exec 2 ping .. cred ca paralele
    ($ret, $duration, $ip) = $p->ping($host);
    if ($ret==1) {
        if ($duration > $ma:evil:{ $max=$duration;}     ;
        if ($duration < $min){ $min=$duration;};
        printf(" ping %2d to $host   (packet return time: %.2f ms)\n",$i+1,                                               1000 * $duration) if (defined($opt_v));
    }else {
            printf("packet %d lost \n",$i+1);
        }#end if
  }#end for


#printf "\n\n%4d-%02d-%02d %02d:%02d:%02d  ",$year+1900,$mon+1,$mday,$hour,$                                              minut,$sec;
if ($j>($count/2)) {printf("\n Host is alive. ");}
printf ("rtt min/avg/max :: %.2f/%.2f/%.2f ms => jitter =%.2f ms loss=%.2f%s                                               \n\n"
        ,1000 * $min,1000*$sum/$j,1000*$max /2,1000*($max-$min)/2,100-$j/$co                                              unt*100,'%');


sub help(){
printf(“help… \n”);
exit $ERRORS{‘OK’};
sub version(){
printf(“jitter ping v 0.1b \n”);
exit $ERRORS{‘OK’};


check the permissions on the file. It may be an env issue or permissions. There is one check that I had so much trouble with that I had to sudo the command in the checkcommands.cfg