MYSQL Database Issue with Bulk Modifications Tool
Posted: Thu Feb 02, 2017 3:21 pm
Hello,
We are experiencing an issue with the Bulk Modifications Tool, that produces an SQL error as seen in the image below:
We are using several NagiosXI (version 5.3.3) instances with a remote database server, along with separate database instances each of which has a non-default name. From our troubleshooting it seems as if the PHP code for this tool uses an assumed database name of nagiosql, and our database names are different. We were able to clear the error from the page, by removing the explicit database name from the following SELECT lines in /usr/local/nagiosxi/includes/components/bulkmodifications/bulkmodifications.inc.php,
$hostgroups = exec_sql_query(DB_NAGIOSQL, "SELECT `hostgroup_name` as `id`,`hostgroup_name`,`alias` FROM nagiosql.tbl_hostgroup ORDER BY `hostgroup_name`;", true);
$servicegroups = exec_sql_query(DB_NAGIOSQL, "SELECT `servicegroup_name` as `id`,`servicegroup_name`,`alias` FROM nagiosql.tbl_servicegroup ORDER BY `servicegroup_name`;", true);
However we are not sure if this is the best fix. Perhaps it is better to read the database name from the /usr/local/nagiosxi/html/config.inc.php for the SELECT statement, just as it does for the connection information.
Thank you,
Paul
We are experiencing an issue with the Bulk Modifications Tool, that produces an SQL error as seen in the image below:
We are using several NagiosXI (version 5.3.3) instances with a remote database server, along with separate database instances each of which has a non-default name. From our troubleshooting it seems as if the PHP code for this tool uses an assumed database name of nagiosql, and our database names are different. We were able to clear the error from the page, by removing the explicit database name from the following SELECT lines in /usr/local/nagiosxi/includes/components/bulkmodifications/bulkmodifications.inc.php,
$hostgroups = exec_sql_query(DB_NAGIOSQL, "SELECT `hostgroup_name` as `id`,`hostgroup_name`,`alias` FROM nagiosql.tbl_hostgroup ORDER BY `hostgroup_name`;", true);
$servicegroups = exec_sql_query(DB_NAGIOSQL, "SELECT `servicegroup_name` as `id`,`servicegroup_name`,`alias` FROM nagiosql.tbl_servicegroup ORDER BY `servicegroup_name`;", true);
However we are not sure if this is the best fix. Perhaps it is better to read the database name from the /usr/local/nagiosxi/html/config.inc.php for the SELECT statement, just as it does for the connection information.
Thank you,
Paul