Page 1 of 1

Migrating postgres to MySQL issue!

Posted: Mon Nov 11, 2019 11:06 am
by BanditBBS
Ok, I am following these steps: https://support.nagios.com/kb/article.php?id=560

I am to the part of testing the connection. NagiosXI can't seem to connect to the new mysql database. My DB is offloaded so I did modify the instructions slightly for this case but am having issues

As you can see, I can connect from the NagiosXI server:

Code: Select all

[nagios@iss-chi-nag05 html]$ mysql -h xxx.xxx.xxx.xxx -unagiosxi -pn@gweb
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2945
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
But, when I change the information in config.inc.php NagiosXI can't connect:

Code: Select all

        "nagiosxi" => array(
                "dbtype" => 'mysql',
                "dbserver" => 'xxx.xxx.xxx.xxx',
                "user" => 'nagiosxi',
                "pwd" => 'n@gweb',
                "db" => 'nagiosxi',
                "dbmaint" => array(             // variables affecting maintenance of db
                        "max_auditlog_age" => 30, // max time (in DAYS) to keep audit log entries
                        "max_commands_age" => 480, // max time (minutes) to keep commands
                        "max_events_age" => 480, // max time (minutes) to keep events
                        "optimize_interval" => 60, // time (in minutes) between db optimization runs
                        "repair_interval" => 0, // time (in minutes) between db repair runs
                        ),
                ),
        "ndoutils" => array(
                "dbtype" => 'mysql',
                "dbserver" => 'xxx.xxx.xxx.xxx',
                "user" => 'nagios',
                "pwd" => 'nagios',
                "db" => 'nagios',

Re: Migrating postgres to MySQL issue!

Posted: Mon Nov 11, 2019 2:41 pm
by tgriep
Run this command to see if you can view the MYSQL tables in the offloaded nagiosxi database.

Code: Select all

echo 'show tables;' | mysql -h xxx.xxx.xxx.xxx -u nagiosxi -pn@gweb --database nagiosxi
If you see the tables, lets see if you can view the xi_users table. Run this

Code: Select all

echo 'select * from xi_users;' | mysql -h xxx.xxx.xxx.xxx -u nagiosxi -pn@gweb --database nagiosxi
What sort of errors are you seeing?

Re: Migrating postgres to MySQL issue!

Posted: Mon Nov 11, 2019 2:45 pm
by BanditBBS
Yes, both commands work fine, not going to paste the output of the showing the users table for security reasons of course ;)

nagios saying "Can't connect to database, try running repair database script"

Wasn't worded that way exactly, but that is the gist.

Re: Migrating postgres to MySQL issue!

Posted: Mon Nov 11, 2019 2:55 pm
by tgriep
When you go to the Web address for the GUI, does it display the login menu and does it allow you to login?

Is that when you are seeing the error message?

Do you see any errors in the Apache log files in the /var/log/httpd folder, if so, post them here.

When you change the settings in the config.inc.php file, you you stop all of the processes and start them up again to the change can take effect?

Re: Migrating postgres to MySQL issue!

Posted: Mon Nov 11, 2019 3:38 pm
by BanditBBS
OMG! I went to do it again to get exact error for you and its now working. I don't know what's going on anymore. Thanks for trying and feel free to close this!

Re: Migrating postgres to MySQL issue!

Posted: Mon Nov 11, 2019 4:26 pm
by tgriep
We all have one of those days where the magic happens. Glad it is working so I'll lock the ticket.