Skip to content

Instantly share code, notes, and snippets.

@cluther
Last active December 31, 2015 16:58
Show Gist options
  • Select an option

  • Save cluther/8016651 to your computer and use it in GitHub Desktop.

Select an option

Save cluther/8016651 to your computer and use it in GitHub Desktop.
Print CSV of device and production state for all devices with at least one JMX datasource bound to the device or a component thereof.
def jmx_datasources(thing):
for template in thing.getRRDTemplates():
for ds in template.datasources():
if ds.enabled and ds.sourcetype == 'JMX':
return True
return False
for device in dmd.Devices.getSubDevicesGen():
if any(map(jmx_datasources, [device] + device.getMonitoredComponents())):
print "{},{}".format(device.id, device.getProductionStateString())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment