Verified Commit a7f8c252 authored by Adrian Schollmeyer's avatar Adrian Schollmeyer
Browse files

generator/hosts: Add support for generic remote and partition checks

parent 5f6efd8d
......@@ -61,11 +61,13 @@ class Icinga2Host:
self.ip6s = []
self.additional_ssh_ports = []
self.remote_checks = []
self.nrpe_checks = []
self.nrpe_disks = []
self.procs = []
self.local_checks = []
self.network_checks = []
self.partitions = []
self.smart = []
self.smart_sectors = []
self.disk_io = []
......@@ -104,6 +106,10 @@ class Icinga2Host:
self.apt = "passive"
def add_partition(self, partition):
self.partitions.append(partition)
def add_smart(self, disk):
self.smart.append(disk)
......@@ -128,6 +134,10 @@ class Icinga2Host:
self.nrpe_disks.append(name)
def add_remote_check(self, name):
self.remote_checks.append(name)
def enable_nrpe(self):
self.nrpe = True
......@@ -521,6 +531,18 @@ class NetBoxParser:
except KeyError:
pass
try:
for remote_check in monitoring_config_context["remote_checks"]:
self.host.add_remote_check(remote_check)
except KeyError:
pass
try:
for partition in monitoring_config_context["partitions"]:
self.host.add_partition(partition)
except KeyError:
pass
try:
if monitoring_config_context["procs"]:
for proc in monitoring_config_context["procs"]:
......
......@@ -50,6 +50,8 @@ object Host "{{ vars.name }}" {
vars.procs["{{ check }}"] = {}{% endfor %}
// disk checks
{%- for partition in vars.partitions %}
vars.partition["{{ partition }}"] = {}{% endfor %}
{%- for disk in vars.smart %}
vars.smart["{{ disk }}"] = {}{% endfor %}
{%- for disk in vars.smart_sectors %}
......@@ -59,13 +61,15 @@ object Host "{{ vars.name }}" {
{%- for disk in vars.disk_temp %}
vars.disk_temp["{{ disk }}"] = {}{% endfor %}
// NRPE checks
// Remote checks
{%- if vars.nrpe is defined and vars.nrpe %}
vars.nrpe = true{% endif %}
{%- for check in vars.nrpe_checks %}
vars.nrpe_check["check_{{ check }}"] = {}{% endfor %}
{%- for check in vars.nrpe_disks %}
vars.nrpe_disk["check_{{ check }}_disk"] = {}{% endfor %}
{%- for check in vars.remote_checks %}
vars.remote_check["{{ check }}"] = {}{% endfor %}
import "netbox-generated-host-post"
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment