postgres db error

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
kgopiramesh

Re: postgres db error

Post by kgopiramesh »

168.125.36.9 nagios-p localhost
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: postgres db error

Post by slansing »

I'm not sure why that is the only entry you have there, you must have wiped everything else out, add the following to the list for good measure, on a separate line, and remove localhost from the line you showed?:

Code: Select all

127.0.0.1   localhost localhost.localdomain
Also... did you mean to define that Nagios line with "nagios-p"
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: postgres db error

Post by abrist »

Can you try changing /etc/hosts from:

Code: Select all

168.125.36.9 nagios-p localhost
To:

Code: Select all

168.125.36.9   nagios-p
127.0.0.1   localhost 
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
kgopiramesh

Re: postgres db error

Post by kgopiramesh »

after changing the hosts file as per the suggestion from Arbist, when I ran the backup script, I have got the following error

Backing up PostgresQL databases...
pg_dump: [archiver (db)] connection to database "nagiosxi" failed: could not connect to server: Connection refused
Is the server running on host "localhost" and accepting
TCP/IP connections on port 5432?
Error backing up PostgresQL database 'nagiosxi' !

echo $?
1


and after changing, the configuration was not applied and never got completed but when I reverted the changed the nagios ccm is running fine. Is this the problem with the credentials used in the script?
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: postgres db error

Post by sreinhardt »

As far as I have seen up to this point, I doubt that it is a credentials issue, or you would have gotten an error for invalid credentials instead of connection refused. Per standard system parameters, localhost must be defined as 127.0.0.x (generally .1). Please change this back, do a full server reboot with "shutdown -r now" and attempt your backup again. My guess would be that do to the previous localhost definition, postgres was started with those settings, and not restarted before you attempted the backup, thus it was still bound to the wrong interface.

I would also as what other configuration changes outside of the nagios interface you may have changed, this seems very odd and prone to more issues, which I'm sure we all would like to avoid and keep you running smoothly instead.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked