Skip to content

Commit

Permalink
Zabbix vPoller Helper: Use the full method name when constructing the
Browse files Browse the repository at this point in the history
macros, without including the last part of the name (like '.get' and '.discover')
  • Loading branch information
dnaeon committed Sep 13, 2014
1 parent 018ae6a commit 9526251
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/vpoller/helpers/zabbix.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,17 @@ def zabbix_lld_data(self):
{#VSPHERE.<TYPE>.<ATTRIBUTE>}: <value>
"""
obj_t = self.method.split('.')[0].upper()
# Get the vPoller method name without the last part of it,
# which is usually the operation performed like '.get' and
# '.discover'. From that method name construct the macro
# which will be used in Zabbix.
m = self.method.split('.')[:-1]
method_name = '.'.join(m).upper()
result = self.data['result']

data = []
for item in result:
props = [('{#VSPHERE.' + obj_t + '.' + k.upper() + '}', v) for k, v in item.items()]
props = [('{#VSPHERE.' + method_name + '.' + k.upper() + '}', v) for k, v in item.items()]
data.append(dict(props))

return {'data': data}

0 comments on commit 9526251

Please sign in to comment.