add a minimum aws template for nagios
This commit is contained in:
parent
84f5cccaff
commit
32d31b1d9d
1 changed files with 32 additions and 0 deletions
32
roles/nagios_server/templates/nagios/hosts/aws-hosts.cfg.j2
Normal file
32
roles/nagios_server/templates/nagios/hosts/aws-hosts.cfg.j2
Normal file
|
@ -0,0 +1,32 @@
|
|||
{% for host in groups['all']|sort %}
|
||||
{% if hostvars[host].datacenter == 'ec2' and hostvars[host].nagios_Check_Services['ping'] == true %}
|
||||
define host {
|
||||
{% if 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 %}
|
||||
address {{ host }}
|
||||
{% endif %}
|
||||
{% if hostvars[host]['vmhost'] is defined %}
|
||||
parents {{ hostvars[host]['vmhost'] }}
|
||||
{% elif hostvars[host].datacenter is defined %}
|
||||
parents internetx-gw
|
||||
{% endif %}
|
||||
}
|
||||
{% endif %}
|
||||
{% endfor %}
|
Loading…
Add table
Add a link
Reference in a new issue