Page 2 of 2

Re: PHP error with bulk modification tool

Posted: Tue Apr 30, 2024 11:39 am
by jsimon
Trailing characters certainly could cause issues with the bulk modification tool, interesting that fixing it hasn't corrected the issue based on the log errors you're seeing. Have you checked your recent logs since fixing this issue? I'm curious what the errors are without the trailing comma.

Re: PHP error with bulk modification tool

Posted: Tue Apr 30, 2024 1:20 pm
by naggyohs
The logs look similar to me:

[Tue Apr 30 12:45:04.145253 2024] [php:error] [pid 51094] [client xxx.xxx.xxx.xxx:48894] PHP Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''c','r', `last_modified` = NOW() WHERE `id` IN ('9691','9692','9693','9694','969' at line 1 in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-mysqli.inc.php:788\nStack trace:\n#0 /usr/local/nagiosxi/html/db/adodb/drivers/adodb-mysqli.inc.php(788): mysqli_query()\n#1 /usr/local/nagiosxi/html/db/adodb/adodb.inc.php(1268): ADODB_mysqli->_query()\n#2 /usr/local/nagiosxi/html/db/adodb/adodb.inc.php(1246): ADOConnection->_Execute()\n#3 /usr/local/nagiosxi/html/includes/db.inc.php(569): ADOConnection->Execute()\n#4 /usr/local/nagiosxi/html/includes/components/bulkmodifications/bulkmodifications.inc.php(406): exec_sql_query()\n#5 /usr/local/nagiosxi/html/includes/components/bulkmodifications/step2.php(184): bmt_change_single_config_option()\n#6 /usr/local/nagiosxi/html/includes/components/bulkmodifications/step2.php(27): bmt_process_ccm_bulk_submission()\n#7 {main}\n thrown in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-mysqli.inc.php on line 788, referer: https://nagios.example.com/nagiosxi/inc ... ngleoption


I still think this part seems odd:

...for the right syntax to use near ''c','r',

I had critical, warning, and recovery selected...so where did the 'w' go? :?

I have about 1800~ services in this servicegroup and I don't believe I missed any trailing characters when I went through and corrected them. In fact, I've used the bulk modification tool to set them all to a single value, since it'll let me do that, to be sure. That worked fine, but switching back to w,c,r...no dice. Since you're unable to reproduce I'm fairly certain this is just some self-made hell I've gifted myself but thanks again for trying to reproduce it on your end.

Re: PHP error with bulk modification tool

Posted: Wed May 01, 2024 9:22 am
by sgardil
Have you tried running the db repair script yet? I dont know if it will fix your issue since it is giving syntax errors rather than general db errors but it might be worth a shot. If you do give it a try make sure to take a snapshot before running it just to be safe.

Code: Select all

./usr/local/nagiosxi/scripts/repair_databases.sh

Re: PHP error with bulk modification tool

Posted: Wed May 01, 2024 9:23 am
by gwesterman
Hi @naggyohs,

I am fairly certain this is a known bug that has been fixed in the next release. If you're comfortable modifying php files, you can try to fix it by changing lines 388 and 402 in nagiosxi/html/includes/components/bulkmodifications/bulkmodifications.php from "$value = escape_sql_string_array($opts_values['host'], DB_NAGIOSQL);" and "$value = escape_sql_string_array($opts_values['service'], DB_NAGIOSQL);" to:

Code: Select all

$value = escape_sql_param(implode(',', $opts_values['host']), DB_NAGIOSQL, true);
AND

Code: Select all

$value = escape_sql_param(implode(',', $opts_values['service']), DB_NAGIOSQL, true);
respectively.

Let us know if this works or not.

Thank you!

Re: PHP error with bulk modification tool

Posted: Thu May 30, 2024 9:26 am
by naggyohs
Hi @gwesterman,

I apologize for the delay on the response here, but thank you very much. That did indeed resolve my issue.

<3

Re: PHP error with bulk modification tool

Posted: Wed Jun 05, 2024 9:26 am
by gwesterman
Glad I could help!

Thank you!