From a9d427d68917f73aa2dd16b7d628c660a0148bd6 Mon Sep 17 00:00:00 2001 From: Mark Rosenbaum Date: Fri, 30 May 2025 12:18:35 -0400 Subject: [PATCH] Added Nagios rdu3 configs --- .../nagios/hostgroups/all-rdu3.cfg.j2 | 39 +++++++++++++++++++ .../nagios/hosts/gateway-hosts.cfg.j2 | 18 ++++++++- .../nagios/hosts/rdu3-external.cfg.j2 | 9 +++++ .../templates/nagios/hosts/rdu3-hosts.cfg.j2 | 29 ++++++++++++++ .../nagios/hosts/rdu3-mgmt-hosts.cfg.j2 | 19 +++++++++ 5 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 roles/nagios_server/templates/nagios/hostgroups/all-rdu3.cfg.j2 create mode 100644 roles/nagios_server/templates/nagios/hosts/rdu3-external.cfg.j2 create mode 100644 roles/nagios_server/templates/nagios/hosts/rdu3-hosts.cfg.j2 create mode 100644 roles/nagios_server/templates/nagios/hosts/rdu3-mgmt-hosts.cfg.j2 diff --git a/roles/nagios_server/templates/nagios/hostgroups/all-rdu3.cfg.j2 b/roles/nagios_server/templates/nagios/hostgroups/all-rdu3.cfg.j2 new file mode 100644 index 0000000000..dd952704be --- /dev/null +++ b/roles/nagios_server/templates/nagios/hostgroups/all-rdu3.cfg.j2 @@ -0,0 +1,39 @@ +############### +# All Servers and associated devices (rdu3) +############### +## {{ env }} +{% for key, value in groups.items()|sort %} +{% if groups[key] != [] and key not in vars['exclude_rdu3_hostgroups'] %} +define hostgroup{ + hostgroup_name {{ key }} + alias {{ key }} + members {% for host in groups[key]|sort %}{% if hostvars[host].nagios_Can_Connect == true %}{{host}}, {% endif %}{% endfor %} +} +{% endif %} +{% endfor %} + +define hostgroup{ + hostgroup_name no_ping + alias no_ping + members {% for host in groups['all']|sort %}{% if hostvars[host].nagios_Check_Services['ping'] == true or hostvars[host].nagios_Can_Connect == true %}{{host}}, {% endif %}{% endfor %} +} + +## Services with minimal monitoring + +define hostgroup{ + hostgroup_name cloud_aws_group + alias cloud_aws_group + members {% for host in groups['cloud_aws']|sort %}{{host}}, {% endfor %} +} + +define hostgroup{ + hostgroup_name mincheckgrp + alias mincheckgrp + members {% for host in groups['all']|sort %}{% if hostvars[host].nagios_Check_Services['nrpe'] != true and hostvars[host].nagios_Can_Connect == true %}{{host}}, {% endif %}{% endfor %} +} + +define hostgroup{ + hostgroup_name routers + alias routers + members ibiblio-gw, dedicated-gw, host1plus-gw, internetx-gw, osuosl-gw, rdu-gw, rdu-cc-gw, iad2-gw, rdu3-gw +} \ No newline at end of file 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 c6adf6c054..a73ddf2dcc 100644 --- a/roles/nagios_server/templates/nagios/hosts/gateway-hosts.cfg.j2 +++ b/roles/nagios_server/templates/nagios/hosts/gateway-hosts.cfg.j2 @@ -24,13 +24,29 @@ define host { {% if vars['nagios_location'] == 'iad2_internal' %} address 10.3.163.254 {% elif vars['nagios_location'] == 'external' %} - address 209.132.185.206 + address 38.145.60.3 parents ibiblio-gw {% endif %} } +#Mark Note to Self: Come back and correct these later +# 'rdu3' +define host { + host_name rdu3-gw + alias rdu3 gateway + use mincheck + check_command check-host-alive4 +{% if vars['nagios_location'] == 'rdu3_internal' %} + address 10.16.163.254 +{% elif vars['nagios_location'] == 'external' %} + address 38.145.32.3 + parents ibiblio-gw +{% endif %} +} + + #'dedicatedsolutions' define host { host_name dedicated-gw diff --git a/roles/nagios_server/templates/nagios/hosts/rdu3-external.cfg.j2 b/roles/nagios_server/templates/nagios/hosts/rdu3-external.cfg.j2 new file mode 100644 index 0000000000..72e8fae0b4 --- /dev/null +++ b/roles/nagios_server/templates/nagios/hosts/rdu3-external.cfg.j2 @@ -0,0 +1,9 @@ +{% for host in vars["rdu3_external"]|sort %} +define host { + host_name {{ host }} + alias {{ host }} + use mincheck + address {{ host }} + parents rdu3-gw +} +{% endfor %} \ No newline at end of file diff --git a/roles/nagios_server/templates/nagios/hosts/rdu3-hosts.cfg.j2 b/roles/nagios_server/templates/nagios/hosts/rdu3-hosts.cfg.j2 new file mode 100644 index 0000000000..f436fd3848 --- /dev/null +++ b/roles/nagios_server/templates/nagios/hosts/rdu3-hosts.cfg.j2 @@ -0,0 +1,29 @@ +{% for host in groups['all']|sort %} +{% if hostvars[host].datacenter == 'rdu3' and hostvars[host].nagios_Can_Connect == true %} +define host { +{% if hostvars[host].nagios_Check_Services['nrpe'] == true %} + 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_ipv4_ip is defined %} + address {{ hostvars[host].eth0_ipv4_ip }} +{% elif hostvars[host].ansible_default_ipv4 is defined and hostvars[host].ansible_default_ipv4.address is defined %} + address {{ hostvars[host].ansible_default_ipv4.address }} +{% else %} + address {{ host }} +{% endif %} +{% if hostvars[host]['vmhost'] is defined %} + parents {{ hostvars[host]['vmhost'] }} +{% else %} + parents rdu3-gw +{% endif %} +} +{% endif %} +{% endfor %} \ No newline at end of file diff --git a/roles/nagios_server/templates/nagios/hosts/rdu3-mgmt-hosts.cfg.j2 b/roles/nagios_server/templates/nagios/hosts/rdu3-mgmt-hosts.cfg.j2 new file mode 100644 index 0000000000..201ecd6e14 --- /dev/null +++ b/roles/nagios_server/templates/nagios/hosts/rdu3-mgmt-hosts.cfg.j2 @@ -0,0 +1,19 @@ +{% for host in vars['rdu3_management_hosts']|sort %} +define host { + host_name {{ host }} + alias {{ host }} + use mincheck + address {{ host }} + parents rdu3-gw +} +{% endfor %} + +{% for host in vars['rdu3_management_limited']|sort %} +define host { + host_name {{ host }} + alias {{ host }} + use mincheck + address {{ host }} + parents rdu3-gw +} +{% endfor %} \ No newline at end of file