What we do here is we have Oracle client installed on the Nagios master. We setup tnsnames.ora as we would on any Oracle host on this Nagios master.
In services.cfg we enter things like:
To check our DB SID named "PROD":
Code:
define service{
use generic-service
host_name ERPDB
service_description PROD: SID
contact_groups ux-admins, some-dbas, noc-op
check_period erpdb_prod
check_command check_oracle!--sid!PROD
}
To check our DB SID named "REPORT":
Code:
define service{
use generic-service
host_name RBACK
service_description REPORT: SID
contact_groups ux-admins, some-dbas, noc-op
check_period rback_report
check_command check_oracle!--sid!REPORT
}
The check_oracle is defined in the checkcommands.cfg as:
Code:
# 'check_oracle' command definition
define command{
command_name check_oracle
command_line $USER1$/check_oracle.pl $ARG1$ $ARG2$
}
The check_oracle.pl in the libexec directory takes the arguments passed in and sets values based on what the services.cfg had specified. This means SID is a variable throughout. The specific command above by the way simply does a tnsping of the SID.
We do similar for NRPE access to the boxes where the databases live to check whether the listener and the pmon process are running. These are also use input from nrpe.cfg for variables on systems where we have multiple databases running.