Monitoring service through NAgios

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
RIDS_I2MP
Posts: 751
Joined: Thu Mar 13, 2014 9:25 am

Monitoring service through NAgios

Post by RIDS_I2MP »

Hi Team,

We have a Linux server on which a service "postgresql-9.3" is running. We want to monitor this service from Nagios XI.

We are getting the error "*** postgresql-9.3: Nok ***" while trying to monitor it, we have cross checked the service name and its correct.

Please help us to configure the same. I am attaching the service management screen shot here for your reference.

Our Nagios XI version is Nagios XI 5.6.2.
You do not have the required permissions to view the files attached to this post.
Thanks & Regards,
I2MP Team.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Monitoring service through NAgios

Post by lmiltchev »

Can you run the following commands on the client (remote machine), and show the output?

Code: Select all

/usr/local/nagios/libexec/check_services -p postgresql-9.3
ps -ef | grep postgresql
Be sure to check out our Knowledgebase for helpful articles and solutions!
RIDS_I2MP
Posts: 751
Joined: Thu Mar 13, 2014 9:25 am

Re: Monitoring service through NAgios

Post by RIDS_I2MP »

Hello,

Below is the output:

[nagios@eu1xdbl013 ~]$ /usr/local/nagios/libexec/check_services -p postgresql-9.3
*** postgresql-9.3: Nok ***
[nagios@eu1xdbl013 ~]$
[nagios@eu1xdbl013 ~]$ ps -ef | grep postgresql
nagios 24176 24134 0 05:06 pts/0 00:00:00 grep postgresql
[nagios@eu1xdbl013 ~]$


[nagios@eu1xdbl013 ~]$ service postgresql-9.3 status
postgresql-9.3 (pid 4855) is running...
[nagios@eu1xdbl013 ~]$
[nagios@eu1xdbl013 ~]$
[nagios@eu1xdbl013 ~]$ ps -ef | grep postgresql-9.3
nagios 24294 24134 0 05:08 pts/0 00:00:00 grep postgresql-9.3
[nagios@eu1xdbl013 ~]$
Thanks & Regards,
I2MP Team.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Monitoring service through NAgios

Post by lmiltchev »

Hmm, I suspect your service and the process have different names. Let's try a few more things:

1. Grep the output of "ps -ef" for "post" (on the remote box):

Code: Select all

ps -ef | grep 'post' | grep -v grep
Note: If there is no output again, show the entire output without grepping:

Code: Select all

ps -ef
2. If you have the "check_init_service" plugin in the libexec directory (not sure how you installed NRPE on the client), run the following command, and show the output:

Code: Select all

/usr/local/nagios/libexec/check_init_service postgresql-9.3
Note: This needs to be run as root or with "sudo".

What kind of OS/architecture you are running postgresql on?
Be sure to check out our Knowledgebase for helpful articles and solutions!
RIDS_I2MP
Posts: 751
Joined: Thu Mar 13, 2014 9:25 am

Re: Monitoring service through NAgios

Post by RIDS_I2MP »

Hello,

Below is the output:

