Page 1 of 1

Oracle service check status

Posted: Wed Jun 16, 2021 8:46 am
by Anto
Hi

I have a lot of Oracle databases monitored with NagiosXI (check_oracle_health) and I found that when one "Service check" fails to connect to database for any reason, the plugin send a CRITICAL ALARM with the error returned, similar this:

[nagios@prnagxi01 ~]$ /usr/local/nagios/libexec/check_oracle_health --connect 'ALIAS_NAME' --username 'c##nagios' --password 'XYZ' --mode tablespace-usage
CRITICAL - cannot connect to ALIAS_NAME. ORA-12154: TNS:could not resolve the connect identifier specified (DBD ERROR: OCIServerAttach)


Is it possible to change this behaviour sending in this scenario an "UNKNOWN" alarm ? this seem more accurate, because when the plugin doesn't connect to Database, the specific metric value is unknown.

The CRITICAL message during the connection, should remain only for method "Connection-time" or "TNSPING".

Is this possible ?

Best Regards
Antonello

Re: Oracle service check status

Posted: Wed Jun 16, 2021 3:24 pm
by vtrac
Hi Antonello,
How are you doing?
Since "check_oracle_health" came from the Nagios Exchange page, it is best that you contact the developer (owner) for this.
https://exchange.nagios.org/directory/P ... th/details

However, I looked inside the script and if you only want to check for just the "ORA-12154" error, you can add the following three lines under the "sub dbconnect" function starting at line "5673".
Example:

Code: Select all

    } elsif ($self->{handle}->{errstr} =~ /ORA-12154/) {
      $self->add_nagios($ERRORS{UNKNOWN}, $self->{handle}->{errstr});
      $retval = undef;

Best Regards,
Vinh

Re: Oracle service check status

Posted: Mon Jun 21, 2021 1:09 pm
by Anto
Hi Vinh

I'm fine hope you too.

I followed your suggestion and done some changes in the "sub dbconnect" for /ORA-12545/ , /ORA-12541/ and for other specific errors.

The changes are working :D .

However I would suggest to propose this as an idea to plugin developer, but in more general scenario, where in case of connection problems, all the DB specific checks should be in UNKNOWN status (or configurable alternative status) except for "connection-time" and "tnsping".

In this way we can avoid unwanted notifications.

Thanks

Best Regards

Antonello

Re: Oracle service check status

Posted: Mon Jun 21, 2021 2:06 pm
by vtrac
Hi Antonello,
I am very glad that you has resolved the issue by making some changes to the script ... :-)

Please feel free to update your suggestion to the developer web page, as I think will help others with unnecessary alarms or warnings.

May I go ahead and close this thread?


Best Regards,
Vinh

Re: Oracle service check status

Posted: Fri Jul 02, 2021 11:40 am
by Anto
Hi Vinh

Sorry for late in response.
Close the thread please

Best Regards
Antonello

Re: Oracle service check status

Posted: Fri Jul 02, 2021 11:54 am
by vtrac
Great!! ... locking thread ... :-)