From e5f0b4944a434a51ae9b460d60a0e00a626158e6 Mon Sep 17 00:00:00 2001
From: Kenny Woodson <kwoodson@redhat.com>
Date: Thu, 8 Oct 2015 15:18:05 -0400
Subject: Adding zabbix agent template

---
 roles/lib_zabbix/library/zbx_item.py               |  2 ++
 roles/os_zabbix/tasks/main.yml                     |  9 +++++++++
 roles/os_zabbix/vars/template_app_zabbix_agent.yml | 23 ++++++++++++++++++++++
 3 files changed, 34 insertions(+)
 create mode 100644 roles/os_zabbix/vars/template_app_zabbix_agent.yml

(limited to 'roles')

diff --git a/roles/lib_zabbix/library/zbx_item.py b/roles/lib_zabbix/library/zbx_item.py
index 2ccc21292..6faa82dfc 100644
--- a/roles/lib_zabbix/library/zbx_item.py
+++ b/roles/lib_zabbix/library/zbx_item.py
@@ -53,6 +53,8 @@ def get_value_type(value_type):
     vtype = 0
     if 'int' in value_type:
         vtype = 3
+    elif 'log' in value_type:
+        vtype = 2
     elif 'char' in value_type:
         vtype = 1
     elif 'str' in value_type:
diff --git a/roles/os_zabbix/tasks/main.yml b/roles/os_zabbix/tasks/main.yml
index e083296c0..a503b24d7 100644
--- a/roles/os_zabbix/tasks/main.yml
+++ b/roles/os_zabbix/tasks/main.yml
@@ -14,6 +14,7 @@
 - include_vars: template_openshift_node.yml
 - include_vars: template_ops_tools.yml
 - include_vars: template_app_zabbix_server.yml
+- include_vars: template_app_zabbix_agent.yml
 
 - name: Include Template Heartbeat
   include: ../../lib_zabbix/tasks/create_template.yml
@@ -70,3 +71,11 @@
     server: "{{ ozb_server }}"
     user: "{{ ozb_user }}"
     password: "{{ ozb_password }}"
+
+- name: Include Template App Zabbix Agent
+  include: ../../lib_zabbix/tasks/create_template.yml
+  vars:
+    template: "{{ g_template_app_zabbix_agent }}"
+    server: "{{ ozb_server }}"
+    user: "{{ ozb_user }}"
+    password: "{{ ozb_password }}"
diff --git a/roles/os_zabbix/vars/template_app_zabbix_agent.yml b/roles/os_zabbix/vars/template_app_zabbix_agent.yml
new file mode 100644
index 000000000..06c4eda8b
--- /dev/null
+++ b/roles/os_zabbix/vars/template_app_zabbix_agent.yml
@@ -0,0 +1,23 @@
+---
+g_template_app_zabbix_agent:
+   name: Template App Zabbix Agent
+   zitems:
+   - key: agent.hostname
+     applications:
+     - Zabbix agent
+     value_type: character
+     zabbix_type: '0'
+
+   - 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'
+
+   ztriggers:
+   - name: '[Reboot] Zabbix agent on {HOST.NAME} is unreachable for 15 minutes'
+     description: Zabbix agent is unreachable for 15 minutes.
+     expression: '{Template App Zabbix Agent:agent.ping.nodata(15m)}=1'
+     priority: high
+     url: https://github.com/openshift/ops-sop/blob/master/Alerts/check_ping.asciidoc
-- 
cgit v1.2.3