check_oracle_health does't work normally


#1

hi,I am a user of check_oracle_health from China, but I was sufferd a diffcult question about how use of check_oracle_health. ALL went fine until I define it a service in nagios. And at commanline I used it very well ,like :

[root@localhost libexec]# ./check_oracle_health --connect=orcl --user=nagios --password=nagios --mode=connection-time
OK - 0.15 seconds to connect as NAGIOS | connection_time=0.1491;1;5

but when I go to localhost/nagios,somethings are wrong like(the picture could’t be shown)
at the bar Status Information it says : CRITICAL: Connection can;t be established within 60 seconds

I don’t konw how to solve it ,please help me and I beg the solution is very detailed as possible as you can give to me .

I think I should give you more detailed informations about how I define the services in nagios:

at the command.cfg ,I add commands below(I just use two command to have a try)

'check_oracle_health ’ command definition

define command{
command_name oracle-connected-users
command_line $USER1$/check_oracle_health --connect=orcl --user=nagios --password=nagios --mode=connected-users
}

define command{
command_name oracle-connection-time
command_line $USER1$/check_oracle_health --connect=orcl --user=nagios --password=nagios --mode=connection-time
}

and under the filefolder /usr/local/nagios/etc/Server the host oracleServer.cfg was created,and the content of it are ::

define host

define host{

use linux-server ; Name of host template to use

; This host definition will inherit all variables that are defined

; in (or inherited by) the linux-server host template definition.

host_name oracleServer
alias oracle

address 127.0.0.1

}

define service{

use generic-service ; Name of service template to use

host_name oracleServer

service_description connected-users

check_command oracle-connected-users

}
define service{

use generic-service ; Name of service template to use

host_name oracleServer

service_description connection-time

check_command oracle-connection-time

}

the nagios and oracle are installed in a same machine ,then I enter localhost/nagios ,the result was returned as figure shows.

please help me and tell me how I could solver it ;
Thanks very much!

My english is poor, I hope you can understand what problem I have meet!

I beg you to help me!!thanks


#2

does the plugin work from command line if you su to user nagios?

su - nagios
and then run the command again.


#3

thanks,Luca, I did what you told me ,thanks god ,it works ,just like:

su - nagios
[nagios@localhost libexec]$ ./check_oracle_health --connect=orcl --user=nagios --password=nagios --mode=connection-time
OK - 0.36 seconds to connect as NAGIOS | connection_time=0.3570;1;5

It’s OK , so any other suggestions??
I have spent several days to solve it ,but I couldn’t.

wish others guys give me some help too, thanks ,

thank you luca ,again.


#4

Haven’t used oracle much… the only thing which comes to mind is that some oracle access softwares need acces to the oracle access files (tns?).
Possibly when you are logged in this fil eis available by the PATH variable which when you log off isn’t accessible to the nagios daemon. Maybe oracle logs have some info about why the connection fails.