Does a scheduled local system backup dump remote DB?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

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

Post 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
skynardo
Posts: 136
Joined: Tue Sep 18, 2012 8:59 am
Location: St. Louis, MO

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

Post 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                      |
+----------+-----------+-------------------------------------------+
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post 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'
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
skynardo
Posts: 136
Joined: Tue Sep 18, 2012 8:59 am
Location: St. Louis, MO

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

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

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

Post by lmiltchev »

Sounds good, skynardo! Let us know if it is safe to lock this topic and mark it as "resolved".
Be sure to check out our Knowledgebase for helpful articles and solutions!
skynardo
Posts: 136
Joined: Tue Sep 18, 2012 8:59 am
Location: St. Louis, MO

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

Post by skynardo »

Sure, this one is resolved
Locked