Page 1 of 1

Configure nagios remote for DB2

Posted: Sat Mar 09, 2019 10:50 am
by welbp00
Hello,
i have a linux redhat server, configured for Nagios. Running fine, all kind of standard monitoring does work on a remote linux-server, containing DB2-servers.
I work with nrpe.
But i can't get the configuration right for the plugin to monitor the databases...

I use these plugin:

"monitor-db2-with-nagios-master".
Which contains al lot of checks, for instance "check_instance_up".

Below some of my configuration. The problem is the nrpe user has to switch to the instance user of the databases.
I think i have to use sudo(on the remote linux-server only?) to make this work.
And the command.. i can't get it right...

Something like this?

nrpe ALL=(root) NOPASSWD: /usr/bin/su - db2inst1
nrpe ALL=NOPASSWD: /usr/lib64/nagios/plugins/check_instance_up -i /home/db2inst1

Please help this newbee...

Regards.


# check_instance_up
define command {
command_name check_instance_up
command_line /usr/lib64/nagios/plugins/check_instance_up -H $HOSTADDRESS$ -l nagios -C "/home/nagios/scripts/check_instance_up -i '$ARG1$' -d '$ARG2$'"

on the DB2-server:
command[check_instance_up]=/home/nagios/scripts/check_instance_up -i /home/db2inst1 ??

Re: Configure nagios remote for DB2

Posted: Mon Mar 11, 2019 1:32 pm
by ssax
Set these:

DB2 Server:

/etc/sudoers:

Code: Select all

nrpe ALL = (db2inst1) NOPASSWD: /home/nagios/scripts/check_instance_up *
nrpe.cfg:

Code: Select all

command[check_instance_up]=sudo -u db2inst1 /home/nagios/scripts/check_instance_up -i '$ARG1$'
Now test from the Nagios server:

Code: Select all

/usr/lib64/nagios/plugins/check_nrpe -H DB2_IP -c check_instance_up -a '/home/db2inst1'

Re: Configure nagios remote for DB2

Posted: Tue Mar 12, 2019 5:33 am
by welbp00
Thnx ssax.

It works! Only, it is not shown in nagios console....

In the services.cfg i have this:

define service {
use generic-service
host_name on7p0021.ont.belastingdienst.nl
check_interval 30
service_description Instance status
check_command check_instance_up!/home/db2inst1
}
Is this correct? Any idea why it is not shown in the nagios console?

Thx allready!

Re: Configure nagios remote for DB2

Posted: Tue Mar 12, 2019 8:15 am
by welbp00
In Nagios i get the message "no matching services"

Re: Configure nagios remote for DB2

Posted: Tue Mar 12, 2019 8:37 am
by welbp00
Solved it! Problem with the late comment was that i did the adjustment for the config on one nagios server.... There are two nagios servers..
Load balancing didn't work fine..

So after putting the configuration on both servers, it worked!

Thnx for the support.

Re: Configure nagios remote for DB2

Posted: Tue Mar 12, 2019 8:43 am
by welbp00
Another question: the service gives a "Flap Detection" status.

From the nagios.log:

[1552398096] SERVICE FLAPPING ALERT: on7p0021.ont.belastingdienst.nl;Instance status;STOPPED; Service appears to have stopped flapping (3.9% change < 5.0% threshold)
[1552398096] SERVICE NOTIFICATION: nagiosadmin;on7p0021.ont.belastingdienst.nl;Instance status;CRITICAL;notify-service-by-email;PID: 8975. Problem retrieving port number.
[1552398156] SERVICE NOTIFICATION: nagiosadmin;on7p0021.ont.belastingdienst.nl;Instance status;CRITICAL;notify-service-by-email;PID: 8975. Problem retrieving port number.

Re: Configure nagios remote for DB2

Posted: Tue Mar 12, 2019 8:54 am
by scottwilkerson
Services will go into flapping if they change states between OK and non-OK rapidly

https://assets.nagios.com/downloads/nag ... pping.html

Re: Configure nagios remote for DB2

Posted: Wed Mar 13, 2019 10:38 am
by scottwilkerson
I split your most recent question off to a new topic here
https://support.nagios.com/forum/viewto ... =7&t=52977

Please create a new thread for each different topic

Locking this thread as resolved