Is there a way using the API to set a number of sensors to resume using their tags?
Article Comments
Thank you for the quick answer. A quick and easy PS script later and the sensors will be resumed.
Script below for those who are looking for the same thing.
$xmlURL = "https://<URL TO PRTG SERVER>/api/table.xml?content=sensors&columns=objid,name&count=*&filter_tags=<Tag you are looking for>0&username=<USERNAME>&passhash=<PASSHASH>"
(New-Object System.Net.WebClient).DownloadFile($xmlURL,'c:\temp\sensors.xml')
$sensors = [xml](Get-Content 'c:\temp\sensors.xml')
foreach ($sensorID in $sensors.sensors.item.objid) {
$response = Invoke-WebRequest -Uri "https://<URL TO PRTG SERVER>/api/pause.htm?id=$sensorID &action=1&username=<USERNAME>&passhash=<PASSHASH>"
write-host "Resumed $sensorID"
}
Aug, 2018 - Permalink
Dear MEAB_niclas,
yes, but the process is quite complex. Please understand that we have the API documentation with this and this page of special interest for you.
Here is a more detailed outline for your question.
1) Generate a list of sensors by tag:
2) Iterate over each objid and trigger the resume call for each ID (one API call for each sensor)
Replace the example objid of 2123 with a real objid, extracted by the former API call.
(Yes, the resume call uses /api/pause.htm.)
Aug, 2018 - Permalink