Page 2 of 3

Re: Nagios and Oracle db

Posted: Mon Nov 11, 2013 4:36 am
by JanePisk

Code: Select all

[nagios@kallisto libexec]$ /usr/local/nagios/libexec/check_oracle_instant --help
: Not a directory/libexec/check_oracle_instant: line 1: /usr/bin/perl/
: command not foundibexec/check_oracle_instant: line 2: 
/usr/local/nagios/libexec/check_oracle_instant: line 3: =: command not found
: command not foundibexec/check_oracle_instant: line 3: 
/usr/local/nagios/libexec/check_oracle_instant: line 4: =: command not found
: command not foundibexec/check_oracle_instant: line 4: 
/usr/local/nagios/libexec/check_oracle_instant: line 5: =: command not found
: command not foundibexec/check_oracle_instant: line 5: 
/usr/local/nagios/libexec/check_oracle_instant: line 6: =: command not found
: command not foundibexec/check_oracle_instant: line 6: 
/usr/local/nagios/libexec/check_oracle_instant: line 7: =: command not found
: command not foundibexec/check_oracle_instant: line 7: 
: command not foundibexec/check_oracle_instant: line 8: 
/usr/local/nagios/libexec/check_oracle_instant: line 9: syntax error near unexpected token `('
'usr/local/nagios/libexec/check_oracle_instant: line 9: `sub trim($);
:cry:

Re: Nagios and Oracle db

Posted: Mon Nov 11, 2013 11:46 am
by abrist
I missed this the first time I looked at the script . . . it is missing the shabang!
Edit the first line of the script from:

Code: Select all

/usr/bin/perl/
To:

Code: Select all

#!/usr/bin/perl/
Save out and try to run the plugin from the cli again:

Code: Select all

/usr/local/nagios/libexec/check_oracle_instant -H host.addr.of.oracle.server -p 1521

Re: Nagios and Oracle db

Posted: Tue Nov 12, 2013 4:17 am
by JanePisk
now the error is :

Code: Select all

bash: /usr/local/nagios/libexec/check_oracle_instant: /usr/bin/perl/^M: bad interpreter: Not a directory
and on the nagios interface the error is

Return code of 126 is out of bounds - plugin may be missing)

GRRRRRRRRR

Re: Nagios and Oracle db

Posted: Tue Nov 12, 2013 4:22 am
by JanePisk
i have also tried to add -w to the end of the line :

Code: Select all

#!/usr/bin/perl -w
(I saw this solution on other forums)

but nothing changed ....

Re: Nagios and Oracle db

Posted: Tue Nov 12, 2013 10:13 am
by tmcdonald
JanePisk wrote:now the error is :

Code: Select all

bash: /usr/local/nagios/libexec/check_oracle_instant: /usr/bin/perl/^M: bad interpreter: Not a directory
and on the nagios interface the error is

Return code of 126 is out of bounds - plugin may be missing)

GRRRRRRRRR
I am assuming you copy+pasted this plugin or otherwise transferred it from a Windows machine? The ^M character is a end-of-line character that causes some problems in Linux. Try the following, bearing in mind that for "^M" you need to hit CTRL+v then CTRL+m, and it should appear as a single character (you can't move the cursor between the ^ and the M):

Code: Select all

cp check_oracle_instant check_oracle_instant.old
sed 's/^M//g' check_oracle_instant.old > check_oracle_instant
Make sure to back up the plugin first, and if that doesn't work here's an article that might help:

http://its.ucsc.edu/unix-timeshare/tuto ... trl-m.html

Re: Nagios and Oracle db

Posted: Tue Nov 12, 2013 10:40 am
by JanePisk
sorry...the error is without the ^M character .. but :

Code: Select all

bash: /usr/local/nagios/libexec/check_oracle_instant: /usr/bin/perl/: bad interpreter: Not a directory

Re: Nagios and Oracle db

Posted: Tue Nov 12, 2013 1:27 pm
by abrist
A few things:

Code: Select all

which perl
yum install dos2unix -y
dos2unix /usr/local/nagios/libexec/check_oracle_instant

Re: Nagios and Oracle db

Posted: Wed Nov 13, 2013 5:18 am
by JanePisk
good morning abrist ...
ok...the return for the code 'which perl' is :

Code: Select all

[root@kallisto nagios]# which perl
/usr/bin/perl

Code: Select all

[root@kallisto nagios]# yum install dos2unix -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.prometeus.net
 * extras: mirrors.prometeus.net
 * rpmforge: mirror.de.leaseweb.net
 * updates: mirrors.prometeus.net
Setting up Install Process
Package dos2unix-3.1-27.2.el5.x86_64 already installed and latest version
Nothing to do

Code: Select all

[root@kallisto nagios]# dos2unix /usr/local/nagios/libexec/check_oracle_instant 
dos2unix: converting file /usr/local/nagios/libexec/check_oracle_instant to UNIX format ...
(I had already done this command but nothing to do)...
do you have some other plugin for the oracle db monitor with nagios? (i hate this!!!! :evil: )

Re: Nagios and Oracle db

Posted: Wed Nov 13, 2013 10:19 am
by slansing
You may try following our guide for XI, it is a bit different:

http://assets.nagios.com/downloads/nagi ... lation.pdf

Of course, not everything will transfer over to core-land.

Re: Nagios and Oracle db

Posted: Wed Nov 13, 2013 11:09 am
by JanePisk
hi!!!
but what is this?
I have to monitor a remote db... sorry but I don't understand :?