Compare commits

..

2 Commits

2 changed files with 33 additions and 14 deletions

View File

@ -24,27 +24,39 @@ define service {
register 0
}
# Contacts
define contact {
contact_name salt
host_notifications_enabled 1
host_notification_period 24x7
host_notification_commands notify-host-by-email
service_notifications_enabled 1
service_notification_period 24x7
service_notification_commands notify-service-by-email
email rehashedsalt@cock.li
}
# Default hostgroup
define hostgroup {
hostgroup_name ansible
alias Ansible-managed Hosts
}
{% if nagios_contacts is defined %}
# Contacts
# Everything here is defined in nagios_contacts
{% for contact in nagios_contacts %}
define contact {
contact_name {{ contact.name }}
alias {{ contact.alias | default(contact.name, true ) }}
host_notifications_enabled {{ contact.host_notifications_enabled | default('1', true) }}
host_notification_period {{ contact.host_notification_period | default('24x7', true) }}
host_notification_options {{ contact.host_notification_options | default('d,u,r,f', true ) }}
host_notification_commands {{ contact.host_notification_commands }}
service_notifications_enabled {{ contact.service_notifications_enabled | default('1', true) }}
service_notification_period {{ contact.service_notification_period | default('24x7', true) }}
service_notification_options {{ contact.service_notification_options | default('w,c,r,f', true ) }}
service_notification_commands {{ contact.service_notification_commands }}
{% if contact.extra is defined %}
{% for kvp in contact.extra %}
{{ kvp.key }} {{ kvp.value }}
{% endfor %}
{% endif %}
}
{% endfor %}
{% endif %}
{% if nagios_commands is defined %}
# Commands
# Everything here is defined in nagios_commands
{% if nagios_commands is defined %}
{% for command in nagios_commands %}
define command {
command_name {{ command.name }}
@ -58,9 +70,9 @@ define command {
{% endfor %}
{% endif %}
{% if nagios_services is defined %}
# Services
# Everything here is defined in nagios_services
{% if nagios_services is defined %}
{% for service in nagios_services %}
define service {
use ansible-generic-service

View File

@ -5,6 +5,13 @@
- name: template out config for nagios
template: src=nagios-ansible.cfg.j2 dest=/data/nagios/etc/objects/ansible.cfg owner=root group=root mode=0644
vars:
nagios_contacts:
- name: salt
host_notification_commands: notify-host-by-email
service_notification_commands: notify-service-by-email
extra:
- key: email
value: rehashedsalt@cock.li
nagios_commands:
# This command is included in the container image
- name: check_nrpe