Configure nagios remote for DB2

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.
Locked
welbp00
Posts: 50
Joined: Fri Mar 08, 2019 5:48 am

Configure nagios remote for DB2

Post 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 ??
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Configure nagios remote for DB2

Post 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'
welbp00
Posts: 50
Joined: Fri Mar 08, 2019 5:48 am

Re: Configure nagios remote for DB2

Post 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!
welbp00
Posts: 50
Joined: Fri Mar 08, 2019 5:48 am

Re: Configure nagios remote for DB2

Post by welbp00 »

In Nagios i get the message "no matching services"
welbp00
Posts: 50
Joined: Fri Mar 08, 2019 5:48 am

Re: Configure nagios remote for DB2

Post 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.
welbp00
Posts: 50
Joined: Fri Mar 08, 2019 5:48 am

Re: Configure nagios remote for DB2

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Configure nagios remote for DB2

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Configure nagios remote for DB2

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked