hi Paessler,

did prtg can receive/read data from the custom agent via http? the agent will collect data like cpu, memory and disk status and sent it to prtg via http. the agent was created using php.


Article Comments

Dear Dean,

yes, PRTG can receive data via HTTP using the HTTP Push Data Advanced sensor. This sensor expects an XML or JSON adhering to the PRTG custom sensor API definition. For single-channel sensors, the simpler |HTTP Push Data sensor is available. This one does not need a HTTP POST, a HTTP URL is enough.


Sep, 2018 - Permalink

so what i need to do, in my agent php code need to follow json format as in PRTG custom sensor API definition right?


Sep, 2018 - Permalink

Dear Dean,

yes. PRTG of course does not care how, or by which tool the data is generated. Here is a very simple Powershell example

$postParams = '{"prtg": {"text": "This sensor is added to 127.0.0.1", "result": [{"LimitMode": 1, "Value": 87, "LimitMinError": 10, "LimitErrorMsg": "Percentage too high", "Channel": "Percentage", "LimitMaxError": 90, "Unit": "Percent"}, {"Channel": "Response Time", "Unit": "TimeResponse", "Value": 4711}]}}'
Invoke-WebRequest -Uri http://10.49.18.119:5051/mysensortoken -Method POST -ContentType application/json -Body $postParams 

Sep, 2018 - Permalink

great...its working.

one more thing, did prtg can get the ip address that carry by custom agent? it like when user install the agent on their machine and the prtg receive the details of machine and add machine on monitoring?


Sep, 2018 - Permalink

That cannot be automated so easily. In principle you could write a maintenance script which uses the PRTG API to clone a HTTP Push Data sensor, changes its properties and starts it so it can be used as new sensor.

This requires some knowledge about the PRTG API, though, since port and/or token have to be changed.


Sep, 2018 - Permalink