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

prtg receive data from custom agent

Votes:

0

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.

agent http https

Created on Sep 19, 2018 9:03:30 AM



Best Answer

Accepted Answer

Votes:

1

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 

Created on Sep 20, 2018 4:31:08 PM by  Arne Seifert [Paessler Support]



5 Replies

Votes:

0

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.

Created on Sep 19, 2018 2:32:55 PM by  Arne Seifert [Paessler Support]



Votes:

0

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

Created on Sep 20, 2018 6:30:42 AM



Accepted Answer

Votes:

1

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 

Created on Sep 20, 2018 4:31:08 PM by  Arne Seifert [Paessler Support]



Votes:

0

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?

Created on Sep 25, 2018 2:31:14 AM



Votes:

1

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.

Created on Sep 25, 2018 1:29:42 PM by  Arne Seifert [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.