Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Report on Zenoss Data Points
#Report Datapoints Per Collector
from pprint import pprint
results = {"total_devices": 0, "total_datapoints": 0}
for monitor_name in dmd.Monitors.getPerformanceMonitorNames():
if monitor_name not in results:
results[monitor_name] = {}
monitor = dmd.Monitors.getPerformanceMonitor(monitor_name)
results[monitor_name]['device_count'] = len(monitor.getDevices())
results["total_devices"] += results[monitor_name]['device_count']
dp_count = 0
for dev in monitor.getDevices():
dp_count += len(dev.getRRDDataPoints())
for comp in dev.getDeviceComponents():
dp_count += len(comp.getRRDDataPoints())
results[monitor_name]['datapoint_count'] = dp_count
results["total_datapoints"] += dp_count
if dp_count is not 0 and results[monitor_name]['device_count'] is not 0:
results[monitor_name]['avg_dp_per_device'] = ( results[monitor_name]['datapoint_count'] / results[monitor_name]['device_count'])
print "Total Devices: {0}".format(results["total_devices"])
print "Total Datapoints: {0}".format(results["total_datapoints"])
print "Average Datapoints Per Device: {0}".format(results["total_datapoints"] / results["total_devices"])
pprint(results)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.