New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Could not convert variant of type (UnicodeString) into type (Double)

Votes:

0

Your Vote:

Up

Down

Hi,

I tried to monitor the Uptime of a MySQL Database. So I typed

'Show status like 'Uptime'

into the query. If I'm correct it should show me the uptime in minutes or seconds. But I get the error Message

'Could not convert variant of type (UnicodeString) into type (Double)'

What did I do wrong?

regards

error mysql query

Created on Jul 29, 2015 9:30:56 AM by  Goebel (90) 2 2

Last change on Jul 29, 2015 10:43:03 AM by  Luciano Lingnau [Paessler Support]



Best Answer

Accepted Answer

Votes:

1

Your Vote:

Up

Down

Hello Goebel,
As PRTGToolsFamily confirmed/pointed out, that query outputs more than a single value, PRTG will only receive a single value as query result, since the query returns the variable name column too, that causes the sensor to go into error.

Your current query would be equivalent to this:

SELECT * FROM information_schema.`GLOBAL_STATUS`
WHERE VARIABLE_NAME IN ('UPTIME')

But as documented in the Sensor's manual page:

Enter a valid SQL statement to execute on the server. In your SELECT statement, please specify the field name explicitly. Do not use SELECT *! For example, a correct expression could be: SELECT AVG(UnitPrice) FROM Products.

Consider using something like this in the sensor instead:

SELECT VARIABLE_VALUE FROM information_schema.`GLOBAL_STATUS`
WHERE VARIABLE_NAME IN ('UPTIME')

That will return only:

1592

Created on Jul 29, 2015 1:50:58 PM by  Luciano Lingnau [Paessler Support]

Last change on Jul 29, 2015 3:12:33 PM by  Luciano Lingnau [Paessler Support]



5 Replies

Votes:

0

Your Vote:

Up

Down

Hello Goebel, we appreciate your inquiry.

Could you please provide us the output of the actual command when you run it within the MySQL Workbench?

Created on Jul 29, 2015 10:45:17 AM by  Luciano Lingnau [Paessler Support]

Last change on Jul 29, 2015 10:45:29 AM by  Luciano Lingnau [Paessler Support]



Votes:

2

Your Vote:

Up

Down

Your MySQL query returns something like

+---------------+--------+
| Variable_name | Value  |
+---------------+--------+
| Uptime        | 322477 |
+---------------+--------+

The sensor sees the 'Uptime' string and tries to convert it to a numeric value.

So, your query should only return the numeric value 322477

Created on Jul 29, 2015 10:59:16 AM by  PRTGToolsFamily [prtgtoolsfamily.com] (12,665) 3 4



Votes:

0

Your Vote:

Up

Down

Hello Luciano Lingnau,

the actual command is, like I said : SHOW STATUS LIKE 'Uptime' and the Output that PRTG gives me is : Could not perform query: Could not convert variant of type(UnicodeString) into the type (Double)

If I analyze a string its ok, but thats not what I want..

Created on Jul 29, 2015 12:50:45 PM by  Goebel (90) 2 2



Accepted Answer

Votes:

1

Your Vote:

Up

Down

Hello Goebel,
As PRTGToolsFamily confirmed/pointed out, that query outputs more than a single value, PRTG will only receive a single value as query result, since the query returns the variable name column too, that causes the sensor to go into error.

Your current query would be equivalent to this:

SELECT * FROM information_schema.`GLOBAL_STATUS`
WHERE VARIABLE_NAME IN ('UPTIME')

But as documented in the Sensor's manual page:

Enter a valid SQL statement to execute on the server. In your SELECT statement, please specify the field name explicitly. Do not use SELECT *! For example, a correct expression could be: SELECT AVG(UnitPrice) FROM Products.

Consider using something like this in the sensor instead:

SELECT VARIABLE_VALUE FROM information_schema.`GLOBAL_STATUS`
WHERE VARIABLE_NAME IN ('UPTIME')

That will return only:

1592

Created on Jul 29, 2015 1:50:58 PM by  Luciano Lingnau [Paessler Support]

Last change on Jul 29, 2015 3:12:33 PM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hello,

I got what you said. That statement works fine now. 12.800.000 Seconds are great to deal with. Guess working out how to reduce that number to days won't take much longer.

Thank you very much for your help.

regeards

Created on Jul 29, 2015 2:07:51 PM by  Goebel (90) 2 2



Please log in or register to enter your reply.


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.