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

C# int value too large for int32



I have a custom .net c# executable that I created and it uses command line switches to retrieve different metric values from MSSQL and sends them back to PRTG. I use this to monitor my production MSSQL db performance. It all works well on my test server and returns valid values with valid exit codes. It all works well on my production server as well.

There is only one value that it does not work with in production and PRTG complains that the value for for the variable is too large and it can not handle it... Error is as follows:

Protocol Error: Value was either too large or too small for an Int32. at System.Convert.ToInt32(Int64 value) at System.Int64.System.IConvertible.ToInt32(IFormatProvider provider) at System.Convert.ToInt32(Object value) at SQLmetrics.SQL.SQLquery(String a (code: PE023)

As far as I know PRTG can only handle Long(float) and int32, anything else is a no no. I tried 64 as well and it doesn't handle that well either. Anyone know of a solution to get around this?

c# int value-too-large

Created on Jul 31, 2017 10:34:36 PM

3 Replies

Accepted Answer



Hello there,

Have you tried achieving the same with our MS SQL V2 sensor? Give it a try and see how that goes.

See also: Configuration of SQL v2 Sensors.

Kind regards,


Created on Aug 1, 2017 11:40:20 AM by  Erhard Mikulik [Paessler Support]



One addition regarding "As far as I know PRTG can only handle Long(float) and int32, anything else is a no no": Devs told me that PRTG calculates internally using Int64, so we assume the error is in the script itself somewhere. It should not happen when you use for example the aforementioned SQL sensor.

Kind regards,


Created on Aug 1, 2017 1:08:40 PM by  Erhard Mikulik [Paessler Support]



Erhard, Yes the problem is with PRTG, because it can not accept anything larger than 32 bit. This is not an issue in my test environment and the script reports the right values. My database is enormous and even working with 64bit inside the script PRTG complains about the intiger being 64 and not 32. So while PRTG may internally be working with 64 bit intigers, it will not accept these values from the script. I will try the SQL v2 sensor.

Created on Aug 1, 2017 3:28:35 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.