From 693be4802c2b3886b82681c5c1666b9f13d9ca36 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Fri, 21 Aug 2015 17:44:30 -0400 Subject: Updates for zbx ans module --- roles/lib_zabbix/tasks/create_template.yml | 61 ++++++++++++++++++++++++++++++ roles/lib_zabbix/tasks/create_user.yml | 11 ++++++ 2 files changed, 72 insertions(+) create mode 100644 roles/lib_zabbix/tasks/create_template.yml create mode 100644 roles/lib_zabbix/tasks/create_user.yml (limited to 'roles/lib_zabbix/tasks') diff --git a/roles/lib_zabbix/tasks/create_template.yml b/roles/lib_zabbix/tasks/create_template.yml new file mode 100644 index 000000000..022ca52f2 --- /dev/null +++ b/roles/lib_zabbix/tasks/create_template.yml @@ -0,0 +1,61 @@ +--- +- debug: var=template + +- name: Template Create Template + zbx_template: + zbx_server: "{{ server }}" + zbx_user: "{{ user }}" + zbx_password: "{{ password }}" + name: "{{ template.name }}" + register: created_template + +- debug: var=created_template + +- set_fact: + lzbx_applications: "{{ template.zitems | oo_select_keys_from_list(['applications']) | oo_flatten | unique }}" + +- debug: var=lzbx_applications + +- name: Create Application + zbx_application: + zbx_server: "{{ server }}" + zbx_user: "{{ user }}" + zbx_password: "{{ password }}" + name: "{{ item }}" + template_name: "{{ template.name }}" + with_items: lzbx_applications + register: created_application + when: template.zitems is defined + +- debug: var=created_application + +- name: Create Items + zbx_item: + zbx_server: "{{ server }}" + zbx_user: "{{ user }}" + zbx_password: "{{ password }}" + key: "{{ item.key }}" + name: "{{ item.name | default(item.key, true) }}" + value_type: "{{ item.value_type | default('int') }}" + template_name: "{{ template.name }}" + applications: "{{ item.applications }}" + with_items: template.zitems + register: created_items + when: template.zitems is defined + +#- debug: var=ctp_created_items + +- name: Create Triggers + zbx_trigger: + zbx_server: "{{ server }}" + zbx_user: "{{ user }}" + zbx_password: "{{ password }}" + description: "{{ item.description }}" + expression: "{{ item.expression }}" + priority: "{{ item.priority }}" + with_items: template.ztriggers + when: template.ztriggers is defined + +#- debug: var=ctp_created_triggers + + diff --git a/roles/lib_zabbix/tasks/create_user.yml b/roles/lib_zabbix/tasks/create_user.yml new file mode 100644 index 000000000..1f752a9e1 --- /dev/null +++ b/roles/lib_zabbix/tasks/create_user.yml @@ -0,0 +1,11 @@ +--- +- name: Update zabbix credentialss for a user + zbx_user: + server: "{{ ozb_server }}" + user: "{{ ozb_user }}" + password: "{{ ozb_password }}" + alias: "{{ ozb_username }}" + passwd: "{{ ozb_new_password | default(ozb_password, true) }}" + register: user + +- debug: var=user.results -- cgit v1.2.3 From 1f52ea8c4e2f8cfce51e98cb3614c61f0d78ec3e Mon Sep 17 00:00:00 2001 From: Thomas Wiest Date: Fri, 28 Aug 2015 18:03:59 -0400 Subject: added docker zabbix template, removed unused / old templates so they don't confuse other people. --- roles/lib_zabbix/tasks/create_template.yml | 36 ++++++++++++++---------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'roles/lib_zabbix/tasks') diff --git a/roles/lib_zabbix/tasks/create_template.yml b/roles/lib_zabbix/tasks/create_template.yml index 022ca52f2..444fd0a14 100644 --- a/roles/lib_zabbix/tasks/create_template.yml +++ b/roles/lib_zabbix/tasks/create_template.yml @@ -16,18 +16,21 @@ - debug: var=lzbx_applications -- name: Create Application - zbx_application: - zbx_server: "{{ server }}" - zbx_user: "{{ user }}" - zbx_password: "{{ password }}" - name: "{{ item }}" - template_name: "{{ template.name }}" - with_items: lzbx_applications - register: created_application - when: template.zitems is defined - -- debug: var=created_application +# +# twiest: This is commented out because it doesn't work correctly +# +#- name: Create Application +# zbx_application: +# zbx_server: "{{ server }}" +# zbx_user: "{{ user }}" +# zbx_password: "{{ password }}" +# name: "{{ item }}" +# template_name: "{{ template.name }}" +# with_items: lzbx_applications +# register: created_application +# when: template.zitems is defined + +#- debug: var=created_application - name: Create Items zbx_item: @@ -38,24 +41,19 @@ name: "{{ item.name | default(item.key, true) }}" value_type: "{{ item.value_type | default('int') }}" template_name: "{{ template.name }}" - applications: "{{ item.applications }}" +# applications: "{{ item.applications }}" with_items: template.zitems register: created_items when: template.zitems is defined -#- debug: var=ctp_created_items - - name: Create Triggers zbx_trigger: zbx_server: "{{ server }}" zbx_user: "{{ user }}" zbx_password: "{{ password }}" description: "{{ item.description }}" + dependencies: "{{ item.dependencies | default([], true) }}" expression: "{{ item.expression }}" priority: "{{ item.priority }}" with_items: template.ztriggers when: template.ztriggers is defined - -#- debug: var=ctp_created_triggers - - -- cgit v1.2.3 From d39837b2be8ce6abfa8c69d7cc83f04c6130ccd5 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Tue, 1 Sep 2015 10:22:22 -0400 Subject: Fix for zbx applications --- roles/lib_zabbix/tasks/create_template.yml | 32 ++++++++++-------------------- 1 file changed, 11 insertions(+), 21 deletions(-) (limited to 'roles/lib_zabbix/tasks') diff --git a/roles/lib_zabbix/tasks/create_template.yml b/roles/lib_zabbix/tasks/create_template.yml index 444fd0a14..630d5dd70 100644 --- a/roles/lib_zabbix/tasks/create_template.yml +++ b/roles/lib_zabbix/tasks/create_template.yml @@ -1,6 +1,4 @@ --- -- debug: var=template - - name: Template Create Template zbx_template: zbx_server: "{{ server }}" @@ -9,28 +7,20 @@ name: "{{ template.name }}" register: created_template -- debug: var=created_template - set_fact: lzbx_applications: "{{ template.zitems | oo_select_keys_from_list(['applications']) | oo_flatten | unique }}" -- debug: var=lzbx_applications - -# -# twiest: This is commented out because it doesn't work correctly -# -#- name: Create Application -# zbx_application: -# zbx_server: "{{ server }}" -# zbx_user: "{{ user }}" -# zbx_password: "{{ password }}" -# name: "{{ item }}" -# template_name: "{{ template.name }}" -# with_items: lzbx_applications -# register: created_application -# when: template.zitems is defined - -#- debug: var=created_application +- name: Create Application + zbx_application: + zbx_server: "{{ server }}" + zbx_user: "{{ user }}" + zbx_password: "{{ password }}" + name: "{{ item }}" + template_name: "{{ template.name }}" + with_items: lzbx_applications + register: created_application + when: template.zitems is defined - name: Create Items zbx_item: @@ -41,7 +31,7 @@ name: "{{ item.name | default(item.key, true) }}" value_type: "{{ item.value_type | default('int') }}" template_name: "{{ template.name }}" -# applications: "{{ item.applications }}" + applications: "{{ item.applications }}" with_items: template.zitems register: created_items when: template.zitems is defined -- cgit v1.2.3 From fcae524b50878c6413fe9daadccc2dae1d1721ba Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Thu, 3 Sep 2015 16:12:52 -0400 Subject: Added trigger url --- roles/lib_zabbix/tasks/create_template.yml | 1 + 1 file changed, 1 insertion(+) (limited to 'roles/lib_zabbix/tasks') diff --git a/roles/lib_zabbix/tasks/create_template.yml b/roles/lib_zabbix/tasks/create_template.yml index 630d5dd70..bc9aff997 100644 --- a/roles/lib_zabbix/tasks/create_template.yml +++ b/roles/lib_zabbix/tasks/create_template.yml @@ -45,5 +45,6 @@ dependencies: "{{ item.dependencies | default([], true) }}" expression: "{{ item.expression }}" priority: "{{ item.priority }}" + url: "{{ item.url | default(None, True) }}" with_items: template.ztriggers when: template.ztriggers is defined -- cgit v1.2.3 From 4824691f00c04936da74ddfbbeb6e521ddb86d98 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Tue, 8 Sep 2015 15:55:45 -0400 Subject: Adding desc, multiplier, and units to zabbix item --- roles/lib_zabbix/tasks/create_template.yml | 3 +++ 1 file changed, 3 insertions(+) (limited to 'roles/lib_zabbix/tasks') diff --git a/roles/lib_zabbix/tasks/create_template.yml b/roles/lib_zabbix/tasks/create_template.yml index bc9aff997..6307bf57a 100644 --- a/roles/lib_zabbix/tasks/create_template.yml +++ b/roles/lib_zabbix/tasks/create_template.yml @@ -30,6 +30,9 @@ key: "{{ item.key }}" name: "{{ item.name | default(item.key, true) }}" value_type: "{{ item.value_type | default('int') }}" + description: "{{ item.description | default('', True) }}" + multiplier: "{{ item.multiplier | default('', True) }}" + units: "{{ item.units | default('', True) }}" template_name: "{{ template.name }}" applications: "{{ item.applications }}" with_items: template.zitems -- cgit v1.2.3 From 4e5ddae5018ebab6cba0ba83de2702adfabeb478 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Thu, 10 Sep 2015 11:25:08 -0400 Subject: Adding capability to have descriptions on triggers --- roles/lib_zabbix/tasks/create_template.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'roles/lib_zabbix/tasks') diff --git a/roles/lib_zabbix/tasks/create_template.yml b/roles/lib_zabbix/tasks/create_template.yml index 6307bf57a..fd0cdd46f 100644 --- a/roles/lib_zabbix/tasks/create_template.yml +++ b/roles/lib_zabbix/tasks/create_template.yml @@ -44,8 +44,9 @@ zbx_server: "{{ server }}" zbx_user: "{{ user }}" zbx_password: "{{ password }}" - description: "{{ item.description }}" - dependencies: "{{ item.dependencies | default([], true) }}" + name: "{{ item.name }}" + description: "{{ item.description | default('', True) }}" + dependencies: "{{ item.dependencies | default([], True) }}" expression: "{{ item.expression }}" priority: "{{ item.priority }}" url: "{{ item.url | default(None, True) }}" -- cgit v1.2.3 From 19f91f7b7844ec3c89d8ee0e6a6c08655e897266 Mon Sep 17 00:00:00 2001 From: Matt Woodson Date: Fri, 25 Sep 2015 12:05:03 -0400 Subject: added support for dynaic keys and items. added dynamic filesystems to zabbix --- roles/lib_zabbix/tasks/create_template.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'roles/lib_zabbix/tasks') diff --git a/roles/lib_zabbix/tasks/create_template.yml b/roles/lib_zabbix/tasks/create_template.yml index fd0cdd46f..b4821bdc7 100644 --- a/roles/lib_zabbix/tasks/create_template.yml +++ b/roles/lib_zabbix/tasks/create_template.yml @@ -52,3 +52,31 @@ url: "{{ item.url | default(None, True) }}" with_items: template.ztriggers when: template.ztriggers is defined + +- name: Create Discoveryrules + zbx_discoveryrule: + zbx_server: "{{ server }}" + zbx_user: "{{ user }}" + zbx_password: "{{ password }}" + name: "{{ item.name }}" + key: "{{ item.key }}" + lifetime: "{{ item.lifetime }}" + template_name: "{{ template.name }}" + description: "{{ item.description | default('', True) }}" + with_items: template.zdiscoveryrules + when: template.zdiscoveryrules is defined + +- name: Create Item Prototype + zbx_itemprototype: + zbx_server: "{{ server }}" + zbx_user: "{{ user }}" + zbx_password: "{{ password }}" + name: "{{ item.name }}" + key: "{{ item.key }}" + discoveryrule_key: "{{ item.discoveryrule_key }}" + value_type: "{{ item.value_type }}" + template_name: "{{ template.name }}" + applications: "{{ item.applications }}" + description: "{{ item.description | default('', True) }}" + with_items: template.zitemprototypes + when: template.zitemprototypes is defined -- cgit v1.2.3 From 3a15b711e8d47e7365e361534533c28e234e87d3 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Mon, 28 Sep 2015 12:03:43 -0400 Subject: Trigger prototype support --- roles/lib_zabbix/tasks/create_template.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'roles/lib_zabbix/tasks') diff --git a/roles/lib_zabbix/tasks/create_template.yml b/roles/lib_zabbix/tasks/create_template.yml index b4821bdc7..62259b680 100644 --- a/roles/lib_zabbix/tasks/create_template.yml +++ b/roles/lib_zabbix/tasks/create_template.yml @@ -66,7 +66,7 @@ with_items: template.zdiscoveryrules when: template.zdiscoveryrules is defined -- name: Create Item Prototype +- name: Create Item Prototypes zbx_itemprototype: zbx_server: "{{ server }}" zbx_user: "{{ user }}" @@ -80,3 +80,16 @@ description: "{{ item.description | default('', True) }}" with_items: template.zitemprototypes when: template.zitemprototypes is defined + +- name: Create Trigger Prototypes + zbx_triggerprototype: + zbx_server: "{{ server }}" + zbx_user: "{{ user }}" + zbx_password: "{{ password }}" + name: "{{ item.name }}" + expression: "{{ item.expression }}" + url: "{{ item.url | default('', True) }}" + priority: "{{ item.priority | default('average', True) }}" + description: "{{ item.description | default('', True) }}" + with_items: template.ztriggerprototypes + when: template.ztriggerprototypes is defined -- cgit v1.2.3 From e40b829103db88072c0e5fc759bff239cb214a43 Mon Sep 17 00:00:00 2001 From: Thomas Wiest Date: Wed, 30 Sep 2015 15:22:36 -0400 Subject: added Template Ops Tools --- roles/lib_zabbix/tasks/create_template.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'roles/lib_zabbix/tasks') diff --git a/roles/lib_zabbix/tasks/create_template.yml b/roles/lib_zabbix/tasks/create_template.yml index 62259b680..41381e76c 100644 --- a/roles/lib_zabbix/tasks/create_template.yml +++ b/roles/lib_zabbix/tasks/create_template.yml @@ -9,7 +9,8 @@ - set_fact: - lzbx_applications: "{{ template.zitems | oo_select_keys_from_list(['applications']) | oo_flatten | unique }}" + lzbx_item_applications: "{{ template.zitems | default([], True) | oo_select_keys_from_list(['applications']) | oo_flatten | unique }}" + lzbx_itemprototype_applications: "{{ template.zitemprototypes | default([], True) | oo_select_keys_from_list(['applications']) | oo_flatten | unique }}" - name: Create Application zbx_application: @@ -18,9 +19,11 @@ zbx_password: "{{ password }}" name: "{{ item }}" template_name: "{{ template.name }}" - with_items: lzbx_applications + with_items: + - "{{ lzbx_item_applications }}" + - "{{ lzbx_itemprototype_applications }}" register: created_application - when: template.zitems is defined + when: template.zitems is defined or template.zitemprototypes is defined - name: Create Items zbx_item: -- cgit v1.2.3 From ba80a2c5b19614c87d2ce0568ed8830c62d40f95 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Tue, 20 Oct 2015 17:00:14 -0400 Subject: Zabbix server stat fixes. enable the proper item types. --- roles/lib_zabbix/tasks/create_template.yml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'roles/lib_zabbix/tasks') diff --git a/roles/lib_zabbix/tasks/create_template.yml b/roles/lib_zabbix/tasks/create_template.yml index 41381e76c..df7888a95 100644 --- a/roles/lib_zabbix/tasks/create_template.yml +++ b/roles/lib_zabbix/tasks/create_template.yml @@ -38,6 +38,8 @@ units: "{{ item.units | default('', True) }}" template_name: "{{ template.name }}" applications: "{{ item.applications }}" + zabbix_type: "{{ item.zabbix_type | default(2, True) }}" + interval: "{{ item.interval | default(60, True) }}" with_items: template.zitems register: created_items when: template.zitems is defined -- cgit v1.2.3 From c16cc8398b4313cdee12a1332a268c8979481ac7 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Tue, 20 Oct 2015 17:31:09 -0400 Subject: Adding delta feature to zbx_item --- roles/lib_zabbix/tasks/create_template.yml | 1 + 1 file changed, 1 insertion(+) (limited to 'roles/lib_zabbix/tasks') diff --git a/roles/lib_zabbix/tasks/create_template.yml b/roles/lib_zabbix/tasks/create_template.yml index df7888a95..d5168a9f4 100644 --- a/roles/lib_zabbix/tasks/create_template.yml +++ b/roles/lib_zabbix/tasks/create_template.yml @@ -40,6 +40,7 @@ applications: "{{ item.applications }}" zabbix_type: "{{ item.zabbix_type | default(2, True) }}" interval: "{{ item.interval | default(60, True) }}" + delta: "{{ item.delta | default(0, True) }}" with_items: template.zitems register: created_items when: template.zitems is defined -- cgit v1.2.3