Difference between revisions of "List Device Data Points"

From Zenoss Wiki
Jump to: navigation, search
(formatting)
(List Device Data Points Using ZenDMD)
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
Below ZenDMD script would allow you to list Device Data points .
 
Below ZenDMD script would allow you to list Device Data points .
  
Steps to Run it :
+
Steps to Run it :<br />
<console>
+
hmod a+x ListDeviceDataPoints.py<br />
$ ##i##chmod a+x ListDeviceDataPoints.py
+
$ ##i##chown zenoss. ListDeviceDataPoints.py
+
$ ##i##python ListDeviceDataPoints.py > /tmp/datapoints.txt
+
</console>
+
  
 +
chown zenoss. ListDeviceDataPoints.py <br />
 +
python ListDeviceDataPoints.py > /tmp/datapoints.txt<br />
  
<syntaxhighlight lang=python>
 
import Globals
 
from Products.ZenUtils.ZCmdBase import ZCmdBase
 
dmd = ZCmdBase().dmd
 
counts = {}
 
for poll in dmd.Monitors.Performance.objectValues("PerformanceConf"):
 
    counts[poll.id] = {}
 
    for d in poll.devices():
 
        d = d.primaryAq()
 
        dc = d.deviceClass().primaryAq().getPrimaryId()[10:]
 
        if not counts[poll.id].has_key(dc):
 
        counts[poll.id][dc] = {'devices': 0, 'datapoints': 0}
 
        comps = d.getMonitoredComponents()
 
        datapoints = sum([comp.getRRDDataPoints() for comp in comps], []) + d.getRRDDataPoints()
 
        counts[poll.id][dc]['devices'] += 1
 
        counts[poll.id][dc]['datapoints'] += len(datapoints)
 
print(counts)
 
</syntaxhighlight>
 
  
Script can be downloaded from:
+
<br />
[https://github.com/hackeys/zenoss.git GitHub]
+
<br />
  
[[Category:Tips]]
+
:import Globals
 +
 
 +
:from Products.ZenUtils.ZCmdBase import ZCmdBase
 +
 
 +
:dmd = ZCmdBase().dmd
 +
 
 +
:
 +
 
 +
:
 +
 
 +
:counts = {}
 +
 
 +
:
 +
 
 +
:for poll in dmd.Monitors.Performance.objectValues("PerformanceConf"):
 +
 
 +
:    counts[poll.id] = {}
 +
 
 +
:
 +
 
 +
:    for d in poll.devices():
 +
 
 +
:
 +
 
 +
:        d = d.primaryAq()
 +
 
 +
:
 +
 
 +
:        dc = d.deviceClass().primaryAq().getPrimaryId()[10:]
 +
 
 +
:
 +
 
 +
:        if not counts[poll.id].has_key(dc):
 +
 
 +
:
 +
 
 +
:          counts[poll.id][dc] = {'devices': 0, 'datapoints': 0}
 +
 
 +
:
 +
 
 +
:        comps = d.getMonitoredComponents()
 +
 
 +
:
 +
 
 +
:        datapoints = sum([comp.getRRDDataPoints() for comp in comps], []) + d.getRRDDataPoints()
 +
 
 +
:
 +
 
 +
:        counts[poll.id][dc]['devices'] += 1
 +
 
 +
:
 +
 
 +
:        counts[poll.id][dc]['datapoints'] += len(datapoints)
 +
 
 +
:
 +
 
 +
:print(counts)
 +
 
 +
 
 +
Script can be downloaded from :
 +
https://github.com/hackeys/zenoss.git

Revision as of 16:53, 16 July 2013

Below ZenDMD script would allow you to list Device Data points .

Steps to Run it :
hmod a+x ListDeviceDataPoints.py

chown zenoss. ListDeviceDataPoints.py
python ListDeviceDataPoints.py > /tmp/datapoints.txt




import Globals
from Products.ZenUtils.ZCmdBase import ZCmdBase
dmd = ZCmdBase().dmd
counts = {}
for poll in dmd.Monitors.Performance.objectValues("PerformanceConf"):
counts[poll.id] = {}
for d in poll.devices():
d = d.primaryAq()
dc = d.deviceClass().primaryAq().getPrimaryId()[10:]
if not counts[poll.id].has_key(dc):
counts[poll.id][dc] = {'devices': 0, 'datapoints': 0}
comps = d.getMonitoredComponents()
datapoints = sum([comp.getRRDDataPoints() for comp in comps], []) + d.getRRDDataPoints()
counts[poll.id][dc]['devices'] += 1
counts[poll.id][dc]['datapoints'] += len(datapoints)
print(counts)


Script can be downloaded from : https://github.com/hackeys/zenoss.git