Backup Script Failing

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Pilly170
Posts: 75
Joined: Thu Mar 28, 2013 6:03 am

Backup Script Failing

Post by Pilly170 »

Hi,

I normally use the backup document http://assets.nagios.com/downloads/nagi ... ing_XI.pdf.

Normally I would edit /usr/local/nagiosxi/scripts/backup_xi.sh and change the password. now I cant find the password in this document.

Any ideas?
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Backup Script Failing

Post by sreinhardt »

We no longer keep the passwords in that script, it should be located in /usr/local/nagiosxi/html/config.inc.php, and is imported from there for backups. This is due to many changes for the 2014 release.
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.
Pilly170
Posts: 75
Joined: Thu Mar 28, 2013 6:03 am

Re: Backup Script Failing

Post by Pilly170 »

and where abouts do I set my password in here? in the old script I had to do it once.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Backup Script Failing

Post by tmcdonald »

Starting on line 91 in that file is the array that holds your credentials. You will need to edit the ndoutils pass and the nagiosql pass but *only* if you have already changed them before. Usually if your XI is working this means you have not changed them.
Former Nagios employee
Pilly170
Posts: 75
Joined: Thu Mar 28, 2013 6:03 am

Re: Backup Script Failing

Post by Pilly170 »

Have you got any examples, as I changed the password to my root one, and still got the error message.

I did recieve an error at the start of the backup

"could not open input file import_XIconfig.php"
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Backup Script Failing

Post by tmcdonald »

Pilly170 wrote:"could not open input file import_XIconfig.php"
Was that a typo or did it really say "import_XIconfig.php"? There should be no capitals there. Also, please post the output of the following:

Code: Select all

ls -l /usr/local/nagiosxi/scripts/import_xiconfig.php
Former Nagios employee
Pilly170
Posts: 75
Joined: Thu Mar 28, 2013 6:03 am

Re: Backup Script Failing

Post by Pilly170 »

[root@nagios ~]# /usr/local/nagiosxi/scripts/backup_xi.sh
Could not open input file: import_xiconfig.php
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
[root@nagios ~]# vi /usr/local/nagiosxi/scripts/import_xiconfig.php
<?php
require_once("/usr/local/nagiosxi/html/config.inc.php");

// Display all variables out
$prev = array('cfg');
export_all_variables($cfg, $prev);

function export_all_variables($arr, $prev=array()) {
// Loop through all the config variables and display them out
foreach ($arr as $k => $v) {

if (is_array($v)) {
// If it is an array we need to do some recursion
$prev[] = $k;
export_all_variables($v, $prev);
} else {

// If it's not an array lets print the info
if (is_string($v)) {
$v = "'".$v."'";
} else if (is_bool($v)) {
if ($v) {
$v = 1;
} else {
$v = 0;
}
}

print display_previous($prev) . $k . "=" . $v . "\n";
}

$prev = array_diff($prev, array($k));

}
}

function display_previous($prev=array()) {
if (!empty($prev) && is_array($prev)) {
$str = "";
foreach ($prev as $p) {
$str .= $p . "__";
}
return $str;
}
}

?>
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Backup Script Failing

Post by scottwilkerson »

We did have an bug in the new backup script.

Please unzip the attached and place in /usr/local/nagiosxi/scripts

Then there should be no need to edit the password.
You do not have the required permissions to view the files attached to this post.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Pilly170
Posts: 75
Joined: Thu Mar 28, 2013 6:03 am

Re: Backup Script Failing

Post by Pilly170 »

-bash: /usr/local/nagiosxi/scripts/backup_xi.sh: Permission denied

its 644, owner / group is nagios

changed to 0750 and retried... works.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Backup Script Failing

Post by slansing »

Excellent.
Locked