Page 2 of 2

Re: database connection error

Posted: Thu Feb 12, 2015 11:55 am
by QS1
Yes, I can ping localhost now after changing host tables to loopback (was unable to before this post)...I have the NIC's disabled on the VM to avoid sending alerts from this nagios server.

ping: unknown host loclahost
[root@nagiosxi ~]# ping localhost
PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=64 time=0.048 ms
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=2 ttl=64 time=0.053 ms
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=3 ttl=64 time=0.053 ms
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=4 ttl=64 time=0.050 ms
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=5 ttl=64 time=0.052 ms
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=6 ttl=64 time=0.035 ms
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=7 ttl=64 time=0.047 ms
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=8 ttl=64 time=0.078 ms
--- localhost.localdomain ping statistics ---
8 packets transmitted, 8 received, 0% packet loss, time 7018ms
rtt min/avg/max/mdev = 0.035/0.052/0.078/0.011 ms

I re-ran the error log tail and see PHP errors

root@nagiosxi ~]# tail -50 /var/log/httpd/error_log
[Thu Feb 12 10:46:51 2015] [error] [client 127.0.0.1] PHP Warning: pg_pconnect() [<a href='function.pg-pconnect'>function.pg-pconnect</a>]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP connections on port 5432? in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-postgres64.inc.php on line 682
[Thu Feb 12 10:46:51 2015] [error] [client 127.0.0.1] PHP Notice: Undefined variable: result in /usr/local/nagiosxi/html/includes/db.inc.php on line 241
[Thu Feb 12 10:46:51 2015] [error] [client 127.0.0.1] PHP Warning: pg_pconnect() [<a href='function.pg-pconnect'>function.pg-pconnect</a>]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP connections on port 5432? in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-postgres64.inc.php on line 682
[Thu Feb 12 10:46:51 2015] [error] [client 127.0.0.1] PHP Notice: Undefined variable: result in /usr/local/nagiosxi/html/includes/db.inc.php on line 241
[Thu Feb 12 10:46:51 2015] [error] [client 127.0.0.1] PHP Warning: Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/includes/components/nagiosim/nagiosim.inc.php on line 395
[Thu Feb 12 10:46:51 2015] [error] [client 127.0.0.1] PHP Notice: Undefined index: ndoutils in /usr/local/nagiosxi/html/includes/db.inc.php on line 475
[Thu Feb 12 10:46:51 2015] [error] [client 127.0.0.1] PHP Warning: pg_pconnect() [<a href='function.pg-pconnect'>function.pg-pconnect</a>]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP connections on port 5432? in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-postgres64.inc.php on line 682
[Thu Feb 12 10:46:51 2015] [error] [client 127.0.0.1] PHP Notice: Undefined variable: result in /usr/local/nagiosxi/html/includes/db.inc.php on line 241
[Thu Feb 12 10:47:19 2015] [notice] caught SIGTERM, shutting down
[Thu Feb 12 10:47:21 2015] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Feb 12 10:47:21 2015] [notice] SSL FIPS mode disabled
[Thu Feb 12 10:47:21 2015] [warn] RSA server certificate CommonName (CN) `www.qnagios.com' does NOT match server name!?
[Thu Feb 12 10:47:21 2015] [notice] Digest: generating secret for digest authentication ...
[Thu Feb 12 10:47:21 2015] [notice] Digest: done
[Thu Feb 12 10:47:21 2015] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Thu Feb 12 10:47:21 2015] [notice] SSL FIPS mode disabled
[Thu Feb 12 10:47:21 2015] [warn] RSA server certificate CommonName (CN) `www.qnagios.com' does NOT match server name!?
[Thu Feb 12 10:47:21 2015] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
[Thu Feb 12 10:50:59 2015] [error] [client 127.0.0.1] PHP Warning: pg_pconnect() [<a href='function.pg-pconnect'>function.pg-pconnect</a>]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP connections on port 5432? in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-postgres64.inc.php on line 682
[Thu Feb 12 10:50:59 2015] [error] [client 127.0.0.1] PHP Notice: Undefined variable: result in /usr/local/nagiosxi/html/includes/db.inc.php on line 241
[Thu Feb 12 10:50:59 2015] [error] [client 127.0.0.1] PHP Warning: pg_pconnect() [<a href='function.pg-pconnect'>function.pg-pconnect</a>]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP connections on port 5432? in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-postgres64.inc.php on line 682
[Thu Feb 12 10:50:59 2015] [error] [client 127.0.0.1] PHP Notice: Undefined variable: result in /usr/local/nagiosxi/html/includes/db.inc.php on line 241
[Thu Feb 12 10:50:59 2015] [error] [client 127.0.0.1] PHP Warning: Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/includes/components/nagiosim/nagiosim.inc.php on line 395
[Thu Feb 12 10:51:00 2015] [error] [client 127.0.0.1] PHP Notice: Undefined index: ndoutils in /usr/local/nagiosxi/html/includes/db.inc.php on line 475
[Thu Feb 12 10:51:00 2015] [error] [client 127.0.0.1] PHP Warning: pg_pconnect() [<a href='function.pg-pconnect'>function.pg-pconnect</a>]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP connections on port 5432? in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-postgres64.inc.php on line 682
[Thu Feb 12 10:51:00 2015] [error] [client 127.0.0.1] PHP Notice: Undefined variable: result in /usr/local/nagiosxi/html/includes/db.inc.php on line 241
[Thu Feb 12 10:51:03 2015] [error] [client 127.0.0.1] PHP Warning: pg_pconnect() [<a href='function.pg-pconnect'>function.pg-pconnect</a>]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP connections on port 5432? in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-postgres64.inc.php on line 682
[Thu Feb 12 10:51:03 2015] [error] [client 127.0.0.1] PHP Notice: Undefined variable: result in /usr/local/nagiosxi/html/includes/db.inc.php on line 241
[Thu Feb 12 10:51:03 2015] [error] [client 127.0.0.1] PHP Warning: pg_pconnect() [<a href='function.pg-pconnect'>function.pg-pconnect</a>]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP connections on port 5432? in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-postgres64.inc.php on line 682
[Thu Feb 12 10:51:03 2015] [error] [client 127.0.0.1] PHP Notice: Undefined variable: result in /usr/local/nagiosxi/html/includes/db.inc.php on line 241
[Thu Feb 12 10:51:03 2015] [error] [client 127.0.0.1] PHP Warning: Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/includes/components/nagiosim/nagiosim.inc.php on line 395
[Thu Feb 12 10:51:03 2015] [error] [client 127.0.0.1] PHP Notice: Undefined index: ndoutils in /usr/local/nagiosxi/html/includes/db.inc.php on line 475
[Thu Feb 12 10:51:03 2015] [error] [client 127.0.0.1] PHP Warning: pg_pconnect() [<a href='function.pg-pconnect'>function.pg-pconnect</a>]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP connections on port 5432? in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-postgres64.inc.php on line 682
[Thu Feb 12 10:51:03 2015] [error] [client 127.0.0.1] PHP Notice: Undefined variable: result in /usr/local/nagiosxi/html/includes/db.inc.php on line 241
[Thu Feb 12 10:51:06 2015] [error] [client 127.0.0.1] PHP Warning: pg_pconnect() [<a href='function.pg-pconnect'>function.pg-pconnect</a>]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP connections on port 5432? in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-postgres64.inc.php on line 682
[Thu Feb 12 10:51:06 2015] [error] [client 127.0.0.1] PHP Notice: Undefined variable: result in /usr/local/nagiosxi/html/includes/db.inc.php on line 241
[Thu Feb 12 10:51:06 2015] [error] [client 127.0.0.1] PHP Warning: pg_pconnect() [<a href='function.pg-pconnect'>function.pg-pconnect</a>]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP connections on port 5432? in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-postgres64.inc.php on line 682
[Thu Feb 12 10:51:06 2015] [error] [client 127.0.0.1] PHP Notice: Undefined variable: result in /usr/local/nagiosxi/html/includes/db.inc.php on line 241
[Thu Feb 12 10:51:06 2015] [error] [client 127.0.0.1] PHP Warning: Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/includes/components/nagiosim/nagiosim.inc.php on line 395
[Thu Feb 12 10:51:07 2015] [error] [client 127.0.0.1] PHP Notice: Undefined index: ndoutils in /usr/local/nagiosxi/html/includes/db.inc.php on line 475
[Thu Feb 12 10:51:07 2015] [error] [client 127.0.0.1] PHP Warning: pg_pconnect() [<a href='function.pg-pconnect'>function.pg-pconnect</a>]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP connections on port 5432? in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-postgres64.inc.php on line 682
[Thu Feb 12 10:51:07 2015] [error] [client 127.0.0.1] PHP Notice: Undefined variable: result in /usr/local/nagiosxi/html/includes/db.inc.php on line 241
[Thu Feb 12 10:51:22 2015] [error] [client 127.0.0.1] PHP Warning: pg_pconnect() [<a href='function.pg-pconnect'>function.pg-pconnect</a>]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP connections on port 5432? in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-postgres64.inc.php on line 682
[Thu Feb 12 10:51:22 2015] [error] [client 127.0.0.1] PHP Notice: Undefined variable: result in /usr/local/nagiosxi/html/includes/db.inc.php on line 241
[Thu Feb 12 10:51:22 2015] [error] [client 127.0.0.1] PHP Warning: pg_pconnect() [<a href='function.pg-pconnect'>function.pg-pconnect</a>]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP connections on port 5432? in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-postgres64.inc.php on line 682
[Thu Feb 12 10:51:22 2015] [error] [client 127.0.0.1] PHP Notice: Undefined variable: result in /usr/local/nagiosxi/html/includes/db.inc.php on line 241
[Thu Feb 12 10:51:22 2015] [error] [client 127.0.0.1] PHP Warning: Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/includes/components/nagiosim/nagiosim.inc.php on line 395
[Thu Feb 12 10:51:23 2015] [error] [client 127.0.0.1] PHP Notice: Undefined index: ndoutils in /usr/local/nagiosxi/html/includes/db.inc.php on line 475
[Thu Feb 12 10:51:24 2015] [error] [client 127.0.0.1] PHP Warning: pg_pconnect() [<a href='function.pg-pconnect'>function.pg-pconnect</a>]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP connections on port 5432? in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-postgres64.inc.php on line 682
[Thu Feb 12 10:51:24 2015] [error] [client 127.0.0.1] PHP Notice: Undefined variable: result in /usr/local/nagiosxi/html/includes/db.inc.php on line 241
[root@nagiosxi ~]#

still getting database connection error

Re: database connection error

Posted: Thu Feb 12, 2015 12:50 pm
by abrist
Restart postgresql and then try one more time. If it is still failing, send an email to [email protected] to open a ticket as we may want to move this to a remote session to resolve it.

Re: database connection error

Posted: Thu Feb 12, 2015 1:20 pm
by QS1
That worked.... in now. Thank you this post can be completed