Skip to content

Error with automation on automation_graph_rules #6516

@arno-st

Description

@arno-st

The issue appear when you select an automation graph rule filter, it will generate this following error: (the output is based on cacti 1.2-x branch, and 1.2.30)

06/01/2026  10:34:18 - CMDPHP SQL Backtrace:   (/automation_graph_rules.php[84]:automation_graph_rules(),  /automation_graph_rules.php[899]:db_fetch_cell(),  /lib/database.php[637]:db_fetch_cell_prepared(),  /lib/database.php[659]:db_execute_prepared())
--
06/01/2026 10:34:18 - CMDPHP ERROR: A DB Cell Failed!, Error: Unknown column 'sqg.name' in 'WHERE'
06/01/2026 10:34:18 - DBCALL ERROR: A DB Cell Failed!, Error: 1054,  SQL: 'SELECT COUNT(agr.id) FROM automation_graph_rules AS agr LEFT JOIN  snmp_query AS sq ON (agr.snmp_query_id=sq.id) WHERE (agr.name LIKE  '%ACI%' OR sqg.name LIKE '%ACI%' OR sq.name LIKE '%ACI%')'

In the code I was able to pin point this:
Branch Cacti 1.2.x
automation_graph_rules.php
the creation of $sql_where on line 877 to 883 is refering to a table name sqg
This $sql_where is used on line 907 to ccount the number of row. But on this sql Query the sqg (alias of snmp_query_graph is not decleread, instead of the line 917.

Branch develop
The same issue should be present but on line 938 with a usage on line 960.

To solve this issue the following to line can be added into the sql Query:
LEFT JOIN snmp_query_graph AS sqg
ON (agr.graph_type_id=sqg.id)

I did the test only on version 1.2.x, but it should be ok for the develop branch.

Metadata

Metadata

Labels

bugUndesired behaviourresolvedA fixed issueunverifiedSome days we don't have a clue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions