From b7f9164fb950302863474fa0cef2caed6fc624b0 Mon Sep 17 00:00:00 2001 From: Stephen Smoogen Date: Wed, 26 Feb 2020 21:19:11 +0000 Subject: [PATCH] Add a test to see if sshd:true will allow some hosts to work in nagios all.cfg.j2 --- inventory/group_vars/nagios | 20 ++++--------------- .../templates/nagios/hostgroups/all.cfg.j2 | 2 +- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/inventory/group_vars/nagios b/inventory/group_vars/nagios index 256c5e2b85..4db00aabd9 100644 --- a/inventory/group_vars/nagios +++ b/inventory/group_vars/nagios @@ -152,25 +152,13 @@ phx2_external: - secondary01.fedoraproject.org - stg.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 +# where it is an enormous group not needed. # Exclude these ansible host groups in hostgroups/all.cfg exclude_hostgroups: - nixnagios - - aarch64_test - - cloud_aws - - copr_aws - - copr_back_aws - - copr_back_dev_aws - - copr_dev_aws - - copr_dist_git_aws - - copr_dist_git_dev_aws - - copr_front_aws - - copr_front_dev_aws - - copr_keygen_aws - - copr_keygen_dev_aws - dbgserver_stg - - ipsilon_dev - - maintainer_test - - retrace_stg - - retrace_stg_aws - virt_guest - virt_host diff --git a/roles/nagios_server/templates/nagios/hostgroups/all.cfg.j2 b/roles/nagios_server/templates/nagios/hostgroups/all.cfg.j2 index 1199c1dd40..6546cdb108 100644 --- a/roles/nagios_server/templates/nagios/hostgroups/all.cfg.j2 +++ b/roles/nagios_server/templates/nagios/hostgroups/all.cfg.j2 @@ -7,7 +7,7 @@ define hostgroup{ hostgroup_name {{ key }} alias {{ key }} - members {% for host in groups[key]|sort %}{% if hostvars[host].nagios_Check_Services['ping'] == true %}{{host}}, {% endif %}{% endfor %} + members {% for host in groups[key]|sort %}{% if hostvars[host].nagios_Check_Services['ping'] == true or hostvars[host].nagios_Check_Services['sshd'] == true %}{{host}}, {% endif %}{% endfor %} } {% endif %}