ZenDMD Tip - Set Titles via Reverse Lookup (PTR record)
The following code will iterate through all devices and perform a reverse lookup of the proper hostname. If the device's title attribute doesn't match the hostname returned by DNS it'll update it.
Set makeChanges = True if the script does what you expect.
debugIt = True makeChanges = False for d in dmd.Devices.getSubDevices(): sync() hostname = socket.gethostbyaddr(d.manageIp) if d.titleOrId() != hostname or debugIt == True: print "Device IP: " + str(d.manageIp) print "Device current ID: " + str(d.titleOrId()) print "Device new ID: " + str(hostname) if makeChanges == True: d.setTitle(str(hostname)) print 'ID to: ' + str(hostname) commit() else: print 'ID to: Unchanged' print '-'*80