Can't locate Switch.pm

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
jriker1
Posts: 115
Joined: Tue Dec 15, 2015 8:40 pm

Can't locate Switch.pm

Post 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
User avatar
rhassing
Posts: 416
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: Can't locate Switch.pm

Post by rhassing »

Did you try to run it as the user "nagios"?
Rob Hassing
Image
jriker1
Posts: 115
Joined: Tue Dec 15, 2015 8:40 pm

Re: Can't locate Switch.pm

Post 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?
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Can't locate Switch.pm

Post 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 :)
Former Nagios Employee.
me.
Locked