Page 1 of 1

nagios backup failing

Posted: Tue Jun 04, 2013 3:17 pm
by benhank
Howdi!

When I run my backup for XI I get the following error

Code: Select all

Backing up PostgresQL databases...
pg_dump: [archiver (db)] connection to database "nagiosxi" failed: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
I am enclosing a cop of my script. The script has worked for a couple of months now with no issues.

Re: nagios backup failing

Posted: Tue Jun 04, 2013 4:02 pm
by abrist
Check to make sure postgres is running and the lock file exists:

Code: Select all

service postgresql status
 ls /tmp/.*lock

Re: nagios backup failing

Posted: Tue Jun 04, 2013 4:11 pm
by benhank

Code: Select all

[root@LkennagiosP01 ~]# ls /tmp/.*lock                                          ls: cannot access /tmp/.*lock: No such file or directory
[root@LkennagiosP01 ~]#

Re: nagios backup failing

Posted: Tue Jun 04, 2013 4:19 pm
by benhank
good news it's all set.
I did a

Code: Select all

service postgresql restart
, and it's ok.

how can I avoid this in the future?

Re: nagios backup failing

Posted: Tue Jun 04, 2013 4:21 pm
by abrist
Looks like postgres may not be running:

Code: Select all

service postgresql stop
killall postgresql
service postgres start

Re: nagios backup failing

Posted: Tue Jun 04, 2013 4:24 pm
by abrist
Looks like we had some forum race conditions.
benhank wrote: how can I avoid this in the future?
This should not be a common occurrence, we can look at the postgres logs to *maybe* see what happened:

Code: Select all

tail -25 /var/lib/pgsql/pgstartup.log

Re: nagios backup failing

Posted: Tue Jun 04, 2013 4:42 pm
by benhank

Code: Select all

[root@LkennagiosP01 ~]# service postgresql stop
Stopping postgresql service:                               [  OK  ]
[root@LkennagiosP01 ~]# killall postgresql
postgresql: no process killed
[root@LkennagiosP01 ~]# service postgres start
postgres: unrecognized service
[root@LkennagiosP01 ~]# service postgresql start
Starting postgresql service:                               [  OK  ]
[root@LkennagiosP01 ~]# tail -25 /var/lib/pgsql/pgstartup.log

fixing permissions on existing directory /var/lib/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in /var/lib/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

Success. You can now start the database server using:

    /usr/bin/postgres -D /var/lib/pgsql/data
or
    /usr/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start

Re: nagios backup failing

Posted: Tue Jun 04, 2013 4:55 pm
by abrist
This all looks normal. Keep an eye on it and keep us posted.

Re: nagios backup failing

Posted: Tue Jun 04, 2013 5:31 pm
by benhank
ok bro, you can lock the topic. =d