From 8b9c9a395b8436efc27ebd0407f7a6afff9fe6e2 Mon Sep 17 00:00:00 2001 From: Stephen Smoogen Date: Thu, 19 Mar 2020 16:14:55 +0000 Subject: [PATCH] fix cloud nagios --- inventory/cloud | 10 ++++++- .../templates/nagios/hosts/cloud-hosts.cfg.j2 | 30 ++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/inventory/cloud b/inventory/cloud index 92f0f86616..c52e6f3f4e 100644 --- a/inventory/cloud +++ b/inventory/cloud @@ -10,7 +10,6 @@ virthost-os02.fedorainfracloud.org virthost-os03.fedorainfracloud.org storinator01.fedorainfracloud.org cloudvmhost-aarch64-01.fedorainfracloud.org -cloud-noc01.fedorainfracloud.org ## ## New Community Hardware @@ -18,6 +17,14 @@ cloud-noc01.fedorainfracloud.org os-proxy01.fedorainfracloud.org os-proxy02.fedorainfracloud.org +[cloud_phx2_guests] +cloud-noc01.fedorainfracloud.org +armv7-test01.fedorainfracloud.org +armv7-test02.fedorainfracloud.org +aarch64-test01.fedorainfracloud.org +aarch64-test02.fedorainfracloud.org + + [cloud_aws] iddev.fedorainfracloud.org rawhide-test.fedorainfracloud.org @@ -57,3 +64,4 @@ ppc64le-test.fedorainfracloud.org [cloud:children] cloud_phx2 cloud_aws +cloud_phx2_guests diff --git a/roles/nagios_server/templates/nagios/hosts/cloud-hosts.cfg.j2 b/roles/nagios_server/templates/nagios/hosts/cloud-hosts.cfg.j2 index 2f845b04b6..ff4f86df74 100644 --- a/roles/nagios_server/templates/nagios/hosts/cloud-hosts.cfg.j2 +++ b/roles/nagios_server/templates/nagios/hosts/cloud-hosts.cfg.j2 @@ -14,7 +14,35 @@ define host { {% if hostvars[host].eth0_ip is defined %} address {{ hostvars[host].eth0_ip }} {% elif hostvars[host].ansible_default_ipv4 is defined %} -{% if hostvars[host].ansible_default_ipv4.address is defined and host not in groups['cloud_phx2'] %} +{% if hostvars[host].ansible_default_ipv4.address is defined %} + address {{ hostvars[host].ansible_default_ipv4.address }} +{% endif %} +{% else %} + address {{ host }} +{% endif %} +{% if hostvars[host].datacenter is defined %} + parents cloud-gw +{% endif %} +} +{% endfor %} + +{% for host in groups['cloud_phx2_guests']|sort %} +define host { +{% if hostvars[host].nagios_Check_Services['nrpe'] and vars['nagios_location'] == 'internal' %} + use defaulttemplate +{% else %} + use mincheck +{% endif %} + host_name {{ host }} +{% if hostvars[host].ansible_hostname is defined %} + alias {{ hostvars[host].ansible_hostname }} +{% else %} + alias {{ host }} +{% endif %} +{% if hostvars[host].eth0_ip is defined %} + address {{ hostvars[host].eth0_ip }} +{% elif hostvars[host].ansible_default_ipv4 is defined %} +{% if hostvars[host].ansible_default_ipv4.address is defined %} address {{ hostvars[host].ansible_default_ipv4.address }} {% endif %} {% else %}