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


Mass-Delete Comments?

Votes:

0

Your Vote:

Up

Down

Hi,

PRTG sometimes sets a comment on a device automatically. I did'n knew that. And now, after i cloned many many devices, i have many comments in that devices not showing correct Content. Because i don't use the "Comments" at the Moment, it would be great if i could delete/wipe all comments from devices/sensors.

Is there a way i can do that without clicking in every device (500+) and remove the comment manualy?

Thanks.

comments devices sensors

Created on Nov 29, 2018 2:27:49 PM by  MatthewIT (0) 1



1 Reply

Votes:

0

Your Vote:

Up

Down

Hi there,

I adapted an existing script that I had laying around. This will gather a list of sensors, then delete the comments for all sensors, then get a list for devices and delete the comments there as well.

To use it, please change the parameters in the first three lines of the script:

  • $username = username of an administrative user within PRTG
  • $passhash = passhash of that user (Setup > System Administration > User Accounts > USER > Show Passhash)
  • $prtgserver = URL of your PRTG Server (e.g. "https://mycoolprtgserver")
$username = "prtgadmin"
$passhash = "1278894095"
$prtgserver = "http://mycoolprtgserver"
$conerror = "0" # DO NOT CHANGE!

# Check URL
$prtgserverlength = $prtgserver.Length - 1
$prtgserverlastch = $prtgserver.Substring($prtgserverlength)
if ($prtgserverlastch -eq "/"){
$prtgserver = $prtgserver.Substring(0,$prtgserver.Length - 1)
} 

# Check connectivity
try{
$conurl = [String]::Format("{0}/api/table.json?content=sensors&columns=objid,name&username={1}&passhash={2}",$prtgserver,$username,$passhash)
Invoke-WebRequest -Uri $conurl | Out-Null
} catch {
$conerror = "1"
Write-Host "Something went wrong. Please check the parameters above. :("
}

if($conerror -eq "0"){

# Sensors
Write-Host "Delete Comments for Sensors:"

# Get Sensors
$sensorsurl = [String]::Format("{0}/api/table.json?content=sensors&columns=objid,name&username={1}&passhash={2}",$prtgserver,$username,$passhash)
$sensorids = Invoke-WebRequest $sensorsurl -UseBasicParsing | ConvertFrom-JSON | Select -expand sensors

# Get Inherit or Not Sensors
foreach($sensorid in $sensorids.objid) {
    $inheriturl = [String]::Format("{0}/editsettings?id={1}&comments_=&username={2}&passhash={3}",$prtgserver,$sensorid,$username,$passhash)
    $inheritsite = Invoke-WebRequest $inheriturl -UseBasicParsing
    Write-Host "Comment deleted for Sensor-ID: " -NoNewline
    Write-Host "$($sensorid)" -foreground Red 
}

# Devices
Write-Host " " 
Write-Host "Delete Comments for Devices:"

# Get Devices
$devicesurl = [String]::Format("{0}/api/table.json?content=devices&columns=objid,name&username={1}&passhash={2}",$prtgserver,$username,$passhash)
$deviceids = Invoke-WebRequest $devicesurl -UseBasicParsing | ConvertFrom-JSON | Select -expand devices

# Get Inherit or Not Devices
foreach($deviceid in $deviceids.objid) {
    $inheriturl = [String]::Format("{0}/editsettings?id={1}&comments_=&username={2}&passhash={3}",$prtgserver,$deviceid,$username,$passhash)
    $inheritsite = Invoke-WebRequest $inheriturl -UseBasicParsing
    Write-Host "Comment deleted for Device-ID: " -NoNewline
    Write-Host "$($deviceid)" -foreground Red
}

}


Best regards.

Created on Nov 30, 2018 10:07:27 AM by  Dariusz Gorka [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.