Difference between revisions of "ZenDMD Tip - Check and Repair Device Objects with Missing DeviceClass"

From Zenoss Wiki
Jump to: navigation, search
m
 
Line 15: Line 15:
 
checkDeviceClass(d)
 
checkDeviceClass(d)
 
</syntaxhighlight>
 
</syntaxhighlight>
 
Best,
 
--Shane (Hackman238)
 
  
 
[[Category:Tips]]
 
[[Category:Tips]]
 
[[Category:ZenDMD]]
 
[[Category:ZenDMD]]

Latest revision as of 14:15, 20 November 2013

su zenoss, zendmd

def checkDeviceClass(d):
    print "Checking Device Class linkage for %s" % d.titleOrId()
    if d.deviceClass == None:
        dc = d.getPrimaryParent().getPrimaryParent()
        d.deviceClass._add(dc)

Usage:

d=dmd.Devices.findDevice('yourDevice')
checkDeviceClass(d)