From 3ba920f5bcb8365c733456b6ec788abba8b9f888 Mon Sep 17 00:00:00 2001 From: Stephen Smoogen Date: Fri, 15 May 2020 19:06:56 -0400 Subject: [PATCH] put in tests to remove nagios from trying to talk to iad2 boxes --- inventory/group_vars/nagios | 3 +++ .../templates/nagios/hosts/gateway-hosts.cfg.j2 | 16 ++++++++++++++++ .../templates/nagios/hosts/iad2-external.cfg.j2 | 9 +++++++++ .../templates/nagios/servicegroups/bodhi.cfg.j2 | 2 +- .../templates/nagios/servicegroups/fas.cfg.j2 | 2 +- .../nagios/servicegroups/fp-wiki.cfg.j2 | 2 +- .../nagios/servicegroups/mirrorlist.cfg.j2 | 2 +- 7 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 roles/nagios_server/templates/nagios/hosts/iad2-external.cfg.j2 diff --git a/inventory/group_vars/nagios b/inventory/group_vars/nagios index d5dc48507d..16a21520bb 100644 --- a/inventory/group_vars/nagios +++ b/inventory/group_vars/nagios @@ -130,6 +130,9 @@ phx2_external: - secondary01.fedoraproject.org - stg.fedoraproject.org +iad2_external: + - proxy-iad01.fedoraproject.org + # When you have a group which comes up with empty members in all.cfg, it # is because it contains all hosts which aren't pinganble. You may want # to add that group to this list. Other items on this list are ones diff --git a/roles/nagios_server/templates/nagios/hosts/gateway-hosts.cfg.j2 b/roles/nagios_server/templates/nagios/hosts/gateway-hosts.cfg.j2 index 8bb2d1c1ef..58b53bd5e4 100644 --- a/roles/nagios_server/templates/nagios/hosts/gateway-hosts.cfg.j2 +++ b/roles/nagios_server/templates/nagios/hosts/gateway-hosts.cfg.j2 @@ -121,3 +121,19 @@ define host { {% endif %} } + +#'iad2' +define host { + host_name iad2-gw + alias iad2 cage gateway + use mincheck + check_command check-host-alive4 + address 209.132.185.254 +{% if vars['nagios_location'] == 'internal' %} + parents phx2-gw +{% else %} + parents ibiblio-gw +{% endif %} + +} + diff --git a/roles/nagios_server/templates/nagios/hosts/iad2-external.cfg.j2 b/roles/nagios_server/templates/nagios/hosts/iad2-external.cfg.j2 new file mode 100644 index 0000000000..38d02046e6 --- /dev/null +++ b/roles/nagios_server/templates/nagios/hosts/iad2-external.cfg.j2 @@ -0,0 +1,9 @@ +{% for host in vars["iad2_external"]|sort %} +define host { + host_name {{ host }} + alias {{ host }} + use mincheck + address {{ host }} + parents iad2-gw +} +{% endfor %} diff --git a/roles/nagios_server/templates/nagios/servicegroups/bodhi.cfg.j2 b/roles/nagios_server/templates/nagios/servicegroups/bodhi.cfg.j2 index 80f9c54e32..5a5837eef9 100644 --- a/roles/nagios_server/templates/nagios/servicegroups/bodhi.cfg.j2 +++ b/roles/nagios_server/templates/nagios/servicegroups/bodhi.cfg.j2 @@ -1,6 +1,6 @@ define servicegroup { servicegroup_name bodhi alias Bodhi - members {% for host in groups['proxies'] %}{{host}}, http-bodhi2 {% if not loop.last %} , {% endif %} {% endfor %} + members {% for host in groups['proxies']|sort %}{% if hostvars[host].nagios_Can_Connect == true %}{{host}}, http-bodhi2 {% if not loop.last %} , {% endif %}{% endif %} {% endfor %} } diff --git a/roles/nagios_server/templates/nagios/servicegroups/fas.cfg.j2 b/roles/nagios_server/templates/nagios/servicegroups/fas.cfg.j2 index dec5c20378..363d117d25 100644 --- a/roles/nagios_server/templates/nagios/servicegroups/fas.cfg.j2 +++ b/roles/nagios_server/templates/nagios/servicegroups/fas.cfg.j2 @@ -1,6 +1,6 @@ define servicegroup { servicegroup_name fas alias Fedora Account System - members {% for host in groups['proxies'] %}{{host}}, http-accounts, {% endfor %}{% for host in groups['fas'] %}{{host}}, http-accounts, {% endfor %} db-fas01.phx2.fedoraproject.org,Check FAS DB + members {% for host in groups['proxies']|sort %}{% if hostvars[host].nagios_Can_Connect == true %}{{host}}, http-accounts, {% endif %}{% endfor %}{% for host in groups['fas'] %}{{host}}, http-accounts, {% endfor %} db-fas01.phx2.fedoraproject.org,Check FAS DB } diff --git a/roles/nagios_server/templates/nagios/servicegroups/fp-wiki.cfg.j2 b/roles/nagios_server/templates/nagios/servicegroups/fp-wiki.cfg.j2 index ae5baeb325..6d2ec64571 100644 --- a/roles/nagios_server/templates/nagios/servicegroups/fp-wiki.cfg.j2 +++ b/roles/nagios_server/templates/nagios/servicegroups/fp-wiki.cfg.j2 @@ -1,7 +1,7 @@ define servicegroup { servicegroup_name fp-wiki alias Fedora Project Wiki - members {% for host in groups['proxies'] %}{{host}}, http-fedoraproject.org-wiki , {% endfor %}{% for host in groups['proxies'] %}{{host}}, http-fedoraproject.org-wiki-non-cached {% if not loop.last %} , {% endif %} {% endfor %} + members {% for host in groups['proxies']|sort %}{% if hostvars[host].nagios_Can_Connect == true %}{{host}}, http-fedoraproject.org-wiki , {% endfor %}{% for host in groups['proxies'|sort] %}{% if hostvars[host].nagios_Can_Connect == true %}{{host}}, http-fedoraproject.org-wiki-non-cached {% if not loop.last %} , {% endif %} {% endif %}{% endfor %} } diff --git a/roles/nagios_server/templates/nagios/servicegroups/mirrorlist.cfg.j2 b/roles/nagios_server/templates/nagios/servicegroups/mirrorlist.cfg.j2 index bd78bd7e42..e1dc818110 100644 --- a/roles/nagios_server/templates/nagios/servicegroups/mirrorlist.cfg.j2 +++ b/roles/nagios_server/templates/nagios/servicegroups/mirrorlist.cfg.j2 @@ -1,7 +1,7 @@ define servicegroup { servicegroup_name mirrorlist alias Mirrorlist - members {% for host in groups['proxies'] %}{{host}}, http-mirrors.fedoraproject.org-mirrorlist {% if not loop.last %} , {% endif %} {% endfor %} + members {% for host in groups['proxies']|sort %}{% if hostvars[host].nagios_Can_Connect == true %}{{host}}, http-mirrors.fedoraproject.org-mirrorlist{% if not loop.last %} , {% endif %}{% endif %} {% endfor %} }