summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2015-10-26 16:51:53 -0400
committerKenny Woodson <kwoodson@redhat.com>2015-10-26 16:51:53 -0400
commit593d2b0c296a9f264f0f0ae927f468c978e30176 (patch)
treeaeb028f8a75ff3f56e4b8277f80eda30b8dc1e8f /roles
parent4836ed6801b3f841ac3b3bab589c550c35179591 (diff)
parent5800ca35fd005957cb325165ac7d109d3892ea28 (diff)
downloadopenshift-593d2b0c296a9f264f0f0ae927f468c978e30176.tar.gz
openshift-593d2b0c296a9f264f0f0ae927f468c978e30176.tar.bz2
openshift-593d2b0c296a9f264f0f0ae927f468c978e30176.tar.xz
openshift-593d2b0c296a9f264f0f0ae927f468c978e30176.zip
Merge pull request #744 from kwoodson/zbxztype
Adding zabbix_type to zbx_items and fixing zabbix agent items
Diffstat (limited to 'roles')
-rw-r--r--roles/lib_zabbix/library/zbx_item.py37
-rw-r--r--roles/lib_zabbix/tasks/create_template.yml2
-rw-r--r--roles/os_zabbix/vars/template_app_zabbix_agent.yml4
-rw-r--r--roles/os_zabbix/vars/template_app_zabbix_server.yml60
4 files changed, 68 insertions, 35 deletions
diff --git a/roles/lib_zabbix/library/zbx_item.py b/roles/lib_zabbix/library/zbx_item.py
index 2cd00dd27..5dc3cff9b 100644
--- a/roles/lib_zabbix/library/zbx_item.py
+++ b/roles/lib_zabbix/library/zbx_item.py
@@ -107,6 +107,39 @@ def get_multiplier(inval):
return rval, 0
+def get_zabbix_type(ztype):
+ '''
+ Determine which type of discoverrule this is
+ '''
+ _types = {'agent': 0,
+ 'SNMPv1': 1,
+ 'trapper': 2,
+ 'simple': 3,
+ 'SNMPv2': 4,
+ 'internal': 5,
+ 'SNMPv3': 6,
+ 'active': 7,
+ 'aggregate': 8,
+ 'web': 9,
+ 'external': 10,
+ 'database monitor': 11,
+ 'ipmi': 12,
+ 'ssh': 13,
+ 'telnet': 14,
+ 'calculated': 15,
+ 'JMX': 16,
+ 'SNMP trap': 17,
+ }
+
+ for typ in _types.keys():
+ if ztype in typ or ztype == typ:
+ _vtype = _types[typ]
+ break
+ else:
+ _vtype = 2
+
+ return _vtype
+
# The branches are needed for CRUD and error handling
# pylint: disable=too-many-branches
def main():
@@ -123,7 +156,7 @@ def main():
name=dict(default=None, type='str'),
key=dict(default=None, type='str'),
template_name=dict(default=None, type='str'),
- zabbix_type=dict(default=2, type='int'),
+ zabbix_type=dict(default='trapper', type='str'),
value_type=dict(default='int', type='str'),
interval=dict(default=60, type='int'),
delta=dict(default=0, type='int'),
@@ -184,7 +217,7 @@ def main():
params = {'name': module.params.get('name', module.params['key']),
'key_': module.params['key'],
'hostid': templateid[0],
- 'type': module.params['zabbix_type'],
+ 'type': get_zabbix_type(module.params['zabbix_type']),
'value_type': get_value_type(module.params['value_type']),
'applications': get_app_ids(module.params['applications'], app_name_ids),
'formula': formula,
diff --git a/roles/lib_zabbix/tasks/create_template.yml b/roles/lib_zabbix/tasks/create_template.yml
index d5168a9f4..ac9cf756b 100644
--- a/roles/lib_zabbix/tasks/create_template.yml
+++ b/roles/lib_zabbix/tasks/create_template.yml
@@ -38,7 +38,7 @@
units: "{{ item.units | default('', True) }}"
template_name: "{{ template.name }}"
applications: "{{ item.applications }}"
- zabbix_type: "{{ item.zabbix_type | default(2, True) }}"
+ zabbix_type: "{{ item.zabbix_type | default('trapper') }}"
interval: "{{ item.interval | default(60, True) }}"
delta: "{{ item.delta | default(0, True) }}"
with_items: template.zitems
diff --git a/roles/os_zabbix/vars/template_app_zabbix_agent.yml b/roles/os_zabbix/vars/template_app_zabbix_agent.yml
index 6349b6384..d636d4822 100644
--- a/roles/os_zabbix/vars/template_app_zabbix_agent.yml
+++ b/roles/os_zabbix/vars/template_app_zabbix_agent.yml
@@ -6,14 +6,14 @@ g_template_app_zabbix_agent:
applications:
- Zabbix agent
value_type: character
- zabbix_type: 0
+ zabbix_type: agent
- key: agent.ping
applications:
- Zabbix agent
description: The agent always returns 1 for this item. It could be used in combination with nodata() for availability check.
value_type: int
- zabbix_type: 0
+ zabbix_type: agent
ztriggers:
- name: '[Reboot] Zabbix agent on {HOST.NAME} is unreachable for 15 minutes'
diff --git a/roles/os_zabbix/vars/template_app_zabbix_server.yml b/roles/os_zabbix/vars/template_app_zabbix_server.yml
index aeec16254..43517113b 100644
--- a/roles/os_zabbix/vars/template_app_zabbix_server.yml
+++ b/roles/os_zabbix/vars/template_app_zabbix_server.yml
@@ -8,7 +8,7 @@ g_template_app_zabbix_server:
description: A simple count of the number of partition creates output by the housekeeper script.
units: ''
value_type: int
- zabbix_type: 5
+ zabbix_type: internal
- key: housekeeper_drops
applications:
@@ -16,7 +16,7 @@ g_template_app_zabbix_server:
description: A simple count of the number of partition drops output by the housekeeper script.
units: ''
value_type: int
- zabbix_type: 5
+ zabbix_type: internal
- key: housekeeper_errors
applications:
@@ -24,7 +24,7 @@ g_template_app_zabbix_server:
description: A simple count of the number of errors output by the housekeeper script.
units: ''
value_type: int
- zabbix_type: 5
+ zabbix_type: internal
- key: housekeeper_total
applications:
@@ -33,7 +33,7 @@ g_template_app_zabbix_server:
script.
units: ''
value_type: int
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,alerter,avg,busy]
applications:
@@ -41,7 +41,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,configuration syncer,avg,busy]
applications:
@@ -49,7 +49,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,db watchdog,avg,busy]
applications:
@@ -57,7 +57,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,discoverer,avg,busy]
applications:
@@ -65,7 +65,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,escalator,avg,busy]
applications:
@@ -73,7 +73,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,history syncer,avg,busy]
applications:
@@ -81,7 +81,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,housekeeper,avg,busy]
applications:
@@ -89,7 +89,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,http poller,avg,busy]
applications:
@@ -97,7 +97,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,icmp pinger,avg,busy]
applications:
@@ -105,7 +105,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,ipmi poller,avg,busy]
applications:
@@ -113,7 +113,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,java poller,avg,busy]
applications:
@@ -121,7 +121,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,node watcher,avg,busy]
applications:
@@ -129,7 +129,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,poller,avg,busy]
applications:
@@ -137,7 +137,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,proxy poller,avg,busy]
applications:
@@ -145,7 +145,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,self-monitoring,avg,busy]
applications:
@@ -153,7 +153,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,snmp trapper,avg,busy]
applications:
@@ -161,7 +161,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,timer,avg,busy]
applications:
@@ -169,7 +169,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,trapper,avg,busy]
applications:
@@ -177,7 +177,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[process,unreachable poller,avg,busy]
applications:
@@ -185,7 +185,7 @@ g_template_app_zabbix_server:
description: ''
units: '%'
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[queue,10m]
applications:
@@ -193,7 +193,7 @@ g_template_app_zabbix_server:
description: ''
units: ''
value_type: int
- zabbix_type: 5
+ zabbix_type: internal
interval: 600
- key: zabbix[queue]
@@ -202,7 +202,7 @@ g_template_app_zabbix_server:
description: ''
units: ''
value_type: int
- zabbix_type: 5
+ zabbix_type: internal
interval: 600
- key: zabbix[rcache,buffer,pfree]
@@ -211,7 +211,7 @@ g_template_app_zabbix_server:
description: ''
units: ''
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[wcache,history,pfree]
applications:
@@ -219,7 +219,7 @@ g_template_app_zabbix_server:
description: ''
units: ''
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[wcache,text,pfree]
applications:
@@ -227,7 +227,7 @@ g_template_app_zabbix_server:
description: ''
units: ''
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[wcache,trend,pfree]
applications:
@@ -235,7 +235,7 @@ g_template_app_zabbix_server:
description: ''
units: ''
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
- key: zabbix[wcache,values]
applications:
@@ -243,7 +243,7 @@ g_template_app_zabbix_server:
description: ''
units: ''
value_type: float
- zabbix_type: 5
+ zabbix_type: internal
delta: 1 # speed per second
ztriggers: