Nagios and Oracle db

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.
JanePisk
Posts: 21
Joined: Wed Nov 06, 2013 9:46 am

Re: Nagios and Oracle db

Post 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:
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios and Oracle db

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
JanePisk
Posts: 21
Joined: Wed Nov 06, 2013 9:46 am

Re: Nagios and Oracle db

Post 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
JanePisk
Posts: 21
Joined: Wed Nov 06, 2013 9:46 am

Re: Nagios and Oracle db

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

Re: Nagios and Oracle db

Post 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
Former Nagios employee
JanePisk
Posts: 21
Joined: Wed Nov 06, 2013 9:46 am

Re: Nagios and Oracle db

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios and Oracle db

Post by abrist »

A few things:

Code: Select all

which perl
yum install dos2unix -y
dos2unix /usr/local/nagios/libexec/check_oracle_instant
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
JanePisk
Posts: 21
Joined: Wed Nov 06, 2013 9:46 am

Re: Nagios and Oracle db

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

Re: Nagios and Oracle db

Post 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.
JanePisk
Posts: 21
Joined: Wed Nov 06, 2013 9:46 am

Re: Nagios and Oracle db

Post by JanePisk »

hi!!!
but what is this?
I have to monitor a remote db... sorry but I don't understand :?
Locked