Page 1 of 1

check-cisco.pl : No such file or directory

Posted: Thu Jan 08, 2015 11:46 pm
by braindope
Hi,

Can anyone help me with my error.

when i run
./check-cisco.pl

it say's

: No such file or directory

Re: check-cisco.pl : No such file or directory

Posted: Fri Jan 09, 2015 1:34 am
by Box293
Where did you download the plugin from?

Re: check-cisco.pl : No such file or directory

Posted: Fri Jan 09, 2015 6:24 am
by braindope
@Box293

Hi,

i've just copy paste the script from the link below.

https://github.com/ranl/monitor-utils/b ... k-cisco.pl

My goal is get a nagios plugins for me to monitor cisco switches, not just the ports but also the cpu,memory,temperature etc..

:Can you be kind enough to tell me if there another plugin to meet my goal?. Thanks for in advance :D

Re: check-cisco.pl : No such file or directory

Posted: Fri Jan 09, 2015 10:45 am
by tmcdonald
"No such file or directory" usually means that the script you are trying to run does not exist.

Can you run the following commands and show us their output?

Code: Select all

./check-cisco.pl
ls -l

Re: check-cisco.pl : No such file or directory

Posted: Fri Jan 09, 2015 7:09 pm
by braindope
@tmcdonald

Hi,

The file is indeed present on the libexec directory :(

what i do is i copy paste the script using vim then i make the file into an executable.

is there something missing on my steps?

Re: check-cisco.pl : No such file or directory

Posted: Sat Jan 10, 2015 12:57 am
by braindope
Hi All,

I have successfully test the script , i just need to write perl in the beginning
perl ./check-cisco.pl

my next problem is how can i execute this script in my nagios monitoring? having the perl in the beginning of the script?

Re: check-cisco.pl : No such file or directory

Posted: Sun Jan 11, 2015 5:57 pm
by Box293
braindope wrote:I have successfully test the script , i just need to write perl in the beginning
perl ./check-cisco.pl
You should not need to run the script this way.

The source of your problem lies with the first line of the script.

Code: Select all

#!/usr/bin/env perl
This is what is causing the "No such file or directory" error.

On my installation, perl is located in /usr/bin/

Where is it in yours?

Code: Select all

su nagios
find /usr -name perl
Is this path in your environment path variable?

Code: Select all

su nagios
/usr/bin/env
On my system I have:

Code: Select all

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
You can see that /usr/bin/ is part of the path environment variable. If your perl location is not in the path variable then your script will not run.

Alternatively you could change line 1 of the script to point directly to perl without changing the path:

Code: Select all

#!/usr/bin/perl
braindope wrote:my next problem is how can i execute this script in my nagios monitoring?
You will need to create a command in your commands.cfg file, something like:

Code: Select all

define command {
       command_name                  		check-cisco
       command_line                  		$USER1$/check-cisco.pl -H $HOSTADDRESS$ -C $ARG1$ -t $ARG2$ $ARG3$
}
Then you will need to create a service:

Code: Select all

define service {
	host_name			The Host You Are Assigning It To
	service_description		Cisco Temperature Check
	use				local-service
	check_command			check-cisco!public!temp!-w 20 -c 30
	register			1
	}


Something like that.

Re: check-cisco.pl : No such file or directory

Posted: Tue Jan 13, 2015 3:26 am
by braindope
@ Box293

Hi,

You are absolutely correct i just change #!/usr/bin/env perl with #!/usr/bin/perl -w , the plugins is now running ,the extra line above the result can be ignore.

Useless use of array element in void context at ./check-cisco.pl line 480.
Cpu: CRIT - Cpu Load 5% 6% 6% | cpu_5s=5 percent;0;0 cpu_1m=6 percent cpu_5m=6 percent

Lastly i am trying to graph the data using pnp4 nagios ,i just add srv-pnp on the service ,just like before but it yielded the error below. Any idea on this? :D

Re: check-cisco.pl : No such file or directory

Posted: Tue Jan 13, 2015 4:59 am
by braindope
Hi All,

Update:

I have now a graph :) , i've just deleted the MB in the line below which is the supposed unit
$perf = "memory_total=$mem_total\ MB memory_used=$mem_used\ MB";


and also in the CPU ,i have deleted the percent word
$perf = "cpu_5s=$load_5s\ percent;$warn;$crit cpu_1m=$load_1m\ percent cpu_5m=$load_5m\ percent";


PS: Thank you for all the feedback, if you have other method that is more neat or correct than what i have done ,please do teach me :P

Re: check-cisco.pl : No such file or directory

Posted: Tue Jan 13, 2015 5:23 pm
by slansing
Awesome, thanks for letting us know. In the future, please add your additional questions from other topics in new threads. That assures that both the team members with those expertise take a look first, and that we keep threads devoid of extra clutter, thanks! :