Browse Source

icinga2: Allow setting host/service params from pillar.

Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>
Maximilian Wilhelm 6 years ago
parent
commit
af1abdb482
1 changed files with 14 additions and 0 deletions
  1. 14 0
      icinga2/host.conf.tmpl

+ 14 - 0
icinga2/host.conf.tmpl

@@ -5,6 +5,7 @@
 {%- set sites = node_config.get ('sites', []) %}
 {%- set address = salt['ffho_net.get_loopback_ip'] (node_config, node_id, 'v4') %}
 {%- set address6 = salt['ffho_net.get_loopback_ip'] (node_config, node_id, 'v6') %}
+{%- set monitoring_config = node_config.get ('monitoring', {}) %}
 
 {%- if 'icinga2server' not in roles %}
 object Endpoint "{{ node_id }}" {
@@ -38,4 +39,17 @@ object Host "{{ node_id }}" {
 		"{{ site }}",
 {%- endfor %}
 	]
+
+{%- if 'service_param' in monitoring_config %}
+
+	vars.service_param = {
+  {%- for service, params in monitoring_config.get ('service_param').items ()|sort %}
+		"{{ service }}" = {
+    {%- for entry, value in params.items ()|sort %}
+			"{{ entry }}" = "{{ value }}",
+    {%- endfor %}
+		},
+  {%- endfor %}
+	}
+{%- endif %}
 }