Automation Graph rule SQL error

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Moderators, Developers

Post Reply
Author
Message
penultimatum
Posts: 4
Joined: Wed Oct 02, 2019 5:19 am

Automation Graph rule SQL error

#1 Post by penultimatum » Wed Oct 02, 2019 6:07 am

Hi. I have just installed Cacti 1.2.6 on CentOS8 and have managed to add and poll a device so it generally seems to be working, but I am having an issue trying to setup Automation.

I am adding a new graph rule and the 1st issue is that when I change the Data Query to 'SNMP Interface Statistics' it just reverts to 'Cacti Stats - Data Collector Stats'. If I click create with that query I see the following error in cacti.log:

Code: Select all

2019/10/02 12:00:57 - CMDPHP ERROR: A DB Row Failed!, Error: 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 '|arg1:snmp_query_id| ORDER BY snmp_query_graph.name' at line 1
2019/10/02 12:00:57 - CMDPHP SQL Backtrace:  (/automation_graph_rules.php[79]:automation_graph_rules_edit(), /automation_graph_rules.php[608]:draw_edit_form(), /lib/html_form.php[114]:draw_edit_control(), /lib/html_form.php[280]:db_fetch_assoc(), /lib/database.php[452]:db_fetch_assoc_prepared(), /lib/database.php[466]:db_execute_prepared())
I can then change the query to 'SNMP - Interface Statistics' but do not get any options in the type drop down, and again see the error.

Code: Select all

2019/10/02 12:01:58 - CMDPHP ERROR: A DB Row Failed!, Error: 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 '|arg1:snmp_query_id| ORDER BY snmp_query_graph.name' at line 1
2019/10/02 12:01:58 - CMDPHP SQL Backtrace:  (/automation_graph_rules.php[79]:automation_graph_rules_edit(), /automation_graph_rules.php[608]:draw_edit_form(), /lib/html_form.php[114]:draw_edit_control(), /lib/html_form.php[280]:db_fetch_assoc(), /lib/database.php[452]:db_fetch_assoc_prepared(), /lib/database.php[466]:db_execute_prepared())
I have enabled logging in MySQL and I believe the SQL query that is failing is:

Code: Select all

SELECT snmp_query_graph.id, snmp_query_graph.name FROM snmp_query_graph WHERE snmp_query_graph.snmp_query_id=|arg1:snmp_query_id| ORDER BY snmp_query_graph.name
The server is a new CentOS8 with PHP 7.2 and MariaDB 10.3.11.

What can I do to fix this or debug further? Thanks!

penultimatum
Posts: 4
Joined: Wed Oct 02, 2019 5:19 am

Re: Automation Graph rule SQL error

#2 Post by penultimatum » Wed Oct 02, 2019 6:18 am

I enabled debugging for automation_graph_rules.php and tried to create an Automation graph rule with the name TestABC and query 'Cacti Stats - Data Collector Stats' and see the following additional info in the cacti.log

Code: Select all

2019/10/02 12:15:22 - DBCALL DEVEL: SQL Save on table 'automation_graph_rules': 'a:5:{s:2:"id";s:1:"0";s:4:"name";s:7:"testabc";s:13:"snmp_query_id";s:1:"1";s:13:"graph_type_id";i:0;s:7:"enabled";s:0:"";}'
2019/10/02 12:15:22 - DBCALL ERROR: A DB Row Failed!, Error: 1064, SQL: 'SELECT snmp_query_graph.id, snmp_query_graph.name FROM snmp_query_graph WHERE snmp_query_graph.snmp_query_id=|arg1:snmp_query_id| ORDER BY snmp_query_graph.name'
2019/10/02 12:15:22 - CMDPHP ERROR: A DB Row Failed!, Error: 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 '|arg1:snmp_query_id| ORDER BY snmp_query_graph.name' at line 1
2019/10/02 12:15:22 - CMDPHP SQL Backtrace:  (/automation_graph_rules.php[79]:automation_graph_rules_edit(), /automation_graph_rules.php[608]:draw_edit_form(), /lib/html_form.php[114]:draw_edit_control(), /lib/html_form.php[280]:db_fetch_assoc(), /lib/database.php[452]:db_fetch_assoc_prepared(), /lib/database.php[466]:db_execute_prepared())
Thanks.

penultimatum
Posts: 4
Joined: Wed Oct 02, 2019 5:19 am

Re: Automation Graph rule SQL error

#3 Post by penultimatum » Sun Oct 06, 2019 11:10 am

I manually installed 1.2.7 and the adding of rules seems to work now

Post Reply