[nagios@eu1xdbl013 ~]$ ps -ef | grep 'post' | grep -v grep
root 2007 1 0 Apr21 ? 00:00:20 /usr/libexec/postfix/master
postfix 2016 2007 0 Apr21 ? 00:00:06 qmgr -l -t fifo -u
postgres 4855 1 0 Apr21 ? 00:05:33 /usr/pgsql-9.3/bin/postmaster -p 5432 -D /var/lib/pgsql/9.3/data
postgres 4857 4855 0 Apr21 ? 00:00:00 postgres: logger process
postgres 4859 4855 0 Apr21 ? 00:05:23 postgres: checkpointer process
postgres 4860 4855 0 Apr21 ? 00:04:12 postgres: writer process
postgres 4861 4855 0 Apr21 ? 00:03:48 postgres: wal writer process
postgres 4862 4855 0 Apr21 ? 00:03:45 postgres: autovacuum launcher process
postgres 4863 4855 0 Apr21 ? 00:15:44 postgres: stats collector process
postgres 5822 4855 0 Apr21 ? 00:00:05 postgres: postgres esh_db_04_Apr_17 10.148.32.6(49881) idle
postgres 5823 4855 0 Apr21 ? 00:00:05 postgres: postgres esh_db_04_Apr_17 10.148.32.6(49882) idle
postgres 5824 4855 0 Apr21 ? 00:00:06 postgres: postgres esh_db_04_Apr_17 10.148.32.6(49883) idle
postgres 5825 4855 0 Apr21 ? 00:00:05 postgres: postgres esh_db_04_Apr_17 10.148.32.6(49884) idle
postgres 5826 4855 0 Apr21 ? 00:00:05 postgres: postgres esh_db_04_Apr_17 10.148.32.6(49885) idle
postgres 5827 4855 0 Apr21 ? 00:00:06 postgres: postgres esh_db_04_Apr_17 10.148.32.6(49886) idle
postgres 5828 4855 0 Apr21 ? 00:00:10 postgres: postgres esh_db_04_Apr_17 10.148.32.6(49887) idle
postgres 5829 4855 0 Apr21 ? 00:00:08 postgres: postgres esh_db_04_Apr_17 10.148.32.6(49888) idle
postgres 5830 4855 0 Apr21 ? 04:22:23 postgres: postgres esh_db_04_Apr_17 10.148.32.6(49889) idle
postgres 5831 4855 0 Apr21 ? 01:31:46 postgres: postgres esh_db_04_Apr_17 10.148.32.6(49890) idle
postgres 9864 4855 0 02:26 ? 00:00:02 postgres: postgres esh_schedule_new 10.148.160.6(56276) idle
postgres 13737 4855 0 04:34 ? 00:00:02 postgres: postgres esh_schedule_new 10.148.160.6(59112) idle
postgres 14576 4855 0 05:03 ? 00:00:02 postgres: postgres esh_schedule_new 10.148.32.6(47587) idle
postgres 20416 4855 0 08:30 ? 00:00:00 postgres: postgres esh_schedule_new 10.148.32.6(50366) idle
postfix 20735 2007 0 08:41 ? 00:00:00 pickup -l -t fifo -u
postgres 21489 4855 0 09:05 ? 00:00:00 postgres: postgres esh_schedule_new 10.148.32.6(50870) idle
postgres 22703 4855 1 09:44 ? 00:00:06 postgres: postgres esh_db_04_Apr_17 10.148.160.6(34974) idle
postgres 22859 4855 0 09:49 ? 00:00:00 postgres: postgres esh_db_04_Apr_17 10.148.160.6(35045) idle
postgres 22902 4855 1 09:51 ? 00:00:01 postgres: postgres esh_db_04_Apr_17 10.148.32.6(51543) idle
postgres 22906 4855 0 09:52 ? 00:00:00 postgres: postgres esh_db_04_Apr_17 10.148.160.6(35077) idle
postgres 22912 4855 2 09:52 ? 00:00:01 postgres: postgres esh_db_04_Apr_17 10.148.32.6(51552) idle
postgres 22913 4855 0 09:52 ? 00:00:00 postgres: postgres esh_db_04_Apr_17 10.148.32.6(51553) idle
postgres 30676 4855 0 Jun16 ? 00:00:05 postgres: postgres esh_schedule_new 10.148.160.6(45382) idle
[nagios@eu1xdbl013 ~]$

=====================================================================================================


[nagios@eu1xdbl013 ~]$ cd /usr/local/nagios/libexec/
[nagios@eu1xdbl013 libexec]$ ls -lrt check_init*
-rwxr-xr-x 1 nagios nagios 748 Mar 14 2017 check_init_service
[nagios@eu1xdbl013 libexec]$
[nagios@eu1xdbl013 libexec]$ /usr/local/nagios/libexec/check_init_service postgresql-9.3
postgresql-9.3 (pid 4855) is running...
[nagios@eu1xdbl013 libexec]$


=============================================================
Thanks & Regards,
I2MP Team.
RIDS_I2MP
Posts: 751
Joined: Thu Mar 13, 2014 9:25 am

Re: Monitoring service through NAgios

Post by RIDS_I2MP »

Hello,

After running the commands provided by you, I found that below two lines have same pid 4855:

postgres 4855 1 0 Apr21 ? 00:05:33 /usr/pgsql-9.3/bin/postmaster -p 5432 -D /var/lib/pgsql/9.3/data

[nagios@eu1xdbl013 libexec]$ /usr/local/nagios/libexec/check_init_service postgresql-9.3
postgresql-9.3 (pid 4855) is running...

So, I replaced the name of service by pgsql-9.3 and the output is GREEN as below:

pgsql-9.3: 1

I am not sure if my assumption here is correct or not.
Thanks & Regards,
I2MP Team.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Monitoring service through NAgios

Post by lmiltchev »

This sounds right. Let us know if we can close this topic and mark it as resolved. Thank you!
Be sure to check out our Knowledgebase for helpful articles and solutions!
RIDS_I2MP
Posts: 751
Joined: Thu Mar 13, 2014 9:25 am

Re: Monitoring service through NAgios

Post by RIDS_I2MP »

Yes, you can close it now.
Thank you!!
Thanks & Regards,
I2MP Team.
Locked