74 lines
2.1 KiB
Plaintext

# {{ ansible_managed }}
{% set c = icinga_contact_default %}
{% if icinga_contact is defined %}
{% set c = icinga_contact %}
{% endif %}
object Host "{{ hostvars[item].inventory_hostname }}" {
import "generic-host"
address = "{{ hostvars[item].ansible_host }}"
vars.os = "routeros"
vars.notification["mail"] = {
groups = [ {{ c }} ]
}
icon_image = "routeros.png"
icon_image_alt = "MikroTik RouterOS"
}
object Service "ssh" {
import "generic-service"
host_name = "{{ hostvars[item].inventory_hostname }}"
check_command = "ssh"
{% if hostvars[item].ansible_port is defined %}
vars.ssh_port = "{{ hostvars[item].ansible_port }}"
{% endif %}
}
object Service "mikrotik" {
import "generic-service"
host_name = "{{ hostvars[item].inventory_hostname }}"
check_command = "mikrotik"
vars.snmpuser = "{{ hostvars[item].snmpuser }}"
vars.snmppasswd = "{{ hostvars[item].snmppasswd }}"
}
{% if 'check_ltebackup' in hostvars[item].group_names %}
object Service "ltebackup" {
import "generic-service"
host_name = "{{ hostvars[item].inventory_hostname }}"
check_command = "mikrotik_ltebackup"
vars.user = "{{ hostvars[item].apiuser }}"
vars.password = "{{ hostvars[item].apipasswd }}"
vars.ca = "{{ hostvars[item].apica }}"
}
{% endif %}
{% if hostvars[item].ov_backup_ip is defined %}
object Service "ping_ov_backup_ip" {
import "generic-service"
host_name = "{{ hostvars[item].inventory_hostname }}"
check_command = "ping"
vars.ping_address = "{{ hostvars[item].ov_backup_ip }}"
}
{% endif %}
{% if hostvars[item].extra_ping is defined %}
object Service "ping_{{ hostvars[item].extra_ping }}" {
import "generic-service"
host_name = "{{ hostvars[item].inventory_hostname }}"
check_command = "ping"
vars.ping_address = "{{ hostvars[item].extra_ping }}"
}
{% endif %}
{% if hostvars[item].extra_ssh is defined %}
object Service "ssh_{{ hostvars[item].extra_ssh }}" {
import "generic-service"
host_name = "{{ hostvars[item].inventory_hostname }}"
check_command = "ssh"
vars.ssh_address = "{{ hostvars[item].extra_ssh }}"
}
{% endif %}
# vim: set tabstop=4 shiftwidth=4 expandtab smarttab: