diff --git a/inventory/group_vars/proxies b/inventory/group_vars/proxies index e7a4f7a253..188e75d8de 100644 --- a/inventory/group_vars/proxies +++ b/inventory/group_vars/proxies @@ -82,3 +82,7 @@ tcp_ports: [ # custom_rules ] varnish_group: proxies +zabbix_templates: + - group: "proxies" # Ansible group + template: "external_hosts_https.json" # Template name in roles/zabbix/zabbix_templates/files/templatename.json + hostgroup: "fedora external hosts" # Zabbix hostgroup diff --git a/inventory/group_vars/proxies_stg b/inventory/group_vars/proxies_stg index 0c02fc8a4c..6f92e7dc13 100644 --- a/inventory/group_vars/proxies_stg +++ b/inventory/group_vars/proxies_stg @@ -72,3 +72,4 @@ tcp_ports: [ # custom_rules ] varnish_group: proxies +zabbix_templates: "{{ [] }}" # For the moment we have no proxies external to IAD2, if this changes, put in the changes in the production group. diff --git a/inventory/group_vars/releng_compose_stg b/inventory/group_vars/releng_compose_stg index 52f2fa10e2..21e818aa82 100644 --- a/inventory/group_vars/releng_compose_stg +++ b/inventory/group_vars/releng_compose_stg @@ -11,4 +11,4 @@ koji_weburl: "https://koji.stg.fedoraproject.org/koji" mem_size: 8192 nfs_mount_opts: "rw,hard,bg,intr,noatime,nodev,nosuid,sec=sys,nfsvers=3" num_cpus: 4 -zabbix_templates: "{{ [] }}" +zabbix_templates: "{{ [] }}" # We don't run composes in staging, but if this changes, consider putting in the configuration in the production group. diff --git a/playbooks/groups/proxies.yml b/playbooks/groups/proxies.yml index 367597fd04..4bb0cfc388 100644 --- a/playbooks/groups/proxies.yml +++ b/playbooks/groups/proxies.yml @@ -26,6 +26,7 @@ - rkhunter - nagios_client - zabbix/zabbix_agent + - zabbix/zabbix_templates - collectd/base - sudo - rsyncd diff --git a/roles/zabbix/zabbix_templates/files/external_hosts_https.json b/roles/zabbix/zabbix_templates/files/external_hosts_https.json index 224a03b46f..1cfeafe139 100644 --- a/roles/zabbix/zabbix_templates/files/external_hosts_https.json +++ b/roles/zabbix/zabbix_templates/files/external_hosts_https.json @@ -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"}]}]}]}} diff --git a/roles/zabbix/zabbix_templates/tasks/add_hosts_to_hostgroups.yml b/roles/zabbix/zabbix_templates/tasks/add_hosts_to_hostgroups.yml index cd4684e6f6..0f75a6ed65 100644 --- a/roles/zabbix/zabbix_templates/tasks/add_hosts_to_hostgroups.yml +++ b/roles/zabbix/zabbix_templates/tasks/add_hosts_to_hostgroups.yml @@ -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 }}"