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

make limits in sensors a dynamic value?

Votes:

0

Hi I would like to know if you can make your warming limits change dynamically. Basically I have a sensor that shows me the temperature of a room. I also have another temperature that is not the REAL temperature of the room, but rather a reference of what that room should be (real tmp is 10, but reference tmp says it should be 8 for example).

These both temperatures i get them from a database by inputing their address in the database, so both temperatures i can get them okay. Now my question. Can I make that the limits warning in the real temperature sensor be the reference temperature? So I would have in the sensor: the real tmp (eg. 10ºC) and the limits would be smth like (min tmp :reference tmp - 2 and max tmp: reference tmp + 2) .

My sensors are Modbus TCP, and I think if done, it has to be with some API or smth but I´m a bit lost. But yeah, I want to make the limits a dynamic value that I could get from a database. Thanks!

api dynamic modbus prtg

Created on Feb 4, 2022 9:15:56 AM



3 Replies

Votes:

1

Hello Diego,

Thank you for your message.

Regarding what you would like to achieve, you indeed have to use the API of PRTG via a custom script as a scheduled task for example, which will get the reference temperature from the database (or from a sensor which has that value) and then execute the API calls to set the limits to the Modbus sensors.

In the current case, you need to use the following API calls:

  • Upper error limit
/api/setobjectproperty.htm?id=SENSORID&subtype=channel&subid=CHANNELID&name=limitmaxerror&value=VALUE&username=USERNAME&passhash=PASSHASH
  • Lower Error limit
/api/setobjectproperty.htm?id=SENSORID&subtype=channel&subid=CHANNELID&name=limitminerror&value=VALUE&username=USERNAME&passhash=PASSHASH

To get the value of an existing sensor, you can use the request below:

/api/table.json?content=channels&columns=objid,name,lastvalue&count=*&showhide=1&id=SENSORID&username=USERNAME&passhash=PASSHASH

If you have questions, do not hesitate.

Regards.

Created on Feb 8, 2022 2:21:41 PM by  Florian Lesage [Paessler Support]

Last change on Feb 8, 2022 2:21:52 PM by  Florian Lesage [Paessler Support]



Votes:

0

Hi, yes, it´s what I wanted to edit, and it works fine when calling that URL from the browser, now I´m trying to use cURL in php but i dont know why, its not working for me:

$cliente = curl_init();
curl_setopt($cliente, CURLOPT_URL, "https://xxxx/api/setobjectproperty.htm?id=2105&subtype=channel&subid=0&name=limitmaxerror&value=300&username=xxx&passhash=xxxx");
curl_setopt($cliente, CURLOPT_HEADER, 0);
curl_setopt($cliente, CURLOPT_RETURNTRANSFER, true); 

$contenido = curl_exec($cliente);
curl_close($cliente);

echo "$contenido";

The parameters are correct, I just used xxx for privacy purpouses, but in theory, this code should do it, it´s just the same that I use on my browser call, but it does nothing, it doesnt print me anything. What is happening?

Created on Feb 11, 2022 8:56:38 AM



Votes:

0

Hi Diego,

Thank you for your feedback.

Unfortunately, I can provide limited support only here regarding the script.

Nevertheless, to understand where the issue might comes from, I invite you to check the HTTP headers, response code and payload returned by PRTG when executing your code.

To do so, I would recommend to modify the script to return those information as well as check the webserver logs of PRTG which are located under <data folder>\Logs\webserver where <data folder> is the path displayed in PRTG Administration Tool > PRTG Core server (on the PRTG server). The files CoreWebServer.log and WebServer.log might contain indication about the issue.

Maybe someone with some experience with Curl can also help here?

Created on Feb 11, 2022 9:13:21 AM by  Florian Lesage [Paessler Support]

Last change on Feb 11, 2022 10:55:39 AM by  Florian Lesage [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.