ZenDMD Tip - Rename Devices
From Zenoss Wiki
Revision as of 18:41, 9 October 2012 by Rmatte $7
The following is a zendmd script to rename devices to what is set as the SNMP system name.
It could be easily modified to set it in other ways.
baseUrl = 'http://admin:YourPassword@localhost:8180' for d in dmd.Devices.getSubDevices(): if d.snmpSysName: try: oldname = d.id newname = d.snmpSysName if newname != oldname: devpath = d.getPrimaryUrlPath() print "Renaming %s to %s" % (oldname, newname) url = '/'.join([baseUrl, devpath]) serv = ServerProxy( url ) serv.renameDevice(newname) sync() commit() sync() except: pass