summaryrefslogtreecommitdiffstats
path: root/playbooks/adhoc
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks/adhoc')
-rw-r--r--playbooks/adhoc/noc/create_maintenance.yml36
-rw-r--r--playbooks/adhoc/noc/get_zabbix_problems.yml2
2 files changed, 37 insertions, 1 deletions
diff --git a/playbooks/adhoc/noc/create_maintenance.yml b/playbooks/adhoc/noc/create_maintenance.yml
new file mode 100644
index 000000000..c0ec57ce1
--- /dev/null
+++ b/playbooks/adhoc/noc/create_maintenance.yml
@@ -0,0 +1,36 @@
+---
+#ansible-playbook -e 'oo_desc=kwoodson test' -e 'oo_name=kwoodson test name' -e 'oo_start=1435715357' -e 'oo_stop=1435718985' -e 'oo_hostids=11549' create_maintenance.yml
+- name: 'Create a maintenace object in zabbix'
+ hosts: localhost
+ gather_facts: no
+ roles:
+ - os_zabbix
+ vars:
+ oo_hostids: ''
+ oo_groupids: ''
+ post_tasks:
+ - assert:
+ that: oo_desc is defined
+
+ - zbxapi:
+ server: https://noc2.ops.rhcloud.com/zabbix/api_jsonrpc.php
+ zbx_class: Maintenance
+ state: present
+ params:
+ name: "{{ oo_name }}"
+ description: "{{ oo_desc }}"
+ active_since: "{{ oo_start }}"
+ active_till: "{{ oo_stop }}"
+ maintenance_type: "0"
+ output: extend
+ hostids: "{{ oo_hostids.split(',') | default([]) }}"
+#groupids: "{{ oo_groupids.split(',') | default([]) }}"
+ timeperiods:
+ - start_time: "{{ oo_start }}"
+ period: "{{ oo_stop }}"
+ selectTimeperiods: extend
+
+ register: maintenance
+
+ - debug: var=maintenance
+
diff --git a/playbooks/adhoc/noc/get_zabbix_problems.yml b/playbooks/adhoc/noc/get_zabbix_problems.yml
index 02bffc1d2..4b94fa228 100644
--- a/playbooks/adhoc/noc/get_zabbix_problems.yml
+++ b/playbooks/adhoc/noc/get_zabbix_problems.yml
@@ -11,7 +11,7 @@
- zbxapi:
server: https://noc2.ops.rhcloud.com/zabbix/api_jsonrpc.php
zbx_class: Trigger
- action: get
+ state: list
params:
only_true: true
output: extend