[Nagiosplug-help] check_iftraffic.pl - problem (Use of uninitialized value in scalar chomp)

bobi at netshel.net bobi at netshel.net
Tue Oct 24 23:27:40 CEST 2006


The problem is that Nagios only takes the first line of output from any
plugin and throws the rest away.  so you have to get rid of your Perl
error.

I think the problem on line 185 is that you're not chomping your $row
variable - you're actually chomping the "default" $_ variable.

So, I'd change line 185 to read:

chomp($row);

Hopefully, that fixes it.

Bob

> Hi!
>
>
>
> I need help to make this work.
>
> I will try to be clear as possible.
>
>
>
> I am running the Nagios in a FreeBSD 6.1
>
> Web Interface is fully operational and monitoring several hosts.
>
> In the CLI, (/usr/local/libexec/nagios/check_iftraffic.pl) when
>  I input the command to get the values from the router interface, I get
the following error: "Use of uninitialized value in scalar chomp at
./check_iftraffic.pl line 185, <FILE> line 1."
>
>
>
> Here's the input/output commands:
>
>
>
> Input:
>
> ./check_iftraffic -H 172.16.17.10 -C public -i Serial0/0/0 -b 2048
>  -u k -w 85 -c 98 -M 2048
>
>
>
> Output:
>
> Use of uninitialized value in scalar chomp at ./check_iftraffic
>  line 185, <FILE> line 1.
>
> Total RX Bytes: 181.49 MB, Total TX Bytes: 182.37 MB<br>Average
>  Traffic: 1.34 kB/s (0.5%) in, 1.39 kB/s (0.5%) out| inUsage=0.5,85,98
outUsage=0.5,85,98 inAbsolut=185491 outAbsolut=186377
>
>
>
> Well, as you can see, the plug-in returns a valid response, but
>  in the Nagios Web View, the only thing that appears to me is the first
line (Use of uninitialized value in scalar chomp at ./check_iftraf
> fic line 185, <FILE> line 1.).
>
> I don't know how to get rid of this error.
>
>
>
> I already tried to check the line 185 of the check_iftraffic.pl,
>  but i can't find any errors. Here's the lines:
>
>
>
> ##################################################################
>
>     170 my $row;
>
>     171 my $last_check_time = time - 1;
>
>     172 my $last_in_bytes   = $in_bytes;
>
>     173 my $last_out_bytes  = $out_bytes;
>
>     174
>
>     175 if (
>
>     176         open( FILE,
>
>     177                 "<" . $TRAFFIC_FILE . "_if" . $iface_number
>  . "_" . $host_address
>
>     178         )
>
>     179   )
>
>     180 {
>
>     181         while ( $row = <FILE> ) {
>
>     182
>
>     183                 #cosmetic change 20050416 by mw
>
>     184                 #Couldn't sustain;-)
>
>     185                 chomp();
>
>     186                 ( $last_check_time, $last_in_bytes, $last_out_byt
> es ) =
>
>     187                   split( ":", $row );
>
>     188         }
>
>     189         close(FILE);
>
>     190 }
>
> ##################################################################
>
>
>
> I would apreciate any sugestions.
>
> Thanks in advance!
>
>
>
> -------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services,
security? Get stuff done quickly with pre-integrated technology to make
your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
> Nagiosplug-help mailing list
> Nagiosplug-help at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
> ::: Please include plugins version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
>








More information about the Help mailing list