New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


API, filter by tags

Votes:

0

Your Vote:

Up

Down

Is there a way using the API to set a number of sensors to resume using their tags?

api sensors tags

Created on Aug 7, 2018 1:51:03 PM by  Niclas Lundin (0) 1



2 Replies

Votes:

0

Your Vote:

Up

Down

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:

/api/table.xml?content=sensors&columns=objid,name&count=*&filter_tags=@tag(pingsensor)

2) Iterate over each objid and trigger the resume call for each ID (one API call for each sensor)

/api/pause.htm?id=2123&action=1

Replace the example objid of 2123 with a real objid, extracted by the former API call.

(Yes, the resume call uses /api/pause.htm.)

Created on Aug 7, 2018 8:50:01 PM by  Arne Seifert [Paessler Support]

Last change on Sep 7, 2018 10:32:00 AM by  Sebastian Kniege [Paessler Support]



Votes:

0

Your Vote:

Up

Down

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" 
    
}

Created on Aug 8, 2018 7:44:57 AM by  Niclas Lundin (0) 1

Last change on Aug 8, 2018 3:24:44 PM by  Arne Seifert [Paessler Support]



Please log in or register to enter your reply.


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.