What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

MySQL V2 Fatal Error

Votes:

0

Hello.

I need to create a sensor retrieving data from a MySQL database, but the table name is dynmaic. So i have to use a Prepared Statement to produce the query string first As in:

SET @c = '131';
SET @tb = CONCAT('hist_',YEAR(CURDATE()), LPAD(MONTH(CURDATE()),2,0));
SET @s = CONCAT('select truncate(sum(stime)/60,0) as min from ', @tb, ' where c_id=',@c,' and `time` > CURDATE()'); 
PREPARE stmt1 FROM @s; 
EXECUTE stmt1; 
DEALLOCATE PREPARE stmt1;

But I only get "Fatal Error encountered during command execution". I tried thru the gui from SQL_V2.exe, same result.

Can someone point me to the right direction i should take to make this work? Thank you very much.

custom-sensor mysql mysql-v2-sensor

Created on May 12, 2016 6:46:46 PM

Last change on Aug 1, 2016 11:08:25 AM by  Luciano Lingnau [Paessler]



3 Replies

Votes:

0

Dear edm09

While this could be a valid SQL statement, the code injection protection we use via Dotnet catches the EXECUTE command and prevents the execution. I am sorry, there is no way around this.

Created on May 13, 2016 12:43:16 PM by  Arne Seifert [Paessler Support]



Votes:

0

Thanks.

I'll try to wrap it on a procedure and just call the proc, this should work right?

Created on May 13, 2016 12:48:35 PM



Votes:

0

Dear edm09

That should work.

Created on May 13, 2016 2:44:54 PM by  Arne Seifert [Paessler Support]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.