Hi,
We offloaded the database of one of our XI servers to an external SQL Farm. We followed the oficial document from NagiosXI
https://assets.nagios.com/downloads/nag ... Server.pdf
But, the problem is that the database server is using the port 3308 and not the default 3306.
This is not a problem, but inside /usr/local/nagiosxi/html/config.inc.php there is no line to change it.
“dbtype” => 'mysql',
“dbserver” => '<IP_OF_MYSQL_SERVER>',
“user” => 'nagios',
“pwd” => 'nagios',
“db” => 'nagios
What we did and is working is:
“dbtype” => 'mysql',
“dbserver” => '<IP_OF_MYSQL_SERVER:3308>',
“user” => 'nagios',
“pwd” => 'nagios',
“db” => 'nagios
But now if we go through the config manager --> Config Manager Admin --> Config Manager Settings the information that we can see is:
[nagios@plinag01 scripts]$ vi /usr/local/nagiosxi/etc/components/ccm_config.inc.php
<?php
/** DO NOT MANUALLY EDIT THIS FILE
This file is used internally by Nagios CCM.
Nagios CCM will override this file automatically with the latest settings. */
$CFG["plugins_directory"] = "/usr/local/nagios/libexec";
$CFG["command_file"] = "/usr/local/nagios/var/rw/nagios.cmd";
$CFG["default_language"] = "en_US";
// MySQL database connection info
$CFG["db"] = array(
"server" => "1.1.1.1:3308",
"port" => "3306",
"database" => "nagiosql",
"username" => "nagiosql",
"password" => "xxxxx"
);
Then how we can add the port configuration correctly to the config.inc.phph and ccm_config.inc.php.
Can we add a new line in config.inc.php like “port” => '3308', ?
Offloading Nagios Data Base and use different MySQL Port
Re: Offloading Nagios Data Base and use different MySQL Port
I might have to test this, but what XI version are you on? I'll ask a dev but I am not 100% sure the CCM even uses that file anymore.
Former Nagios employee
Re: Offloading Nagios Data Base and use different MySQL Port
We are working with Nagios XI 2014R2.5.
Re: Offloading Nagios Data Base and use different MySQL Port
I got this reply back from the devs:
The CCM uses ccm_config.inc.php like he edited.
So in the XI config he needs to use the ip:port for dbserver and in the CCM he needs to use the port variable for the port.
Former Nagios employee
Re: Offloading Nagios Data Base and use different MySQL Port
In /usr/local/nagiosxi/html/config.inc.php
We added the IP:3308
With /usr/local/nagiosxi/etc/components/ccm_config.inc.php we can not modify the file using the Nagios XI web interface and it shows:
Server IP:3308
Port 3306
But if we go through command line and change manually /usr/local/nagiosxi/etc/components/ccm_config.inc.php to:
Server IP
Port 3308
Then the Nagios XI shows the correct connection and looks like all it's working.
But, if ccm_config.inc.php have IP:3308 and Port 3306 looks like it's working to...
We added the IP:3308
With /usr/local/nagiosxi/etc/components/ccm_config.inc.php we can not modify the file using the Nagios XI web interface and it shows:
Server IP:3308
Port 3306
But if we go through command line and change manually /usr/local/nagiosxi/etc/components/ccm_config.inc.php to:
Server IP
Port 3308
Then the Nagios XI shows the correct connection and looks like all it's working.
But, if ccm_config.inc.php have IP:3308 and Port 3306 looks like it's working to...
Re: Offloading Nagios Data Base and use different MySQL Port
This looks like a bug, I've submitted a bug report:
Here is a workaround, edit this file:
Change this code (around line 126):
To:
Then it should update the /usr/local/nagiosxi/etc/components/ccm_config.inc.php file properly.
If not, run this command:
Then go into the XI interface and got to Configure > Core Config Manager and it should regenerate that file.
Code: Select all
NEW TASK ID 5892 created - Nagios XI Bug Report: Changing mysql port does not reflect properly in ccm_config.inc.phpCode: Select all
/usr/local/nagiosxi/html/includes/components/ccm/ccm.inc.phpCode: Select all
$port = 3306;Code: Select all
if (strstr($server, ':')) {
$port = substr($server, strpos($server, ':') + 1);
$server = strtok($server, ':');
}
else {
$port = 3306;
}If not, run this command:
Code: Select all
rm /usr/local/nagiosxi/etc/components/ccm_config.inc.php