summaryrefslogtreecommitdiffstats
path: root/playbooks
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2015-08-11 17:22:40 -0400
committerKenny Woodson <kwoodson@redhat.com>2015-08-11 17:22:40 -0400
commit479020f56a5e593188bafcd19e7dcb56a10e3544 (patch)
tree39a82e7eaff837506cb6232a9f943dba42738112 /playbooks
parent813bf4fb5ac36e16304ae1ee9d141e42d898c9f4 (diff)
parenta073f179b26c0d110aa6a8b7fc560ca061e4dc5c (diff)
downloadopenshift-479020f56a5e593188bafcd19e7dcb56a10e3544.tar.gz
openshift-479020f56a5e593188bafcd19e7dcb56a10e3544.tar.bz2
openshift-479020f56a5e593188bafcd19e7dcb56a10e3544.tar.xz
openshift-479020f56a5e593188bafcd19e7dcb56a10e3544.zip
Merge pull request #446 from kwoodson/idem
Zabbix Idempotent module
Diffstat (limited to 'playbooks')
-rw-r--r--playbooks/adhoc/zabbix_setup/clean_zabbix.yml37
-rw-r--r--playbooks/adhoc/zabbix_setup/create_template.yml30
-rw-r--r--playbooks/adhoc/zabbix_setup/setup_zabbix.yml9
-rw-r--r--playbooks/adhoc/zabbix_setup/vars/template_heartbeat.yml28
-rw-r--r--playbooks/adhoc/zabbix_setup/vars/template_os_linux.yml304
5 files changed, 117 insertions, 291 deletions
diff --git a/playbooks/adhoc/zabbix_setup/clean_zabbix.yml b/playbooks/adhoc/zabbix_setup/clean_zabbix.yml
index 610d18b28..a31cbef65 100644
--- a/playbooks/adhoc/zabbix_setup/clean_zabbix.yml
+++ b/playbooks/adhoc/zabbix_setup/clean_zabbix.yml
@@ -2,67 +2,50 @@
- hosts: localhost
gather_facts: no
vars:
- # Use this for local ZAIO
g_zserver: http://localhost/zabbix/api_jsonrpc.php
-
g_zuser: Admin
g_zpassword: zabbix
roles:
- - ../roles/os_zabbix
+ - ../../../roles/os_zabbix
post_tasks:
- - zbxapi:
+ - zbx_template:
server: "{{ g_zserver }}"
user: "{{ g_zuser }}"
password: "{{ g_zpassword }}"
- zbx_class: Template
state: list
- params:
- output: extend
- search:
- host: 'Template Heartbeat'
+ name: 'Template Heartbeat'
register: templ_heartbeat
- - zbxapi:
+ - zbx_template:
server: "{{ g_zserver }}"
user: "{{ g_zuser }}"
password: "{{ g_zpassword }}"
- zbx_class: Template
state: list
- params:
- output: extend
- search:
- host: 'Template App Zabbix Server'
+ name: 'Template App Zabbix Server'
register: templ_zabbix_server
- - zbxapi:
+ - zbx_template:
server: "{{ g_zserver }}"
user: "{{ g_zuser }}"
password: "{{ g_zpassword }}"
- zbx_class: Template
state: list
- params:
- output: extend
- search:
- host: 'Template App Zabbix Agent'
+ name: 'Template App Zabbix Agent'
register: templ_zabbix_agent
- - zbxapi:
+ - zbx_template:
server: "{{ g_zserver }}"
user: "{{ g_zuser }}"
password: "{{ g_zpassword }}"
- zbx_class: Template
state: list
register: templates
- debug: var=templ_heartbeat.results
- - zbxapi:
+ - zbx_template:
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
+ with_items: "{{ templates.results | difference(templ_zabbix_agent.results) | difference(templ_zabbix_server.results) | oo_collect('host') }}"
when: templ_heartbeat.results | length == 0
diff --git a/playbooks/adhoc/zabbix_setup/create_template.yml b/playbooks/adhoc/zabbix_setup/create_template.yml
index b055e78eb..60fb27666 100644
--- a/playbooks/adhoc/zabbix_setup/create_template.yml
+++ b/playbooks/adhoc/zabbix_setup/create_template.yml
@@ -2,16 +2,14 @@
- debug: var=ctp_template
- name: Create Template
- zbxapi:
+ zbx_template:
server: "{{ ctp_zserver }}"
user: "{{ ctp_zuser }}"
password: "{{ ctp_zpassword }}"
- zbx_class: Template
- state: present
- params: "{{ ctp_template.params }}"
- register: ctp_created_templates
+ name: "{{ ctp_template.name }}"
+ register: ctp_created_template
-- debug: var=ctp_created_templates
+- debug: var=ctp_created_template
#- name: Create Application
# zbxapi:
@@ -22,7 +20,7 @@
# state: present
# params:
# name: "{{ ctp_template.application.name}}"
-# hostid: "{{ ctp_created_templates.results[0].templateid }}"
+# hostid: "{{ ctp_created_template.results[0].templateid }}"
# search:
# name: "{{ ctp_template.application.name}}"
# register: ctp_created_application
@@ -30,28 +28,28 @@
#- debug: var=ctp_created_application
- name: Create Items
- zbxapi:
+ zbx_item:
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) }}"
+ name: "{{ item.name }}"
+ key: "{{ item.key }}"
+ value_type: "{{ item.value_type | default('int') }}"
+ template_name: "{{ ctp_template.name }}"
with_items: ctp_template.zitems
register: ctp_created_items
#- debug: var=ctp_created_items
- name: Create Triggers
- zbxapi:
+ zbx_trigger:
server: "{{ ctp_zserver }}"
user: "{{ ctp_zuser }}"
password: "{{ ctp_zpassword }}"
- zbx_class: Trigger
- state: present
- params: "{{ item }}"
+ description: "{{ item.description }}"
+ expression: "{{ item.expression }}"
+ priority: "{{ item.priority }}"
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/setup_zabbix.yml b/playbooks/adhoc/zabbix_setup/setup_zabbix.yml
index 8b44f2adf..1729194b5 100644
--- a/playbooks/adhoc/zabbix_setup/setup_zabbix.yml
+++ b/playbooks/adhoc/zabbix_setup/setup_zabbix.yml
@@ -5,22 +5,17 @@
- vars/template_heartbeat.yml
- vars/template_os_linux.yml
vars:
- # Use this for local ZAIO
g_zserver: http://localhost/zabbix/api_jsonrpc.php
-
g_zuser: Admin
g_zpassword: zabbix
roles:
- - ../roles/os_zabbix
+ - ../../../roles/os_zabbix
post_tasks:
- - zbxapi:
+ - zbx_template:
server: "{{ g_zserver }}"
user: "{{ g_zuser }}"
password: "{{ g_zpassword }}"
- zbx_class: Template
state: list
- params:
- output: extend
register: templates
- debug: var=templates
diff --git a/playbooks/adhoc/zabbix_setup/vars/template_heartbeat.yml b/playbooks/adhoc/zabbix_setup/vars/template_heartbeat.yml
index 9d6145ec4..22cc75554 100644
--- a/playbooks/adhoc/zabbix_setup/vars/template_heartbeat.yml
+++ b/playbooks/adhoc/zabbix_setup/vars/template_heartbeat.yml
@@ -1,33 +1,11 @@
---
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
+ name: Template Heartbeat
zitems:
- name: Heartbeat Ping
hostid:
- key_: heartbeat.ping
- type: 2
- value_type: 1
- output: extend
- search:
- key_: heartbeat.ping
- selectApplications: extend
+ key: heartbeat.ping
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
+ priority: avg
diff --git a/playbooks/adhoc/zabbix_setup/vars/template_os_linux.yml b/playbooks/adhoc/zabbix_setup/vars/template_os_linux.yml
index b89711632..6fab08879 100644
--- a/playbooks/adhoc/zabbix_setup/vars/template_os_linux.yml
+++ b/playbooks/adhoc/zabbix_setup/vars/template_os_linux.yml
@@ -1,248 +1,120 @@
---
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
+ name: Template OS Linux
zitems:
- - hostid: null
- key_: kernel.uname.sysname
+ - 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
+ value_type: string
+
+ - 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
+ value_type: int
+
+ - 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
+ value_type: int
+
+ - 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
+ value_type: int
+
+ - 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
+ value_type: string
+
+ - 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
+ value_type: string
+
+ - 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
+ value_type: int
+
+ - 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
+ value_type: float
+
+ - 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
+ value_type: int
+
+ - 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
+ value_type: float
+
+ - key: mem.freemem
name: mem.freemem
- search:
- key_: mem.freemem
- type: 2
- value_type: 3
- selectApplications: extend
- - hostid: null
- key_: kernel.all.cpu.nice
+ value_type: int
+
+ - 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
+ value_type: int
+
+ - 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
+ value_type: int
+
+ - 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
+ value_type: int
+
+ - 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
+ value_type: float
+
+ - 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
+ value_type: string
+
+ - key: swap.length
name: swap.length
- search:
- key_: swap.length
- type: 2
- value_type: 3
- selectApplications: extend
- - hostid: null
- key_: mem.physmem
+ value_type: int
+
+ - key: mem.physmem
name: mem.physmem
- search:
- key_: mem.physmem
- type: 2
- value_type: 3
- selectApplications: extend
- - hostid: null
- key_: kernel.all.uptime
+ value_type: int
+
+ - 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
+ value_type: int
+
+ - key: swap.free
name: swap.free
- search:
- key_: swap.free
- type: 2
- value_type: 3
- selectApplications: extend
- - hostid: null
- key_: mem.util.used
+ value_type: int
+
+ - 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
+ value_type: int
+
+ - 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
+ value_type: int
+
+ - 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
+ value_type: string
+
+ - key: hinv.ncpu
name: hinv.ncpu
- search:
- key_: hinv.ncpu
- type: 2
- value_type: 3
- selectApplications: extend
- - hostid: null
- key_: mem.util.cached
+ value_type: int
+
+ - 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
+ value_type: int
+
+ - 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
+ value_type: int
+
+
+ - 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
+ value_type: int
+
+ - 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
+ value_type: string
+
+ - key: proc.nprocs
name: proc.nprocs
- search:
- key_: proc.nprocs
- type: 2
- value_type: 3
- selectApplications: extend
+ value_type: int