ZenDMD Tip - Quickly Audit Enterprise Collectors

From Zenoss Wiki
This is the approved revision of this page, as well as being the most recent.
Jump to: navigation, search

Ever need to quickly audit your collectors? If not, you will someday. Here's how.

Note: Uses organization of EnterpriseCollectors

Run the following in zendmd:

for hubObj in dmd.Monitors.Hub.getHubs():
    print "Hub " + hubObj.id
    for collectorObj in hubObj.collectors():
        print "    Collector " + collectorObj.id
        collectorDevices = collectorObj.getDevices()
        collectorDeviceComponents = []
        collectorComponents = 0
        collectorDatapoints = 0
        for collectorDeviceObj in collectorDevices:
            collectorDeviceComponents = collectorDeviceObj.getDeviceComponents()
            collectorComponents = collectorComponents + len(collectorDeviceComponents)
            collectorDatapoints = collectorDatapoints + len(collectorDeviceObj.getRRDDataPoints()) 
            for collectorDeviceComponentObj in collectorDeviceComponents:
                collectorDatapoints = collectorDatapoints + len(collectorDeviceComponentObj.getRRDDataPoints())
        print "        Devices " + str(len(collectorDevices))
        print "        Components " + str(collectorComponents)
        print "        Datapoints " + str(collectorDatapoints)