Is there a way to bulk rename devices from a Linux machine?
EDIT by Paessler: Former content moved to answer!
How to bulk update device name with linux
Votes:
0
Best Answer
Votes:
1
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
Created on Sep 3, 2014 2:07:25 AM
Last change on Sep 3, 2014 6:34:16 AM by
Konstantin Wolff [Paessler Support]
3 Replies
Votes:
0
@jlenhart: Thank you very much for sharing your thoughts. If possible would you post your post again as answer to this as done here.
This would allow other users to choose a best answer as well as upvote your answer. Thanks again for sharing!
Votes:
1
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
Created on Sep 3, 2014 2:07:25 AM
Last change on Sep 3, 2014 6:34:16 AM by
Konstantin Wolff [Paessler Support]
Votes:
0
If curl doesn't work in your case (and it didn't in mine), you can substitute wget...
wget -q -O- --no-check-certificate
Add comment