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

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

Votes:

0

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

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



Best Answer

Accepted Answer

Votes:

1

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]

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



5 Replies

Votes:

0

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]

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



Votes:

2

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



Votes:

0

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



Accepted Answer

Votes:

1

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]

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



Votes:

0

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




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.