zabbix: template to handle external hosts

Signed-off-by: David Kirwan <davidkirwanirl@gmail.com>
This commit is contained in:
David Kirwan 2024-04-25 11:25:26 +01:00
parent 1678a72e26
commit 9d97299285
No known key found for this signature in database
GPG key ID: A5893AB6474AC37D
6 changed files with 9 additions and 2 deletions

View file

@ -1 +1 @@
{"zabbix_export": {"version": "6.0", "groups": [{"uuid": "67e9fe194588431d8434f52f25d20dbd", "name": "fedora external hosts"}], "templates": [{"uuid": "eb3e5e398e694a36ba60ccf0b27c3688", "template": "external_hosts_https.json", "name": "fedora external hosts https", "groups": [{"name": "fedora external hosts"}], "items": [{"uuid": "6dd849983d014037be0f0903bf39727f", "name": "http external host check", "type": "HTTP_AGENT", "key": "http_value_search", "delay": "5m", "trends": "0", "value_type": "TEXT", "preprocessing": [{"type": "REGEX", "parameters": ["HTTP/2 ([0-9]+)", "\\1"]}], "timeout": "15s", "url": "https://{HOSTNAME}", "retrieve_mode": "HEADERS", "output_format": "JSON", "triggers": [{"uuid": "db4080a5128c4550b7e8fefa48c2b41c", "expression": "not(last(/external_hosts_https.json/http_value_search)=200)", "name": "external host not healthy", "priority": "HIGH"}]}]}]}}
{"zabbix_export": {"version": "6.0", "groups": [{"uuid": "67e9fe194588431d8434f52f25d20dbd", "name": "fedora external hosts"}], "templates": [{"uuid": "eb3e5e398e694a36ba60ccf0b27c3688", "template": "external_hosts_https.json", "name": "fedora external hosts https", "groups": [{"name": "fedora external hosts"}], "items": [{"uuid": "6dd849983d014037be0f0903bf39727f", "name": "http external host check", "type": "HTTP_AGENT", "key": "http_value_search", "delay": "5m", "trends": "0", "value_type": "TEXT", "preprocessing": [{"type": "REGEX", "parameters": ["HTTP/2 ([0-9]+)", "\\1"]}], "timeout": "15s", "url": "https://{HOST.NAME}.fedoraproject.org", "retrieve_mode": "HEADERS", "output_format": "JSON", "triggers": [{"uuid": "db4080a5128c4550b7e8fefa48c2b41c", "expression": "not(last(/external_hosts_https.json/http_value_search)=200)", "name": "external host not healthy", "priority": "HIGH"}]}]}]}}

View file

@ -3,6 +3,7 @@
community.zabbix.zabbix_host:
host_name: "{{ inventory_hostname }}"
host_groups: "{{ item['hostgroup']}}"
visible_name: "{{ inventory_hostname_short }}"
# link_templates: "{{ item['template'] }}"
force: false
with_items: "{{ zabbix_templates }}"