Page 1 of 1
Backup Script Failing
Posted: Fri Feb 07, 2014 4:43 am
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?
Re: Backup Script Failing
Posted: Fri Feb 07, 2014 11:44 am
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.
Re: Backup Script Failing
Posted: Fri Feb 07, 2014 11:50 am
by Pilly170
and where abouts do I set my password in here? in the old script I had to do it once.
Re: Backup Script Failing
Posted: Fri Feb 07, 2014 3:32 pm
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.
Re: Backup Script Failing
Posted: Mon Feb 10, 2014 5:06 am
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"
Re: Backup Script Failing
Posted: Mon Feb 10, 2014 9:54 am
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
Re: Backup Script Failing
Posted: Mon Feb 10, 2014 9:57 am
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;
}
}
?>
Re: Backup Script Failing
Posted: Mon Feb 10, 2014 11:33 am
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.
Re: Backup Script Failing
Posted: Mon Feb 10, 2014 11:39 am
by Pilly170
-bash: /usr/local/nagiosxi/scripts/backup_xi.sh: Permission denied
its 644, owner / group is nagios
changed to 0750 and retried... works.
Re: Backup Script Failing
Posted: Mon Feb 10, 2014 11:49 am
by slansing
Excellent.