Skip to content

Commit

Permalink
One list_queues run to collect all queue metrics.
Browse files Browse the repository at this point in the history
  • Loading branch information
cluther committed Sep 24, 2011
1 parent 1901147 commit 5e8b3be
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 19 deletions.
24 changes: 15 additions & 9 deletions ZenPacks/zenoss/RabbitMQ/objects/objects.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Monitors the status of a RabbitMQ node by running rabbitmqctl via SSH.
Monitors the status of a RabbitMQ node by running rabbitmqctl via SSH.
</property>
<property type="string" id="targetPythonClass" mode="w" >
ZenPacks.zenoss.RabbitMQ.RabbitMQNode.RabbitMQNode
ZenPacks.zenoss.RabbitMQ.RabbitMQNode
</property>
<tomanycont id='datasources'>
<object id='rabbitChannels' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'>
Expand Down Expand Up @@ -715,8 +715,14 @@ AVERAGE
</object>
<!-- ('', 'zport', 'dmd', 'Devices', 'rrdTemplates', 'RabbitMQQueue') -->
<object id='/zport/dmd/Devices/rrdTemplates/RabbitMQQueue' module='Products.ZenModel.RRDTemplate' class='RRDTemplate'>
<property id='zendoc' type='string'>
Monitors the status of a RabbitMQ queue by running rabbitmqctl via SSH.
</property>
<property type="text" id="description" mode="w" >
Monitors the status of a RabbitMQ queue by running rabbitmqctl via SSH.
</property>
<property type="string" id="targetPythonClass" mode="w" >
Products.ZenModel.Device
ZenPacks.zenoss.RabbitMQ.RabbitMQQueue
</property>
<tomanycont id='datasources'>
<object id='rabbitQueues' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'>
Expand Down Expand Up @@ -880,7 +886,7 @@ LINE
False
</property>
<property type="string" id="format" mode="w" >
%7.0lf%s
%7.0lf
</property>
<property type="string" id="legend" mode="w" >
${graphPoint/id}
Expand Down Expand Up @@ -937,7 +943,7 @@ AREA
False
</property>
<property type="string" id="format" mode="w" >
%7.2lf%s
%7.2lf
</property>
<property type="string" id="legend" mode="w" >
${graphPoint/id}
Expand Down Expand Up @@ -985,7 +991,7 @@ True
1
</property>
<property select_variable="lineTypes" type="selection" id="lineType" mode="w" >
AREA
LINE
</property>
<property type="long" id="lineWidth" mode="w" >
1
Expand All @@ -994,7 +1000,7 @@ AREA
False
</property>
<property type="string" id="format" mode="w" >
%7.1lf%s
%7.1lf
</property>
<property type="string" id="legend" mode="w" >
${graphPoint/id}
Expand Down Expand Up @@ -1023,7 +1029,7 @@ LINE
False
</property>
<property type="string" id="format" mode="w" >
%7.1lf%s
%7.1lf
</property>
<property type="string" id="legend" mode="w" >
${graphPoint/id}
Expand All @@ -1043,7 +1049,7 @@ AVERAGE
2
</property>
<property select_variable="lineTypes" type="selection" id="lineType" mode="w" >
AREA
LINE
</property>
<property type="long" id="lineWidth" mode="w" >
1
Expand All @@ -1052,7 +1058,7 @@ AREA
True
</property>
<property type="string" id="format" mode="w" >
%7.1lf%s
%7.1lf
</property>
<property type="string" id="legend" mode="w" >
${graphPoint/id}
Expand Down
22 changes: 12 additions & 10 deletions ZenPacks/zenoss/RabbitMQ/parsers/Node.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,14 @@ def processListQueuesResults(self, cmd, result):
if len(queues.keys()) < 1:
return

dp_map = dict([(dp.id, dp) for dp in cmd.points])

if cmd.component not in queues:
return

for field in (
'ready', 'unacknowledged', 'messages', 'consumers', 'memory'):
metrics = (
'ready', 'unacknowledged', 'messages', 'consumers', 'memory',
)

if field in dp_map:
for point in cmd.points:
if point.component in queues and point.id in metrics:
result.values.append((
dp_map[field], queues[cmd.component][field]))
point, queues[point.component][point.id]))

def isError(self, cmd, result):
match = re.search(r'^Error: (.+)$', cmd.result.output, re.MULTILINE)
Expand Down Expand Up @@ -258,7 +255,7 @@ def isError(self, cmd, result):

return False

def getEvent(self, cmd, summary, message=None, clear=False):
def getEvent(self, cmd, summary, message=None, component=None, clear=False):
event = dict(
summary=summary,
component=cmd.component,
Expand All @@ -269,6 +266,11 @@ def getEvent(self, cmd, summary, message=None, clear=False):
if message:
event['message'] = message

if component is None:
event['component'] = cmd.component
else:
event['component'] = component

if clear:
event['severity'] = 0
else:
Expand Down

0 comments on commit 5e8b3be

Please sign in to comment.