SSH Scheduled Backups

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
bosecorp
Posts: 929
Joined: Thu Jun 26, 2014 1:00 pm

Re: SSH Scheduled Backups

Post by bosecorp »

need to do it again, that day we happened to run out space.

my problem is that the zip file is not getting copied to the remote server. the backup finish completely and you can tell because the zip file is created successfully. in the example provided, that doesn't happens
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: SSH Scheduled Backups

Post by Box293 »

Yes I can see a couple of things going on.

I noticed these errors in the log you PM'd me:

Code: Select all

Message: A database connection error has been detected, we are attempting to repair the server, if the repair does not resolve the issue, please contact Nagios support.
ERROR CONNECTING TO DATABASES!
PHP Warning:  pg_pconnect(): Unable to connect to PostgreSQL server: FATAL:  connection limit exceeded for non-superusers in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-postgres64.inc.php on line 682
I'm going to follow up with the USA techs on this one. Regardless, I know this is not the cause of your issue but it needs to be resolved none the less.

What version of Nagios XI do you have?

I would also like you to attempt to copy the file vi SSH at the command line:

Code: Select all

su nagios
xxx command to copy /store/backups/nagiosxi/backupfile.tar.gz to SSH destination
I want to see if it succeeds at the command line.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: SSH Scheduled Backups

Post by tmcdonald »

How many people do you have logged in at once? The pg_connect errors about connection limits exceeded is usually an easy fix, but typically only seen when many people are logged in at once or when many reports are being run:

http://stackoverflow.com/questions/1358 ... superusers

Also, do you have any checks being run against the Nagios postgres database for performance or anything? This would also add to the number of connections.
Former Nagios employee
bosecorp
Posts: 929
Joined: Thu Jun 26, 2014 1:00 pm

Re: SSH Scheduled Backups

Post by bosecorp »

Box293

here is the result

# su - nagios
[nagios@nagmonus1 ~]$ cd /store/
[nagios@nagmonus1 store]$ cd backups/
[nagios@nagmonus1 backups]$ cd nagiosxi/
[nagios@nagmonus1 nagiosxi]$ scp nagiosxi.1446430802.tar.gz nagmondb1:/store/backups/nagiosxi
scp: /store/backups/nagiosxi/nagiosxi.1446430802.tar.gz: Permission denied


but, this should not matter because when I schedule the JOB, I configured as root

lastly, my DB seems to be in a good state

# /usr/local/nagiosxi/scripts/box293_check_mysql_table_status nagios nagiosxi
Database "nagios" = All OK
You have mail in /var/spool/mail/root
root@nagmondb1:(11-02 17:01): /
# /usr/local/nagiosxi/scripts/box293_check_mysql_table_status nagiosql nagiosxi
Database "nagiosql" = All OK
You do not have the required permissions to view the files attached to this post.
bosecorp
Posts: 929
Joined: Thu Jun 26, 2014 1:00 pm

Re: SSH Scheduled Backups

Post by bosecorp »

Hi tmcdonald

We have about ten different stations that have different dashboards

I do have checks being run agains the postgress db
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: SSH Scheduled Backups

Post by Box293 »

bosecorp wrote:# su - nagios
[nagios@nagmonus1 ~]$ cd /store/
[nagios@nagmonus1 store]$ cd backups/
[nagios@nagmonus1 backups]$ cd nagiosxi/
[nagios@nagmonus1 nagiosxi]$ scp nagiosxi.1446430802.tar.gz nagmondb1:/store/backups/nagiosxi
scp: /store/backups/nagiosxi/nagiosxi.1446430802.tar.gz: Permission denied


but, this should not matter because when I schedule the JOB, I configured as root
OK so the cron job itself runs as the nagios user, lets try making sure we also define the root username:

Code: Select all

su - nagios
cd /store/backups/nagiosxi/
scp nagiosxi.1446430802.tar.gz root@nagmondb1:/store/backups/nagiosxi
It should prompt you for the password, please type it and lets see what the result is.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
bosecorp
Posts: 929
Joined: Thu Jun 26, 2014 1:00 pm

Re: SSH Scheduled Backups

Post by bosecorp »

it works, after typing the password

root@nagmonus1:(11-03 19:19): /root/.ssh
# su - nagios
[nagios@nagmonus1 ~]$ cd /store/backups/nagiosxi/
[nagios@nagmonus1 nagiosxi]$ scp nagiosxi.1446430802.tar.gz root@nagmondb1:/store/backups/nagiosxi
root@nagmondb1's password:
nagiosxi.1446430802.tar.gz 100% 7826MB 49.9MB/s 02:37
You have new mail in /var/spool/mail/nagios
[nagios@nagmonus1 nagiosxi]$
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: SSH Scheduled Backups

Post by Box293 »

OK so thats a good thing.

I'm going to talk to the USA techs about what troubleshooting steps we can follow next.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: SSH Scheduled Backups

Post by Box293 »

What version of XI are you using?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
bosecorp
Posts: 929
Joined: Thu Jun 26, 2014 1:00 pm

Re: SSH Scheduled Backups

Post by bosecorp »

Installed Version: 2014R1.5
Locked