Skip to content

Commit

Permalink
Add Zabbix helper for the *.counter.get method
Browse files Browse the repository at this point in the history
  • Loading branch information
root authored and root committed Feb 25, 2014
1 parent 4595235 commit bdc731d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/vpoller/helpers/zabbix.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ def run(self):
# Methods that the Helper knows about and how to process
methods = {
'host.get': self.zabbix_item_value,
'host.counter.get': self.zabbix_counter_value,
'datastore.get': self.zabbix_item_value,
'vm.get': self.zabbix_item_value,
'vm.counter.get': self.zabbix_counter_value,
'datacenter.get': self.zabbix_item_value,
'cluster.get': self.zabbix_item_value,
'host.discover': self.zabbix_lld_data,
Expand Down Expand Up @@ -96,6 +98,20 @@ def zabbix_item_value(self):

return self.data['result'][property_name]

def zabbix_counter_value(self):
"""
Processes a single counter value
The value we return is not for an instance,
so that each item in Zabbix stores a single property value.
Returns:
The counter value from the result message
"""
for v in self.data['result']:
if not v['instance']: return v['value']

def zabbix_lld_data(self):
"""
Translates a discovery request to Zabbix LLD format
Expand Down

0 comments on commit bdc731d

Please sign in to comment.