Page 1 of 1

Can't locate Switch.pm

Posted: Fri Dec 25, 2015 11:48 pm
by jriker1
I have a plugin that is a perl script and runs fine on the command line. if I do:

Code: Select all

./check_sfan.pl temp 192.168.0.2 public 2 "x>65" "x>67"
It returns

Code: Select all

OK - 32°C |check_sfan;temp;2;32;32>65;32>67
When I put in the command.cfg file:

Code: Select all

# 'check_snmp' command definition
define command{
        command_name    check_cpu_temp
        command_line    $USER1$/check_sfan.pl $ARG1$ $HOSTADDRESS$ $ARG2$ $ARG3$ $ARG4$ $ARG5$
        }
and in my windows.cfg:

Code: Select all

define service{
        use                     generic-service
        host_name               mediacenter
        service_description     Check CPU Temp
        check_command           check_cpu_temp!temp!public!2!"x>63"!"x>67"
        }
Return I get is

Code: Select all

(No output on stdout) stderr: Can't locate Switch.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/nagios/libexec/check_sfan.pl line 37. 
Is there a reason it's working differently in nagios than out?

Thanks.

JR

Re: Can't locate Switch.pm

Posted: Sat Dec 26, 2015 4:26 am
by rhassing
Did you try to run it as the user "nagios"?

Re: Can't locate Switch.pm

Posted: Sat Dec 26, 2015 9:34 am
by jriker1
rhassing wrote:Did you try to run it as the user "nagios"?
Thanks for the reply. I think you hit it right on the head but can't really easily fix it. Switch.pm is depreciated and no longer installed so when you try to install it it only shows in a local library. I would have to install as the nagios user if it would work but figure it's better to redo the switch with an if/else routine.

JR

EDIT: Fixed it. Is it appropriate to put notes on the original poster's submission with what was changed (think it's abandoned) or create a per module referencing it's an update to the existing one with the following fixes?

Re: Can't locate Switch.pm

Posted: Mon Dec 28, 2015 10:48 am
by hsmith
jriker1 wrote:Is it appropriate to put notes on the original poster's submission with what was changed (think it's abandoned)
That could save some people a lot of time in the future :)
jriker1 wrote:or create a per module referencing it's an update to the existing one with the following fixes?
That could also be very helpful. We appreciate anything the community contributes. The community is what makes Nagios so great :)