Browse Source

icinga2: Make device and VM attributes available in Icinga2.

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
Maximilian Wilhelm 4 years ago
parent
commit
54d9fa6ea1
1 changed files with 22 additions and 0 deletions
  1. 22 0
      icinga2/host.conf.tmpl

+ 22 - 0
icinga2/host.conf.tmpl

@@ -52,6 +52,28 @@ object Host "{{ node_id }}" {
 {%- endfor %}
 	]
 
+{#- Bare-metal host #}
+{%- if node_config.get ('hardware', False) %}
+
+	# Bare metal host
+	vars.hardware = true
+	vars.manufacturer = "{{ node_config['manufacturer']|replace ('"', '\"') }}"
+	vars.model = "{{ node_config['model']|replace ('"', '\\"') }}"
+{%- endif %}
+
+{#- VM #}
+{%- if node_config.get ('virtual', False) %}
+
+	# VM
+	vars.virtual = true
+	vars.vm = {
+		"vcpus"  = {{ node_config['vm_config']['vcpus'] }},
+		"memory" = {{ node_config['vm_config']['memory'] }},
+		"disk"   = {{ node_config['vm_config']['disk'] }},
+	}
+{%- endif %}
+
+{#- Special monitoring related config for this host? #}
 {%- if 'host_vars' in monitoring_config %}
 
 	# Host vars for node