Page 1 of 1

Error while running plugin

Posted: Fri Mar 18, 2016 6:15 am
by Justin2501
Hi Guys,

I'm currently having an issue with one of my plugins.

Nagios states the following:
(Return code of 127 is out of bounds - plugin may be missing)

On CLI the following error appears when i run "./check-cisco.pl -H xx.xx.xx.xx -C public -t fan"
: No such file or directory

Running "vi /usr/local/nagios/libexec/check-cisco.pl" opens the file.


[root@nagios libexec]# ls
centreon check_ifstatus check_rpc
check_apt check_imap check_sensors
check_breeze check_ircd check_simap
check_by_ssh check_jabber check_smtp
check_cisco.pl check_load check_snmp

Source script: https://exchange.nagios.org/directory/P ... st/details

Any ideas?

Re: Error while running plugin

Posted: Fri Mar 18, 2016 6:19 am
by rhassing
What are the permissions on the file?

Code: Select all

ls -l

Re: Error while running plugin

Posted: Fri Mar 18, 2016 6:30 am
by Justin2501
rhassing wrote:What are the permissions on the file?

Code: Select all

ls -l

Code: Select all

-rwxr-xr-x  1 nagios nagios  14327 Mar 18 11:43 check_cisco.pl

Re: Error while running plugin

Posted: Fri Mar 18, 2016 6:44 am
by rhassing
On CLI the following error appears when i run "./check-cisco.pl -H xx.xx.xx.xx -C public -t fan"
: No such file or directory
Maybe you should try a _ instead of -

Code: Select all

"./check_cisco.pl -H xx.xx.xx.xx -C public -t fan"

Re: Error while running plugin

Posted: Fri Mar 18, 2016 7:00 am
by Justin2501
rhassing wrote:
On CLI the following error appears when i run "./check-cisco.pl -H xx.xx.xx.xx -C public -t fan"
: No such file or directory
Maybe you should try a _ instead of -

Code: Select all

"./check_cisco.pl -H xx.xx.xx.xx -C public -t fan"
Tried both, because i added them with - and _
Original is -

Still not working

Re: Error while running plugin

Posted: Fri Mar 18, 2016 7:22 am
by rhassing
And on the command line?

Re: Error while running plugin

Posted: Fri Mar 18, 2016 7:31 am
by Justin2501
rhassing wrote:And on the command line?
Both check-cisco.pl and check_cisco.pl are giving me the error ": No such file or directory" after pressing enter.
Seems like it's referring to a folder, which does not exist.

Re: Error while running plugin

Posted: Fri Mar 18, 2016 8:30 am
by rhassing
Maybe you could try running the script without any arguments?

Code: Select all

/usr/local/nagios/libexec/check-cisco.pl
or

Code: Select all

/usr/local/nagios/libexec/check_cisco.pl
Or if that fails try:

Code: Select all

strace /usr/local/nagios/libexec/check-cisco.pl
or

Code: Select all

strace /usr/local/nagios/libexec/check_cisco.pl
And post that output

Re: Error while running plugin

Posted: Fri Mar 18, 2016 8:54 am
by Justin2501
rhassing wrote:Maybe you could try running the script without any arguments?

Code: Select all

/usr/local/nagios/libexec/check-cisco.pl
or

Code: Select all

/usr/local/nagios/libexec/check_cisco.pl
Or if that fails try:

Code: Select all

strace /usr/local/nagios/libexec/check-cisco.pl
or

Code: Select all

strace /usr/local/nagios/libexec/check_cisco.pl
And post that output
Run the command:

Code: Select all

[root@nagios libexec]# strace /usr/local/nagios/libexec/check-cisco.pl
execve("/usr/local/nagios/libexec/check-cisco.pl", ["/usr/local/nagios/libexec/check-"...], [/* 26 vars */]) = 0
brk(0)                                  = 0x12e7000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f265737b000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=31994, ...}) = 0
mmap(NULL, 31994, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2657373000
close(3)                                = 0
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \34\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2107816, ...}) = 0
mmap(NULL, 3932736, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2656d9a000
mprotect(0x7f2656f50000, 2097152, PROT_NONE) = 0
mmap(0x7f2657150000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b6000) = 0x7f2657150000
mmap(0x7f2657156000, 16960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2657156000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2657372000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2657370000
arch_prctl(ARCH_SET_FS, 0x7f2657370740) = 0
mprotect(0x7f2657150000, 16384, PROT_READ) = 0
mprotect(0x605000, 4096, PROT_READ)     = 0
mprotect(0x7f265737c000, 4096, PROT_READ) = 0
munmap(0x7f2657373000, 31994)           = 0
brk(0)                                  = 0x12e7000
brk(0x1308000)                          = 0x1308000
brk(0)                                  = 0x1308000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=106065056, ...}) = 0
mmap(NULL, 106065056, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2650873000
close(3)                                = 0
execve("/root/perl5/bin/perl\r", ["perl\r", "/usr/local/nagios/libexec/check-"...], [/* 26 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/local/sbin/perl\r", ["perl\r", "/usr/local/nagios/libexec/check-"...], [/* 26 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/local/bin/perl\r", ["perl\r", "/usr/local/nagios/libexec/check-"...], [/* 26 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/sbin/perl\r", ["perl\r", "/usr/local/nagios/libexec/check-"...], [/* 26 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/bin/perl\r", ["perl\r", "/usr/local/nagios/libexec/check-"...], [/* 26 vars */]) = -1 ENOENT (No such file or directory)
execve("/root/bin/perl\r", ["perl\r", "/usr/local/nagios/libexec/check-"...], [/* 26 vars */]) = -1 ENOENT (No such file or directory)
write(2, "/usr/bin/env: ", 14/usr/bin/env: )          = 14
)                   = 5l
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2502, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f265737a000
read(3, "# Locale name alias data base.\n#"..., 4096) = 2502
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0x7f265737a000, 4096)            = 0
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, ": No such file or directory", 27: No such file or directory) = 27
write(2, "\n", 1
)                       = 1
close(1)                                = 0
close(2)                                = 0
exit_group(127)                         = ?
+++ exited with 127 +++
Seems like it's missing some folders. Any idea how to fix this?

Re: Error while running plugin

Posted: Fri Mar 18, 2016 2:18 pm
by tgriep
Can you run the following on your Nagios server and post the output?

Code: Select all

ls -l /usr/local/nagios/libexec/
which env
perl -V