Page 2 of 2

Re: Does a scheduled local system backup dump remote DB?

Posted: Thu May 21, 2015 4:41 pm
by jdalrymple
skynardo wrote:I built a new test box and restored last nights backup
No - fullinstall *should* create that users. Note the script 2-usergroups:

Code: Select all

#!/bin/sh

. ./xi-sys.cfg

# Was previous step completed?
if [ ! -f installed.prereqs ]; then
        echo "Prereqs were not installed - run previous script" >&2
        exit 1
fi

# Was this step already completed?
if [ -f installed.usersgroups ]; then
        echo "Users/groups already configured - skipping."
        exit 0
fi

##########################################
# CREATE USERS AND GROUPS
##########################################

echo "Adding users and groups..."
eval "$useraddbin" -n "$nagiosuser"
eval "$groupaddbin" "$nagiosgroup"
eval "$groupaddbin" "$nagioscmdgroup"
eval "$usermodbin" -a -G "$nagioscmdgroup" "$nagiosuser"
eval "$usermodbin" -a -G "$nagioscmdgroup" "$apacheuser"
eval "$usermodbin" -a -G "$nagiosgroup" "$nagiosuser"
eval "$usermodbin" -a -G "$nagiosgroup" "$apacheuser"

# Make sure user exists
if ! grep -q "^$nagiosuser:" /etc/passwd; then
        echo "ERROR: User '$nagiosuser' was not created - exiting." >&2
        exit 1
fi

# Make sure groups exist
for group in "$nagiosgroup" "$nagioscmdgroup"; do
        if ! grep -q "^$group:" /etc/group; then
                echo "ERROR: Group '$group' was not created - exiting." >&2
                exit 1
        fi
done

echo "Users and groups added OK"
touch installed.usersgroups
You may want to take a peek in your install.log

Re: Does a scheduled local system backup dump remote DB?

Posted: Thu May 21, 2015 4:56 pm
by skynardo
The issue was with the mysql user, not the unix/application ids.
This was a query after the fullinstall. Maybe the issue is that I originally created databases called nagios and nagiosql on my production remote database and it looks like the installer creates the ndoutils database rather than the nagios database.

Code: Select all

mysql> select user, host, password from mysql.user
    -> ;
+----------+-----------+-------------------------------------------+
| user     | host      | password                                  |
+----------+-----------+-------------------------------------------+
| root     | localhost | *C96C0FA6D6BLAHBLABLAHD3EA134C            |
| root     | devut512  |                                           |
| root     | 127.0.0.1 |                                           |
|          | localhost |                                           |
|          | devut512  |                                           |
| ndoutils | localhost | *244733929BLABLAHBLAH                     |
| nagiosql | localhost | *BLAHBLAHBLAH4092EE7                      |
+----------+-----------+-------------------------------------------+

Re: Does a scheduled local system backup dump remote DB?

Posted: Fri May 22, 2015 10:15 am
by abrist
No, the database should be called "nagios". The user should be "ndoutilis". When we have people create a remote db, we have them create a nagios user, from:
https://assets.nagios.com/downloads/nag ... Server.pdf
mysql -u root -p
'mypassword
'
> create database nagios;
> GRANT ALL ON nagios.* TO nagios@'<IP_OF_NAGIOS_SERVER>' IDENTIFIED BY 'nagios'

Re: Does a scheduled local system backup dump remote DB?

Posted: Fri May 22, 2015 3:54 pm
by skynardo
OK, that makes sense. I have been able to restore my prod backup to a new system twice without issue once I got the steps down pat.
Basically after running restore script, I edit the settings.php, config.inc.php and ndo2db.cfg changing dbserver to localhost, then create nagios@localhost user and grant all privileges, then set password for nagiosql@localhost.

Re: Does a scheduled local system backup dump remote DB?

Posted: Tue May 26, 2015 10:12 am
by lmiltchev
Sounds good, skynardo! Let us know if it is safe to lock this topic and mark it as "resolved".

Re: Does a scheduled local system backup dump remote DB?

Posted: Fri Jul 24, 2015 11:19 am
by skynardo
Sure, this one is resolved