Have Nagios ignore decom hosts

For HOSTS, mind. Services are still gonna need some love
Might honestly just have this operate off of host vars instead, lower the number of lookups, yaknow?
This commit is contained in:
Salt 2022-02-23 16:44:42 -06:00
parent 1d452ae04b
commit 0bfcd5ea2b

View File

@ -137,7 +137,7 @@ define hostgroup {
{% endfor %} {% endfor %}
# Hosts # Hosts
{% for host in query('netbox.netbox.nb_lookup', 'devices', api_endpoint='https://netbox.desu.ltd', token=netbox_token) + query('netbox.netbox.nb_lookup', 'virtual-machines', api_endpoint='https://netbox.desu.ltd', token=netbox_token)%} {% for host in query('netbox.netbox.nb_lookup', 'devices', api_filter='status=active', api_endpoint='https://netbox.desu.ltd', token=netbox_token) + query('netbox.netbox.nb_lookup', 'virtual-machines', api_filter='status=active', api_endpoint='https://netbox.desu.ltd', token=netbox_token)%}
{% if host.value.primary_ip %} {% if host.value.primary_ip %}
{% for tag in host.value.tags %} {% for tag in host.value.tags %}
{% if tag.slug == "nagios" %} {% if tag.slug == "nagios" %}
@ -176,6 +176,7 @@ define host {
{% elif service.value.virtual_machine %} {% elif service.value.virtual_machine %}
{% set host_name = service.value.virtual_machine.name %} {% set host_name = service.value.virtual_machine.name %}
{% endif %} {% endif %}
{% if host_name is defined %}
# {{ host_name }} - {{ service.value.display }} # {{ host_name }} - {{ service.value.display }}
# Description: {{ service.value.description }} # Description: {{ service.value.description }}
# Created: {{ service.value.created }} # Created: {{ service.value.created }}
@ -231,4 +232,5 @@ define service {
{% endif %} {% endif %}
{# #} {# #}
{% endfor %} {% endfor %}
{% endif %}
{% endfor %} {% endfor %}