本文整理汇总了Python中Products.ZenUtils.ZenScriptBase.ZenScriptBase.getDmdRoot方法的典型用法代码示例。如果您正苦于以下问题:Python ZenScriptBase.getDmdRoot方法的具体用法?Python ZenScriptBase.getDmdRoot怎么用?Python ZenScriptBase.getDmdRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products.ZenUtils.ZenScriptBase.ZenScriptBase
的用法示例。
在下文中一共展示了ZenScriptBase.getDmdRoot方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: traverse
# 需要导入模块: from Products.ZenUtils.ZenScriptBase import ZenScriptBase [as 别名]
# 或者: from Products.ZenUtils.ZenScriptBase.ZenScriptBase import getDmdRoot [as 别名]
def traverse(dc, of):
dclist.append(dc)
for subdc in dc.children():
traverse.level +=1
traverse(subdc, of)
traverse.level -=1
return dclist.sort()
def printTree(dclist, of):
newdclist = sorted(dclist, key=lambda p: p.getOrganizerName() )
for mo in newdclist:
of.write('Mib Organizer %s \n' % (mo.getOrganizerName()))
of.write(' Mibs: ')
miblist=[]
for m in mo.mibs():
miblist.append(m.id)
# Need to get a sorted list of mibs
miblist.sort()
for m in miblist:
of.write(' %s ,' % (m))
of.write('\n\n')
traverse.level = 1
root = dmd.getDmdRoot('Mibs')
traverse(root, of)
printTree(dclist, of)
of.close()
示例2: printTree
# 需要导入模块: from Products.ZenUtils.ZenScriptBase import ZenScriptBase [as 别名]
# 或者: from Products.ZenUtils.ZenScriptBase.ZenScriptBase import getDmdRoot [as 别名]
def printTree(dclist, of):
# First sort the event classes by path name
listNames=[]
for dc in dclist:
listNames.append(dc.getOrganizerName())
listNames.sort()
for dcname in listNames:
dc=root.getOrganizer(dcname)
of.write('Event class %s \n' % (dc.getOrganizerName()))
of.write(' Event Instances (mappings): ')
maplist=[]
for mi in dc.instances():
if not mi.regex:
mi.regex = 'None'
tup = ( mi.id, mi.regex )
maplist.append(tup)
# Need to get a sorted list of mappings
maplist.sort()
for map in maplist:
of.write(' Mapping instance %s , has regex %s' % (map[0], map[1]))
of.write('\n\n')
traverse.level = 1
root = dmd.getDmdRoot('Events')
traverse(root, of)
printTree(dclist, of)
of.close()
示例3: printTree
# 需要导入模块: from Products.ZenUtils.ZenScriptBase import ZenScriptBase [as 别名]
# 或者: from Products.ZenUtils.ZenScriptBase.ZenScriptBase import getDmdRoot [as 别名]
def printTree(dclist, of):
# First sort the systems by path name
listNames=[]
for dc in dclist:
listNames.append(dc.getOrganizerName())
listNames.sort()
for dcname in listNames:
dc=root.getOrganizer(dcname)
of.write('System %s \n' % (dc.getOrganizerName()))
of.write(' Devices: for system %s ' % (dc.getOrganizerName()))
devlist=[]
for d in dc.getSubDevices():
devlist.append(d.id)
# Need to get a sorted list of devices
devlist.sort()
for dev in devlist:
d=dmd.Devices.findDevice(dev)
of.write(' %s ,' % (d.id))
of.write('\n\n')
traverse.level = 1
root = dmd.getDmdRoot('Systems')
rigSys = dmd.Systems.RIGS.MWIRE
traverse(rigSys, of)
printTree(dclist, of)
of.close()
示例4: open
# 需要导入模块: from Products.ZenUtils.ZenScriptBase import ZenScriptBase [as 别名]
# 或者: from Products.ZenUtils.ZenScriptBase.ZenScriptBase import getDmdRoot [as 别名]
sys.exit()
of = open(options.outputFile, "w")
localtime = time.asctime( time.localtime(time.time()) )
of.write(localtime + "\n")
# Need noopts=True or it barfs with the script options
dmd = ZenScriptBase(connect=True, noopts=True).dmd
colList=[]
for c in dmd.Monitors.getPerformanceMonitorNames():
colList.append(c)
colList.sort()
for c in colList:
of.write(' Collector %s \n\n' % (c))
of.write(' Devices for Collector %s: ' % (c) )
m = dmd.getDmdRoot('Monitors').getPerformanceMonitor(c)
devlist=[]
for d in m.devices():
devlist.append(d.id)
devlist.sort()
for dev in devlist:
d=dmd.Devices.findDevice(dev)
of.write(' %s ,' % (d.id))
of.write('\n\n')
of.close()
示例5: printTree
# 需要导入模块: from Products.ZenUtils.ZenScriptBase import ZenScriptBase [as 别名]
# 或者: from Products.ZenUtils.ZenScriptBase.ZenScriptBase import getDmdRoot [as 别名]
return dclist.sort()
def printTree(dclist, of):
# First sort the device classes by path name
listNames=[]
for dc in dclist:
listNames.append(dc.getOrganizerName())
listNames.sort()
for dcname in listNames:
dc=root.getOrganizer(dcname)
of.write('Location %s \n' % (dc.getOrganizerName()))
of.write(' Devices for location %s : ' % (dc.getOrganizerName()))
devlist=[]
for d in dc.getSubDevices():
devlist.append(d.id)
# Need to get a sorted list of devices
devlist.sort()
for dev in devlist:
d=dmd.Devices.findDevice(dev)
of.write(' %s ,' % (d.id))
of.write('\n\n')
traverse.level = 1
root = dmd.getDmdRoot('Locations')
traverse(root, of)
printTree(dclist, of)
of.close()
示例6: printTree
# 需要导入模块: from Products.ZenUtils.ZenScriptBase import ZenScriptBase [as 别名]
# 或者: from Products.ZenUtils.ZenScriptBase.ZenScriptBase import getDmdRoot [as 别名]
return dclist.sort()
def printTree(dclist, of):
# First sort the device classes by path name
listNames=[]
for dc in dclist:
listNames.append(dc.getOrganizerName())
listNames.sort()
for dcname in listNames:
dc=root.getOrganizer(dcname)
of.write('Device class %s \n' % (dc.getOrganizerName()))
of.write(' Devices for device class %s : ' % (dc.getOrganizerName()))
devlist=[]
for d in dc.getSubDevices():
devlist.append(d.id)
# Need to get a sorted list of devices
devlist.sort()
for dev in devlist:
d=dmd.Devices.findDevice(dev)
of.write(' %s ,' % (d.id))
of.write('\n\n')
traverse.level = 1
root = dmd.getDmdRoot('Devices')
traverse(root, of)
printTree(dclist, of)
of.close()