Selecting a host device in System Utilities - View Data Query Cache raises error in cacti log

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

Moderators: Developers, Moderators

Post Reply
jab50
Posts: 13
Joined: Wed Aug 26, 2015 3:46 am

Selecting a host device in System Utilities - View Data Query Cache raises error in cacti log

Post by jab50 »

Ubuntu 22.04.3 LTS
cacti 1.2.24
cacti 1.2.25

From System utilities>>View Data Query Cache>>
Select a device from the device drop down box
An ERROR log message will now appear in the cacti log file as below
09-09-2023 21:11:27 - CMDPHP SQL Backtrace: (/utilities.php[51]:utilities_view_snmp_cache(), /utilities.php[1751]:db_fetch_assoc_prepared(), /lib/database.php[704]:db_execute_prepared())
09-09-2023 21:11:27 - CMDPHP ERROR: A DB Row Failed!, Error: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens

In the utilities.php[1751] file the host filtered query is

$snmp_queries = db_fetch_assoc_prepared("SELECT DISTINCT sq.id, sq.name
FROM host_snmp_cache AS hsc
INNER JOIN snmp_query AS sq
ON hsc.snmp_query_id=sq.id
INNER JOIN host AS h
ON hsc.host_id=h.id
ORDER by sq.name", array(get_request_var('host_id')));

The query is missing the WHERE clause
Changed to
utilities.php[1751]
$snmp_queries = db_fetch_assoc_prepared("SELECT DISTINCT sq.id, sq.name
FROM host_snmp_cache AS hsc
INNER JOIN snmp_query AS sq
ON hsc.snmp_query_id=sq.id
INNER JOIN host AS h
ON hsc.host_id=h.id
WHERE hsc.host_id = ?
ORDER by sq.name", array(get_request_var('host_id')));

Error is no longer logged

I first noticed this in V1.2.24, but as 1.2.25 has just been released I upgraded and same error was present.

Many regards for a great tool
John
User avatar
Osiris
Cacti Guru User
Posts: 1424
Joined: Mon Jan 05, 2015 10:10 am

Re: Selecting a host device in System Utilities - View Data Query Cache raises error in cacti log

Post by Osiris »

Can you please report this on GitHub?
Before history, there was a paradise, now dust.
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Selecting a host device in System Utilities - View Data Query Cache raises error in cacti log

Post by TheWitness »

Yea, please log this.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests