diff options
author | Matt Woodson <mwoodson@gmail.com> | 2015-09-22 15:34:51 -0400 |
---|---|---|
committer | Matt Woodson <mwoodson@gmail.com> | 2015-09-22 15:34:51 -0400 |
commit | 8d2b270d3d8c53d0afc2285408da9e479c5974fc (patch) | |
tree | 78c71a351af3b260d077afd4935bee94446ee9ac /roles/lib_zabbix | |
parent | dfa3c0c22e3ad541e08ebc0c36fdccc735f13d4b (diff) | |
parent | 176258e9c9e9254fed8ba997a80a0262b5e2ede5 (diff) | |
download | openshift-8d2b270d3d8c53d0afc2285408da9e479c5974fc.tar.gz openshift-8d2b270d3d8c53d0afc2285408da9e479c5974fc.tar.bz2 openshift-8d2b270d3d8c53d0afc2285408da9e479c5974fc.tar.xz openshift-8d2b270d3d8c53d0afc2285408da9e479c5974fc.zip |
Merge pull request #603 from kwoodson/tmp1
Adding support for prototypes and discoveryrules
Diffstat (limited to 'roles/lib_zabbix')
-rw-r--r-- | roles/lib_zabbix/library/zbx_discoveryrule.py | 2 | ||||
-rw-r--r-- | roles/lib_zabbix/library/zbx_itemprototype.py | 12 |
2 files changed, 5 insertions, 9 deletions
diff --git a/roles/lib_zabbix/library/zbx_discoveryrule.py b/roles/lib_zabbix/library/zbx_discoveryrule.py index 71141bd54..f32267818 100644 --- a/roles/lib_zabbix/library/zbx_discoveryrule.py +++ b/roles/lib_zabbix/library/zbx_discoveryrule.py @@ -183,8 +183,6 @@ def main(): module.exit_json(changed=False, results=zab_results, state="present") # We have differences and need to update - module.exit_json(failed=True, changed=False, results=differences, state="present") - differences[idname] = zab_results[idname] content = zapi.get_content(zbx_class_name, 'update', differences) diff --git a/roles/lib_zabbix/library/zbx_itemprototype.py b/roles/lib_zabbix/library/zbx_itemprototype.py index b93b7729e..75b9e25b7 100644 --- a/roles/lib_zabbix/library/zbx_itemprototype.py +++ b/roles/lib_zabbix/library/zbx_itemprototype.py @@ -157,10 +157,8 @@ def main(): value_type=dict(default='float', type='str'), delay=dict(default=60, type='int'), lifetime=dict(default=30, type='int'), - template_name=dict(default=None, required=True, type='str'), state=dict(default='present', type='str'), status=dict(default='enabled', type='str'), - discoveryrule_name=dict(default=None, required=True, type='str'), applications=dict(default=[], type='list'), ), #supports_check_mode=True @@ -175,14 +173,14 @@ def main(): zbx_class_name = 'itemprototype' idname = "itemid" state = module.params['state'] - template = get_template(zapi, module.params['template_name']) # selectInterfaces doesn't appear to be working but is needed. content = zapi.get_content(zbx_class_name, 'get', - {'search': {'name': module.params['name']}, + {'search': {'key_': module.params['key']}, 'selectApplications': 'applicationid', 'selectDiscoveryRule': 'itemid', + 'templated': True, }) #******# @@ -205,9 +203,9 @@ def main(): if state == 'present': params = {'name': module.params['name'], 'key_': module.params['key'], - 'hostid': template['templateid'], + 'hostid': content['result'][0]['hostid'], 'interfaceid': module.params['interfaceid'], - 'ruleid': get_rule_id(zapi, module.params['discoveryrule_name'], template['templateid']), + 'ruleid': content['result'][0]['discoveryRule']['itemid'], 'type': get_type(module.params['ztype']), 'value_type': get_value_type(module.params['value_type']), 'applications': get_app_ids(zapi, module.params['applications']), @@ -226,7 +224,7 @@ def main(): content = zapi.get_content(zbx_class_name, 'create', params) if content.has_key('error'): - module.exit_json(failed=True, changed=True, results=content['error'], state="present") + module.exit_json(failed=True, changed=False, results=content['error'], state="present") module.exit_json(changed=True, results=content['result'], state='present') |