summaryrefslogtreecommitdiffstats
path: root/roles/lib_zabbix/library
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2015-11-17 11:24:33 -0500
committerKenny Woodson <kwoodson@redhat.com>2015-11-17 11:25:50 -0500
commit0b28d6dffa4680cb7fe022aecfa664ec5e00f2ff (patch)
tree97d010306723cf9455f1bf17101389813b173f19 /roles/lib_zabbix/library
parent6b9e41faa8bfa9da3df18f390c42ff9c740c9a09 (diff)
downloadopenshift-0b28d6dffa4680cb7fe022aecfa664ec5e00f2ff.tar.gz
openshift-0b28d6dffa4680cb7fe022aecfa664ec5e00f2ff.tar.bz2
openshift-0b28d6dffa4680cb7fe022aecfa664ec5e00f2ff.tar.xz
openshift-0b28d6dffa4680cb7fe022aecfa664ec5e00f2ff.zip
Updating zbx_item classes to support data types for bool.
Diffstat (limited to 'roles/lib_zabbix/library')
-rw-r--r--roles/lib_zabbix/library/zbx_item.py20
-rw-r--r--roles/lib_zabbix/library/zbx_itemprototype.py20
2 files changed, 40 insertions, 0 deletions
diff --git a/roles/lib_zabbix/library/zbx_item.py b/roles/lib_zabbix/library/zbx_item.py
index 5dc3cff9b..996c98fae 100644
--- a/roles/lib_zabbix/library/zbx_item.py
+++ b/roles/lib_zabbix/library/zbx_item.py
@@ -41,6 +41,24 @@ def exists(content, key='result'):
return True
+def get_data_type(data_type):
+ '''
+ Possible values:
+ 0 - decimal;
+ 1 - octal;
+ 2 - hexadecimal;
+ 3 - bool;
+ '''
+ vtype = 0
+ if 'octal' in data_type:
+ vtype = 1
+ elif 'hexadecimal' in data_type:
+ vtype = 2
+ elif 'bool' in data_type:
+ vtype = 3
+
+ return vtype
+
def get_value_type(value_type):
'''
Possible values:
@@ -158,6 +176,7 @@ def main():
template_name=dict(default=None, type='str'),
zabbix_type=dict(default='trapper', type='str'),
value_type=dict(default='int', type='str'),
+ data_type=dict(default='decimal', type='str'),
interval=dict(default=60, type='int'),
delta=dict(default=0, type='int'),
multiplier=dict(default=None, type='str'),
@@ -219,6 +238,7 @@ def main():
'hostid': templateid[0],
'type': get_zabbix_type(module.params['zabbix_type']),
'value_type': get_value_type(module.params['value_type']),
+ 'data_type': get_data_type(module.params['data_type']),
'applications': get_app_ids(module.params['applications'], app_name_ids),
'formula': formula,
'multiplier': use_multiplier,
diff --git a/roles/lib_zabbix/library/zbx_itemprototype.py b/roles/lib_zabbix/library/zbx_itemprototype.py
index 43498c015..aca9c8336 100644
--- a/roles/lib_zabbix/library/zbx_itemprototype.py
+++ b/roles/lib_zabbix/library/zbx_itemprototype.py
@@ -116,6 +116,24 @@ def get_zabbix_type(ztype):
return _vtype
+def get_data_type(data_type):
+ '''
+ Possible values:
+ 0 - decimal;
+ 1 - octal;
+ 2 - hexadecimal;
+ 3 - bool;
+ '''
+ vtype = 0
+ if 'octal' in data_type:
+ vtype = 1
+ elif 'hexadecimal' in data_type:
+ vtype = 2
+ elif 'bool' in data_type:
+ vtype = 3
+
+ return vtype
+
def get_value_type(value_type):
'''
Possible values:
@@ -175,6 +193,7 @@ def main():
interfaceid=dict(default=None, type='int'),
zabbix_type=dict(default='trapper', type='str'),
value_type=dict(default='float', type='str'),
+ data_type=dict(default='decimal', type='str'),
delay=dict(default=60, type='int'),
lifetime=dict(default=30, type='int'),
state=dict(default='present', type='str'),
@@ -238,6 +257,7 @@ def main():
'ruleid': get_rule_id(zapi, module.params['discoveryrule_key'], template['templateid']),
'type': get_zabbix_type(module.params['zabbix_type']),
'value_type': get_value_type(module.params['value_type']),
+ 'data_type': get_data_type(module.params['data_type']),
'applications': get_app_ids(zapi, module.params['applications'], template['templateid']),
'formula': formula,
'multiplier': use_multiplier,