check-cisco.pl : No such file or directory

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
braindope
Posts: 80
Joined: Fri Sep 26, 2014 12:13 am

check-cisco.pl : No such file or directory

Post by braindope »

Hi,

Can anyone help me with my error.

when i run
./check-cisco.pl

it say's

: No such file or directory
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

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

Post by Box293 »

Where did you download the plugin from?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
braindope
Posts: 80
Joined: Fri Sep 26, 2014 12:13 am

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

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

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

Post 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
Former Nagios employee
braindope
Posts: 80
Joined: Fri Sep 26, 2014 12:13 am

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

Post 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?
Attachments
checks.jpg
checks.jpg (8.25 KiB) Viewed 10727 times
braindope
Posts: 80
Joined: Fri Sep 26, 2014 12:13 am

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

Post 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?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

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

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
braindope
Posts: 80
Joined: Fri Sep 26, 2014 12:13 am

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

Post 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
Attachments
pnp4.jpg
braindope
Posts: 80
Joined: Fri Sep 26, 2014 12:13 am

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

Post 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
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

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

Post 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! :
Locked