Skip to content

Commit bdc731d

Browse files
rootroot
root
authored and
root
committedFeb 25, 2014
Add Zabbix helper for the *.counter.get method
1 parent 4595235 commit bdc731d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
 

‎src/vpoller/helpers/zabbix.py

+16
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ def run(self):
6666
# Methods that the Helper knows about and how to process
6767
methods = {
6868
'host.get': self.zabbix_item_value,
69+
'host.counter.get': self.zabbix_counter_value,
6970
'datastore.get': self.zabbix_item_value,
7071
'vm.get': self.zabbix_item_value,
72+
'vm.counter.get': self.zabbix_counter_value,
7173
'datacenter.get': self.zabbix_item_value,
7274
'cluster.get': self.zabbix_item_value,
7375
'host.discover': self.zabbix_lld_data,
@@ -96,6 +98,20 @@ def zabbix_item_value(self):
9698

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

101+
def zabbix_counter_value(self):
102+
"""
103+
Processes a single counter value
104+
105+
The value we return is not for an instance,
106+
so that each item in Zabbix stores a single property value.
107+
108+
Returns:
109+
The counter value from the result message
110+
111+
"""
112+
for v in self.data['result']:
113+
if not v['instance']: return v['value']
114+
99115
def zabbix_lld_data(self):
100116
"""
101117
Translates a discovery request to Zabbix LLD format

0 commit comments

Comments
 (0)
Please sign in to comment.