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

Glory Major glorymajor at yahoo.com.br
Tue Oct 24 21:28:05 CEST 2006


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!






More information about the Help mailing list