Page 2 of 2
Re: check-cisco.pl plugin
Posted: Tue Jan 07, 2014 4:54 pm
by sreinhardt
I see what the issue is, the print statement uses $msg not $err_msg. Just change this(lines 351-354):
Code: Select all
if($sum == 0) {
$err_msg = "Fans: unknown, no fans were detected.";
$stat = 3;
}
to this:
Code: Select all
if($sum == 0) {
$err_msg = "Fans: unknown, no fans were detected.";
$msg = "$err_msg";
$stat = 3;
}
or:
Code: Select all
if($sum == 0) {
$msg = "Fans: unknown, no fans were detected.";
$stat = 3;
}
Re: check-cisco.pl plugin
Posted: Tue Jan 07, 2014 5:01 pm
by vvz
still the same, if switch is not powered.
| total=0 err=0
Re: check-cisco.pl plugin
Posted: Tue Jan 07, 2014 5:09 pm
by sreinhardt
Well, its clearly catching correctly on the if statement we added, which of the options above did you use this time, could you post the script one more time as you have it? I see no reason that this shouldn't be working for you from the last script to now. Also if you could post exactly how your are running the command to test it. In the statement "total = 0" that 0 is $sum, just so you know why I feel its definitely catching the if statement.
Re: check-cisco.pl plugin
Posted: Tue Jan 07, 2014 5:17 pm
by vvz
I've added print statement in your code ( I also playing here with script),
script is attached
switch is not connected and this line is copied directly from terminal
Code: Select all
./check-cisco.pl -H 192.168.1.205 -C public -t fan
got output
when switch is connected everything is ok
Re: check-cisco.pl plugin
Posted: Tue Jan 07, 2014 5:33 pm
by sreinhardt
This works perfectly on my system, including both prints. So, what OS are you presently running, and what perl packages do you have?
Re: check-cisco.pl plugin
Posted: Tue Jan 07, 2014 5:44 pm
by vvz
linux-mint 15, perl-base 5.14.2-21 perl-modules 5.14.2-21
OK thnx, if it works on your PC earlier or later it will work on my
thank you for your help
Re: check-cisco.pl plugin
Posted: Tue Jan 07, 2014 6:42 pm
by vvz
thank you, slansing
you were extremly helpful
now it works
it was because i'm absolutely newbie in perl
Re: check-cisco.pl plugin
Posted: Tue Jan 07, 2014 6:43 pm
by vvz
thank you sreinhardt for your help
you saved a lot of time for me
Re: check-cisco.pl plugin
Posted: Wed Jan 08, 2014 8:53 am
by sreinhardt
You're welcome, glad it's working for you now! Going to lock this up then.