Is there a way to bulk rename devices from a Linux machine?
EDIT by Paessler: Former content moved to answer!


Article Comments

@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!


Sep, 2014 - Permalink

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

Sep, 2014 - Permalink

If curl doesn't work in your case (and it didn't in mine), you can substitute wget...

wget -q -O- --no-check-certificate


Jan, 2016 - Permalink