Unable to connect to postgres database for monitoring

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

Unable to connect to postgres database for monitoring

Post by RIDS_I2MP »

Hi Team,

While monitoring Postgres database from Nagios XI server We are not able to connect to the database, refer the attached snapshot message:
error message.PNG
The port is open but when we are trying from the command prompt it shows that port is closed , it shows the same output for 5666 but we are monitoring the filesystem well.
error message.PNG
This is affecting the production harshly.

Kindly suggest on it priority.
You do not have the required permissions to view the files attached to this post.
Thanks & Regards,
I2MP Team.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Unable to connect to postgres database for monitoring

Post by rkennedy »

Can you please post the service definition for us to look at, and also a copy of the plugin?

Your screenshot indicates check_http & check_nrpe, but this appears to be a postgres plugin you're using.
Former Nagios Employee
RIDS_I2MP
Posts: 751
Joined: Thu Mar 13, 2014 9:25 am

Re: Unable to connect to postgres database for monitoring

Post by RIDS_I2MP »

Hi Team,

Please refer the attached snapshot we are firing the mentioned command in snapshot.

We are using check_postgres.pl script.

Let us know from where we can get the service definition? which you have requested.
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: Unable to connect to postgres database for monitoring

Post by lmiltchev »

Is 10.144.223.155 the IP address of your Nagios XI server? Is it added to the "pg_hba.conf" on the remote machine (10.148.54.187)?

Run the following commands on the 10.148.54.187 server and show the output:

Code: Select all

grep 10.144.223.155 /var/lib/pgsql/data/pg_hba.conf
grep "listen_addresses =" /var/lib/pgsql/data/postgresql.conf
Note: Modify the paths to the config files if needed.

Can you log in posgres manually (as "nagios" user) on the remote box and access the "g_db_recohemea" db?
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: Unable to connect to postgres database for monitoring

Post by RIDS_I2MP »

Hi Team,

yes 10.144.223.155 is the Nagios server IP.

Nagios server IP is added to pg_hba.conf on the remote host(10.148.54.187), kindly refer the output of the command below:

-bash-3.2$ grep 10.144.223.155 /psqldata/PostgresPlus/9.2AS/data/pg_hba.conf
host all all 10.144.223.155/32 md5
-bash-3.2$ grep "listen_addresses =" /psqldata/PostgresPlus/9.2AS/data/postgresql.conf
listen_addresses = '*' # what IP address(es) to listen on;

We are able to login to the postgres database manually on the remote host and access the database.

Kindly suggest.
Thanks & Regards,
I2MP Team.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Unable to connect to postgres database for monitoring

Post by ssax »

Code: Select all

host all all 10.144.223.155/32 md5
This means that you need to provide an MD5 encrypted password when connecting:

Code: Select all

echo -n 'password' | md5sum
Otherwise if you wanted to use a cleartext password, you would change it to:

Code: Select all

host all all 10.144.223.155/32 password
I think you would need to restart the postgresql DB as well.
RIDS_I2MP
Posts: 751
Joined: Thu Mar 13, 2014 9:25 am

Re: Unable to connect to postgres database for monitoring

Post by RIDS_I2MP »

Hi Team,

We have md5 encryption in all postgres databases and its working fine.

Kindly suggest.
Thanks & Regards,
I2MP Team.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Unable to connect to postgres database for monitoring

Post by ssax »

Did you md5 the password and use the md5'd password in your check command?

Code: Select all

echo -n 'password' | md5sum
RIDS_I2MP
Posts: 751
Joined: Thu Mar 13, 2014 9:25 am

Re: Unable to connect to postgres database for monitoring

Post by RIDS_I2MP »

Hi Team,

There is no issue with the password as we are able to check the backend connections and it is giving us required output. We are facing issue only for connection status.

Kindly provide us any feasible solution.
Thanks & Regards,
I2MP Team.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Unable to connect to postgres database for monitoring

Post by tgriep »

Do you see any errors in the log files on the Postgress server when the check is run?
Can you upgrade to the latest version of the check_postgres.pl and see if it still fails for you?
You can get the latest plugin here.
https://bucardo.org/wiki/Check_postgres
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked