I've created a way to do a bulk update of name with a linux script.
First, get a csv of all devices in PRTG. (You need the device ID)
This can be done by using the api below
https://<servername or IP>/api/table.xml?content=devices&output=csvtable&columns=objid,probe,group,device,host,downsens,partialdownsens,downacksens,upsens,warnsens,pausedsens,unusualsens,undefinedsens&count=10000
Note: the count is 10,000. This will return 10,000 devices. Edit to fit needs.
Second, create a csv for your Linux script to use and save it as PRTGLIST.csv
- The format of the csv is <DeviceID>,<NewDeviceName>
- Remove the < and > from CSV
Below is an example
1234,Router1
1235,Router2
1236,Router3
Third, create a bash script with the following contents
#!/bin/bash
OLDIFS=$IFS
IFS=,
UNAME="INSERT USERNAME"
pass="INSERT PASSWORD"
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read PRTGID NEWNAME
do
curl -k "https://<server name or IP>/api/rename.htm?id=$PRTGID&value=$NEWNAME&username=$UNAME&password=$pass"
done < PRTGLIST.csv
IFS=$OLDIFS
Add comment