Page 1 of 1

Restore NagVis maps from the backups...

Posted: Thu Sep 15, 2016 11:28 am
by SteveBeauchemin
So, It finally happened that someone broke a NagVis map while trying to update it. It got really messed up.
In the file /usr/local/nagiosxi/scripts/backup_xi.sh the NagVis tool was missing for a while, but is now included.
It is even included in /usr/local/nagiosxi/scripts/restore_xi.sh too. It was missing from those in earlier versions.
Since it is now there for us to run manually, I thought... well...

So I decided to look in the file created by "Admin" -> "Scheduled Backups" and pull out a copy of the file from before it degraded. It turns out that of all the files in that tar.gz file there was no NagVis. So, I tried to look at the php code and add it. Nope. Not gonna happen... That code is part of the special stuff the end users are not able to change. (SourceGuardian)

So, can someone please look in /usr/local/nagiosxi/html/includes/components/scheduledbackups and make sure that NagVis gets included when scheduled backups run?

NagVis is part of the Nagios XI install... It should be included in the Nagios XI backups.
If it is already there, then tell me I'm crazy... If not, Please add it.
I did get the file restored from an OS backup but I should not have had to take that route.

Thanks

Steve B

Re: Restore NagVis maps from the backups...

Posted: Thu Sep 15, 2016 11:52 am
by lmiltchev
H-m-m, I grepped for "nagvis" the "backup_xi.sh" & "restore_xi.sh" script, and it seems NagVis is being backup up...

Code: Select all

[root@localhost scripts]# pwd
/usr/local/nagiosxi/scripts
[root@localhost scripts]# grep -i nagvis backup_xi.sh
echo "Backing up Nagvis..."
tar czfp $mydir/nagvis.tar.gz /usr/local/nagvis

[root@localhost scripts]# grep -i nagvis restore_xi.sh
# Nagvis
if [ -f $backupdir/nagvis.tar.gz ]; then
        echo "Restoring Nagvis backups..."
        rm -rf /usr/local/nagvis
        cd $rootdir && tar xzfps $backupdir/nagvis.tar.gz
        chown -R apache.apache /usr/local/nagvis

Re: Restore NagVis maps from the backups...

Posted: Thu Sep 15, 2016 12:14 pm
by SteveBeauchemin
When you run those files manually, sure, it is being backed up. I said that in my post.

But, what about the items I asked about? The scheduled backups. On the Admin tab, Scheduled backups, FTP, SSH, or Local.

I was very specific I thought.

Steve B

Re: Restore NagVis maps from the backups...

Posted: Thu Sep 15, 2016 12:42 pm
by lmiltchev
The Scheduled Backups component is using the same script to do the backups (backup_xi.sh). We don't have a "separate" script for scheduled backups...

Re: Restore NagVis maps from the backups...

Posted: Thu Sep 15, 2016 12:50 pm
by lmiltchev
BTW, one way to verify what I said, is to run a tail on the "cmdsubsys.log" while scheduled backup is running.
tail: /usr/local/nagiosxi/var/cmdsubsys.log: file truncated

PROCESSED 0 COMMANDS
MMANDS
tail: /usr/local/nagiosxi/var/cmdsubsys.log: file truncated
........................................PROCESSING COMMAND ID 18...
PROCESS COMMAND: CMD=1117, DATA=a:2:{i:0;s:19:"nagiosxi.1473961544";i:1;s:24:"/store/backups/nagiosxi/";}
CMDLINE=/usr/local/nagiosxi/scripts/backup_xi.sh -n nagiosxi.1473961544 -d /store/backups/nagiosxi
Failed to restart nagios.service: Interactive authentication required.
Backing up Core Config Manager (NagiosQL)...
tar: Removing leading `/' from member names
tar: Removing leading `/' from member names
Backing up Nagios Core...
tar: Removing leading `/' from member names
tail: /usr/local/nagiosxi/var/cmdsubsys.log: file truncated
.......tar: /usr/local/nagios/var/rw/nagios.qh: socket ignored
tar: /usr/local/nagios/var/ndo.sock: socket ignored
Backing up Nagios XI...
tar: Removing leading `/' from member names
tar: /usr/local/nagiosxi/var/components/nagiosim.log: file changed as we read it
Backing up MRTG...
tar: Removing leading `/' from member names
Backing up NRDP...
tar: Removing leading `/' from member names
Backing up Nagvis...
tar: Removing leading `/' from member names
Backing up MySQL databases...
Backing up logrotate config files...
Backing up Apache config files...
Compressing backup...

===============
BACKUP COMPLETE
===============
Backup stored in /store/backups/nagiosxi/nagiosxi.1473961544.tar.gz
OUTPUT=Backup stored in /store/backups/nagiosxi/nagiosxi.1473961544.tar.gz
RETURNCODE=0

PROCESSED 1 COMMANDS

Code: Select all

# tar -tvf /store/backups/nagiosxi/nagiosxi.1473961544.tar.gz | grep -i nagvis
-rw-r--r-- nagios/nagios  2381621 2016-09-15 12:46 nagiosxi.1473961544/nagvis.tar.gz

Re: Restore NagVis maps from the backups...

Posted: Thu Sep 15, 2016 1:16 pm
by SteveBeauchemin
When I was unable to read the php I thought there was something special happening in the component that was a secret. So I did not chase it any further. I Appreciate the response. I'll go thru the tar file again and make sure not to miss the information this time. In case it happens again.

Thank you for clearing that up for me. My apologies...

Steve B

Re: Restore NagVis maps from the backups...

Posted: Thu Sep 15, 2016 1:20 pm
by lmiltchev
No problem, Steve. I am glad I was able to help! Is it ok if we lock this topic or you want us to keep it open for the time being?

Re: Restore NagVis maps from the backups...

Posted: Mon Sep 19, 2016 10:32 am
by SteveBeauchemin
Sure. Close it.