summaryrefslogtreecommitdiffstats
path: root/playbooks
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2015-07-24 11:13:39 -0400
committerKenny Woodson <kwoodson@redhat.com>2015-07-24 11:13:39 -0400
commite869ee16050be5b786f2584f53ad6f57cd340a54 (patch)
tree00d203068e91e0f00b94675a377d5bc54dd9c37e /playbooks
parentc2ba25ba0df6b0ecd1206c3bddfa2d09e12bb5f3 (diff)
parent2a6fc886cc080ec1344d9ad4767f0fcde7ba3442 (diff)
downloadopenshift-e869ee16050be5b786f2584f53ad6f57cd340a54.tar.gz
openshift-e869ee16050be5b786f2584f53ad6f57cd340a54.tar.bz2
openshift-e869ee16050be5b786f2584f53ad6f57cd340a54.tar.xz
openshift-e869ee16050be5b786f2584f53ad6f57cd340a54.zip
Merge pull request #387 from kwoodson/v3_deploy_help
Initial zabbix setup.
Diffstat (limited to 'playbooks')
-rw-r--r--playbooks/adhoc/zabbix_setup/clean_zabbix.yml66
-rw-r--r--playbooks/adhoc/zabbix_setup/create_app.yml34
-rw-r--r--playbooks/adhoc/zabbix_setup/create_application.yml18
-rw-r--r--playbooks/adhoc/zabbix_setup/create_template.yml59
l---------playbooks/adhoc/zabbix_setup/filter_plugins1
-rw-r--r--playbooks/adhoc/zabbix_setup/setup_zabbix.yml41
-rw-r--r--playbooks/adhoc/zabbix_setup/vars/template_heartbeat.yml33
-rw-r--r--playbooks/adhoc/zabbix_setup/vars/template_host.yml27
-rw-r--r--playbooks/adhoc/zabbix_setup/vars/template_master.yml27
-rw-r--r--playbooks/adhoc/zabbix_setup/vars/template_node.yml27
-rw-r--r--playbooks/adhoc/zabbix_setup/vars/template_os_linux.yml248
-rw-r--r--playbooks/adhoc/zabbix_setup/vars/template_router.yml27
12 files changed, 608 insertions, 0 deletions
diff --git a/playbooks/adhoc/zabbix_setup/clean_zabbix.yml b/playbooks/adhoc/zabbix_setup/clean_zabbix.yml
new file mode 100644
index 000000000..bd71e6d1d
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/clean_zabbix.yml
@@ -0,0 +1,66 @@
+---
+- hosts: localhost
+ gather_facts: no
+ vars:
+ g_zserver: http://oso-rhel7-zabbix-web.kwoodsontest2.opstest.online.openshift.com/zabbix/api_jsonrpc.php
+ g_zuser: Admin
+ g_zpassword: zabbix
+ roles:
+ - ../roles/os_zabbix
+ post_tasks:
+
+ - zbxapi:
+ server: "{{ g_zserver }}"
+ user: "{{ g_zuser }}"
+ password: "{{ g_zpassword }}"
+ zbx_class: Template
+ state: list
+ params:
+ output: extend
+ search:
+ host: 'Template Heartbeat'
+ register: templ_heartbeat
+
+ - zbxapi:
+ server: "{{ g_zserver }}"
+ user: "{{ g_zuser }}"
+ password: "{{ g_zpassword }}"
+ zbx_class: Template
+ state: list
+ params:
+ output: extend
+ search:
+ host: 'Template App Zabbix Server'
+ register: templ_zabbix_server
+
+ - zbxapi:
+ server: "{{ g_zserver }}"
+ user: "{{ g_zuser }}"
+ password: "{{ g_zpassword }}"
+ zbx_class: Template
+ state: list
+ params:
+ output: extend
+ search:
+ host: 'Template App Zabbix Agent'
+ register: templ_zabbix_agent
+
+ - zbxapi:
+ server: "{{ g_zserver }}"
+ user: "{{ g_zuser }}"
+ password: "{{ g_zpassword }}"
+ zbx_class: Template
+ state: list
+ register: templates
+
+ - debug: var=templ_heartbeat.results
+
+ - zbxapi:
+ server: "{{ g_zserver }}"
+ user: "{{ g_zuser }}"
+ password: "{{ g_zpassword }}"
+ zbx_class: Template
+ state: absent
+ params: "{{templates.results | difference(templ_zabbix_agent.results) | difference(templ_zabbix_server.results) | oo_collect('templateid') }}"
+ register: template_results
+ when: templ_heartbeat.results | length == 0
diff --git a/playbooks/adhoc/zabbix_setup/create_app.yml b/playbooks/adhoc/zabbix_setup/create_app.yml
new file mode 100644
index 000000000..3a08b2301
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/create_app.yml
@@ -0,0 +1,34 @@
+---
+- hosts: localhost
+ gather_facts: no
+ vars_files:
+ - vars/template_heartbeat.yml
+ - vars/template_os_linux.yml
+ vars:
+ g_zserver: http://oso-rhel7-zabbix-web.kwoodsontest2.opstest.online.openshift.com/zabbix/api_jsonrpc.php
+ g_zuser: Admin
+ g_zpassword: zabbix
+ roles:
+ - ../roles/os_zabbix
+ post_tasks:
+ - zbxapi:
+ server: "{{ g_zserver }}"
+ user: "{{ g_zuser }}"
+ password: "{{ g_zpassword }}"
+ zbx_class: Template
+ state: list
+ params:
+ output: extend
+ register: templates
+
+ - debug: var=templates
+
+ - name: Create app
+ include: create_application.yml
+ vars:
+ ctp_template: "{{ g_template_heartbeat }}"
+ ctp_zserver: "{{ g_zserver }}"
+ ctp_zuser: "{{ g_zuser }}"
+ ctp_zpassword: "{{ g_zpassword }}"
+
+
diff --git a/playbooks/adhoc/zabbix_setup/create_application.yml b/playbooks/adhoc/zabbix_setup/create_application.yml
new file mode 100644
index 000000000..aa6c40ed8
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/create_application.yml
@@ -0,0 +1,18 @@
+---
+- debug: var=ctp_template
+
+- name: Create Application
+ zbxapi:
+ server: "{{ ctp_zserver }}"
+ user: "{{ ctp_zuser }}"
+ password: "{{ ctp_zpassword }}"
+ zbx_class: Application
+ state: present
+ params:
+ name: "{{ ctp_template.application['name'] }}"
+ hostid: 10085
+ search:
+ name: "{{ ctp_template.application['name'] }}"
+ register: ctp_created_application
+
+- debug: var=ctp_created_application
diff --git a/playbooks/adhoc/zabbix_setup/create_template.yml b/playbooks/adhoc/zabbix_setup/create_template.yml
new file mode 100644
index 000000000..07724d5b7
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/create_template.yml
@@ -0,0 +1,59 @@
+---
+- debug: var=ctp_template
+
+- name: Create Template
+ zbxapi:
+ server: "{{ ctp_zserver }}"
+ user: "{{ ctp_zuser }}"
+ password: "{{ ctp_zpassword }}"
+ zbx_class: Template
+ state: present
+ params: "{{ ctp_template.params }}"
+ register: ctp_created_templates
+
+- debug: var=ctp_created_templates
+
+#- name: Create Application
+# zbxapi:
+# server: "{{ ctp_zserver }}"
+# user: "{{ ctp_zuser }}"
+# password: "{{ ctp_zpassword }}"
+# zbx_class: Application
+# state: present
+# params:
+# name: "{{ ctp_template.application.name}}"
+# hostid: "{{ ctp_created_templates.results[0].templateid }}"
+# search:
+# name: "{{ ctp_template.application.name}}"
+# register: ctp_created_application
+
+- debug: var=ctp_created_application
+
+- name: Create Items
+ zbxapi:
+ server: "{{ ctp_zserver }}"
+ user: "{{ ctp_zuser }}"
+ password: "{{ ctp_zpassword }}"
+ zbx_class: Item
+ state: present
+ params: "{{ item | oo_set_zbx_item_hostid(ctp_created_templates.results) }}"
+ with_items: ctp_template.zitems
+ register: ctp_created_items
+
+- debug: var=ctp_created_items
+
+- name: Create Triggers
+ zbxapi:
+ server: "{{ ctp_zserver }}"
+ user: "{{ ctp_zuser }}"
+ password: "{{ ctp_zpassword }}"
+ zbx_class: Trigger
+ state: present
+ params: "{{ item }}"
+ with_items: ctp_template.ztriggers
+ register: ctp_created_triggers
+ when: ctp_template.ztriggers is defined
+
+- debug: var=ctp_created_triggers
+
+
diff --git a/playbooks/adhoc/zabbix_setup/filter_plugins b/playbooks/adhoc/zabbix_setup/filter_plugins
new file mode 120000
index 000000000..99a95e4ca
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/filter_plugins
@@ -0,0 +1 @@
+../../../filter_plugins \ No newline at end of file
diff --git a/playbooks/adhoc/zabbix_setup/setup_zabbix.yml b/playbooks/adhoc/zabbix_setup/setup_zabbix.yml
new file mode 100644
index 000000000..286f699e5
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/setup_zabbix.yml
@@ -0,0 +1,41 @@
+---
+- hosts: localhost
+ gather_facts: no
+ vars_files:
+ - vars/template_heartbeat.yml
+ - vars/template_os_linux.yml
+ vars:
+ g_zserver: http://oso-rhel7-zabbix-web.kwoodsontest2.opstest.online.openshift.com/zabbix/api_jsonrpc.php
+ g_zuser: Admin
+ g_zpassword: zabbix
+ roles:
+ - ../roles/os_zabbix
+ post_tasks:
+ - zbxapi:
+ server: "{{ g_zserver }}"
+ user: "{{ g_zuser }}"
+ password: "{{ g_zpassword }}"
+ zbx_class: Template
+ state: list
+ params:
+ output: extend
+ register: templates
+
+ - debug: var=templates
+
+ - name: Include Template
+ include: create_template.yml
+ vars:
+ ctp_template: "{{ g_template_heartbeat }}"
+ ctp_zserver: "{{ g_zserver }}"
+ ctp_zuser: "{{ g_zuser }}"
+ ctp_zpassword: "{{ g_zpassword }}"
+
+ - name: Include Template
+ include: create_template.yml
+ vars:
+ ctp_template: "{{ g_template_os_linux }}"
+ ctp_zserver: "{{ g_zserver }}"
+ ctp_zuser: "{{ g_zuser }}"
+ ctp_zpassword: "{{ g_zpassword }}"
+
diff --git a/playbooks/adhoc/zabbix_setup/vars/template_heartbeat.yml b/playbooks/adhoc/zabbix_setup/vars/template_heartbeat.yml
new file mode 100644
index 000000000..9d6145ec4
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/vars/template_heartbeat.yml
@@ -0,0 +1,33 @@
+---
+g_template_heartbeat:
+ application:
+ name: Heartbeat
+#output: extend
+ search:
+ name: Heartbeat
+ params:
+ name: Template Heartbeat
+ host: Template Heartbeat
+ groups:
+ - groupid: 1 # FIXME (not real)
+ output: extend
+ search:
+ name: Template Heartbeat
+ zitems:
+ - name: Heartbeat Ping
+ hostid:
+ key_: heartbeat.ping
+ type: 2
+ value_type: 1
+ output: extend
+ search:
+ key_: heartbeat.ping
+ selectApplications: extend
+ ztriggers:
+ - description: 'Heartbeat.ping has failed on {HOST.NAME}'
+ expression: '{Template Heartbeat:heartbeat.ping.last()}<>0'
+ priority: 3
+ searchWildcardsEnabled: True
+ search:
+ description: 'Heartbeat.ping has failed on*'
+ expandExpression: True
diff --git a/playbooks/adhoc/zabbix_setup/vars/template_host.yml b/playbooks/adhoc/zabbix_setup/vars/template_host.yml
new file mode 100644
index 000000000..e7cc667cb
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/vars/template_host.yml
@@ -0,0 +1,27 @@
+---
+g_template_host:
+ params:
+ name: Template Host
+ host: Template Host
+ groups:
+ - groupid: 1 # FIXME (not real)
+ output: extend
+ search:
+ name: Template Host
+ zitems:
+ - name: Host Ping
+ hostid:
+ key_: host.ping
+ type: 2
+ value_type: 0
+ output: extend
+ search:
+ key_: host.ping
+ ztriggers:
+ - description: 'Host ping has failed on {HOST.NAME}'
+ expression: '{Template Host:host.ping.last()}<>0'
+ priority: 3
+ searchWildcardsEnabled: True
+ search:
+ description: 'Host ping has failed on*'
+ expandExpression: True
diff --git a/playbooks/adhoc/zabbix_setup/vars/template_master.yml b/playbooks/adhoc/zabbix_setup/vars/template_master.yml
new file mode 100644
index 000000000..5f9b41a4f
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/vars/template_master.yml
@@ -0,0 +1,27 @@
+---
+g_template_master:
+ params:
+ name: Template Master
+ host: Template Master
+ groups:
+ - groupid: 1 # FIXME (not real)
+ output: extend
+ search:
+ name: Template Master
+ zitems:
+ - name: Master Etcd Ping
+ hostid:
+ key_: master.etcd.ping
+ type: 2
+ value_type: 0
+ output: extend
+ search:
+ key_: master.etcd.ping
+ ztriggers:
+ - description: 'Master Etcd ping has failed on {HOST.NAME}'
+ expression: '{Template Master:master.etcd.ping.last()}<>0'
+ priority: 3
+ searchWildcardsEnabled: True
+ search:
+ description: 'Master Etcd ping has failed on*'
+ expandExpression: True
diff --git a/playbooks/adhoc/zabbix_setup/vars/template_node.yml b/playbooks/adhoc/zabbix_setup/vars/template_node.yml
new file mode 100644
index 000000000..98c343a24
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/vars/template_node.yml
@@ -0,0 +1,27 @@
+---
+g_template_node:
+ params:
+ name: Template Node
+ host: Template Node
+ groups:
+ - groupid: 1 # FIXME (not real)
+ output: extend
+ search:
+ name: Template Node
+ zitems:
+ - name: Kubelet Ping
+ hostid:
+ key_: kubelet.ping
+ type: 2
+ value_type: 0
+ output: extend
+ search:
+ key_: kubelet.ping
+ ztriggers:
+ - description: 'Kubelet ping has failed on {HOST.NAME}'
+ expression: '{Template Node:kubelet.ping.last()}<>0'
+ priority: 3
+ searchWildcardsEnabled: True
+ search:
+ description: 'Kubelet ping has failed on*'
+ expandExpression: True
diff --git a/playbooks/adhoc/zabbix_setup/vars/template_os_linux.yml b/playbooks/adhoc/zabbix_setup/vars/template_os_linux.yml
new file mode 100644
index 000000000..b89711632
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/vars/template_os_linux.yml
@@ -0,0 +1,248 @@
+---
+g_template_os_linux:
+ application:
+ name: OS Linux
+ output: extend
+ search:
+ name: OS Linux
+ params:
+ name: Template OS Linux
+ host: Template OS Linux
+ groups:
+ - groupid: 1 # FIXME (not real)
+ output: extend
+ search:
+ name: Template OS Linux
+ zitems:
+ - hostid: null
+ key_: kernel.uname.sysname
+ name: kernel.uname.sysname
+ search:
+ key_: kernel.uname.sysname
+ type: 2
+ value_type: 4
+ selectApplications: extend
+ - hostid: null
+ key_: kernel.all.cpu.wait.total
+ name: kernel.all.cpu.wait.total
+ search:
+ key_: kernel.all.cpu.wait.total
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: kernel.all.cpu.irq.hard
+ name: kernel.all.cpu.irq.hard
+ search:
+ key_: kernel.all.cpu.irq.hard
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: kernel.all.cpu.idle
+ name: kernel.all.cpu.idle
+ search:
+ key_: kernel.all.cpu.idle
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: kernel.uname.distro
+ name: kernel.uname.distro
+ search:
+ key_: kernel.uname.distro
+ type: 2
+ value_type: 4
+ selectApplications: extend
+ - hostid: null
+ key_: kernel.uname.nodename
+ name: kernel.uname.nodename
+ search:
+ key_: kernel.uname.nodename
+ type: 2
+ value_type: 4
+ selectApplications: extend
+ - hostid: null
+ key_: kernel.all.cpu.irq.soft
+ name: kernel.all.cpu.irq.soft
+ search:
+ key_: kernel.all.cpu.irq.soft
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: kernel.all.load.15_minute
+ name: kernel.all.load.15_minute
+ search:
+ key_: kernel.all.load.15_minute
+ type: 2
+ value_type: 0
+ selectApplications: extend
+ - hostid: null
+ key_: kernel.all.cpu.sys
+ name: kernel.all.cpu.sys
+ search:
+ key_: kernel.all.cpu.sys
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: kernel.all.load.5_minute
+ name: kernel.all.load.5_minute
+ search:
+ key_: kernel.all.load.5_minute
+ type: 2
+ value_type: 0
+ selectApplications: extend
+ - hostid: null
+ key_: mem.freemem
+ name: mem.freemem
+ search:
+ key_: mem.freemem
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: kernel.all.cpu.nice
+ name: kernel.all.cpu.nice
+ search:
+ key_: kernel.all.cpu.nice
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: mem.util.bufmem
+ name: mem.util.bufmem
+ search:
+ key_: mem.util.bufmem
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: swap.used
+ name: swap.used
+ search:
+ key_: swap.used
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: kernel.all.load.1_minute
+ name: kernel.all.load.1_minute
+ search:
+ key_: kernel.all.load.1_minute
+ type: 2
+ value_type: 0
+ selectApplications: extend
+ - hostid: null
+ key_: kernel.uname.version
+ name: kernel.uname.version
+ search:
+ key_: kernel.uname.version
+ type: 2
+ value_type: 4
+ selectApplications: extend
+ - hostid: null
+ key_: swap.length
+ name: swap.length
+ search:
+ key_: swap.length
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: mem.physmem
+ name: mem.physmem
+ search:
+ key_: mem.physmem
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: kernel.all.uptime
+ name: kernel.all.uptime
+ search:
+ key_: kernel.all.uptime
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: swap.free
+ name: swap.free
+ search:
+ key_: swap.free
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: mem.util.used
+ name: mem.util.used
+ search:
+ key_: mem.util.used
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: kernel.all.cpu.user
+ name: kernel.all.cpu.user
+ search:
+ key_: kernel.all.cpu.user
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: kernel.uname.machine
+ name: kernel.uname.machine
+ search:
+ key_: kernel.uname.machine
+ type: 2
+ value_type: 4
+ selectApplications: extend
+ - hostid: null
+ key_: hinv.ncpu
+ name: hinv.ncpu
+ search:
+ key_: hinv.ncpu
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: mem.util.cached
+ name: mem.util.cached
+ search:
+ key_: mem.util.cached
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: kernel.all.cpu.steal
+ name: kernel.all.cpu.steal
+ search:
+ key_: kernel.all.cpu.steal
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: kernel.all.pswitch
+ name: kernel.all.pswitch
+ search:
+ key_: kernel.all.pswitch
+ type: 2
+ value_type: 3
+ selectApplications: extend
+ - hostid: null
+ key_: kernel.uname.release
+ name: kernel.uname.release
+ search:
+ key_: kernel.uname.release
+ type: 2
+ value_type: 4
+ selectApplications: extend
+ - hostid: null
+ key_: proc.nprocs
+ name: proc.nprocs
+ search:
+ key_: proc.nprocs
+ type: 2
+ value_type: 3
+ selectApplications: extend
diff --git a/playbooks/adhoc/zabbix_setup/vars/template_router.yml b/playbooks/adhoc/zabbix_setup/vars/template_router.yml
new file mode 100644
index 000000000..4dae7da1e
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/vars/template_router.yml
@@ -0,0 +1,27 @@
+---
+g_template_router:
+ params:
+ name: Template Router
+ host: Template Router
+ groups:
+ - groupid: 1 # FIXME (not real)
+ output: extend
+ search:
+ name: Template Router
+ zitems:
+ - name: Router Backends down
+ hostid:
+ key_: router.backends.down
+ type: 2
+ value_type: 0
+ output: extend
+ search:
+ key_: router.backends.down
+ ztriggers:
+ - description: 'Number of router backends down on {HOST.NAME}'
+ expression: '{Template Router:router.backends.down.last()}<>0'
+ priority: 3
+ searchWildcardsEnabled: True
+ search:
+ description: 'Number of router backends down on {HOST.NAME}'
+ expandExpression: True