Browse Source

icinga2: Use platform from NetBox as OS

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
Maximilian Wilhelm 9 months ago
parent
commit
8b9045d347

+ 2 - 2
icinga2/host.conf.tmpl

@@ -10,7 +10,7 @@
 {%- set location = node_config.get ('location', {}) %}
 {%- set status = node_config.get ('status', 'active') %}
 
-{%- if 'icinga2server' not in roles %}
+{%- if 'icinga2server' not in roles and node_config.get('platform') == 'linux' %}
 object Endpoint "{{ node_id }}" {
         host = "{{ node_id }}"
 }
@@ -35,7 +35,7 @@ object Host "{{ node_id }}" {
 	enable_notifications = false
 {%- endif %}
 
-	vars.os = "Linux"
+	vars.os = "{{ node_config.get('platform') or "" }}"
 
 	vars.role = "{{ node_config.get('role', '') }}"
 	vars.roles = [

+ 1 - 1
icinga2/services/burp.conf

@@ -17,5 +17,5 @@ apply Service "burp_backup" {
 
 	command_endpoint = "{{ burp_server }}"
 
-	assign where host.address && host.vars.os == "Linux" && "backup" in host.vars.tags
+	assign where host.address && host.vars.os == "linux" && "backup" in host.vars.tags
 }

+ 2 - 2
icinga2/services/common.conf

@@ -48,7 +48,7 @@ apply Service "cluster zone" {
 
 	check_command = "cluster-zone"
 
-	assign where host.address && host.vars.os == "Linux"
+	assign where host.address && host.vars.os == "linux"
 	ignore where host.vars.noagent
 	ignore where host.name == NodeName
 }
@@ -63,6 +63,6 @@ apply Service "icinga" {
 		command_endpoint = host.name
 	}
 
-	assign where host.address && host.vars.os == "Linux"
+	assign where host.address && host.vars.os == "linux"
 	ignore where host.vars.noagent
 }

+ 1 - 1
icinga2/services/dhcp-server.conf

@@ -15,5 +15,5 @@ apply Service "dhcp_pool" {
 		command_endpoint = host.name
 	}
 
-	assign where host.address && host.vars.os == "Linux" && ("batman_gw" in host.vars.roles || "dhcp-server" in host.vars.roles)
+	assign where host.address && host.vars.os == "linux" && ("batman_gw" in host.vars.roles || "dhcp-server" in host.vars.roles)
 }

+ 8 - 8
icinga2/services/linux.conf

@@ -8,7 +8,7 @@ apply Service "cpu_usage" {
 
 	check_command = "cpu_usage"
 
-	assign where host.address && host.vars.os == "Linux"
+	assign where host.address && host.vars.os == "linux"
 }
 
 
@@ -24,7 +24,7 @@ apply Service "memory" {
 	vars.memory.warning = "10"
 	vars.memory.critical = "5"
 
-	assign where host.address && host.vars.os == "Linux"
+	assign where host.address && host.vars.os == "linux"
 }
 
 
@@ -52,7 +52,7 @@ apply Service "disk" {
 	vars.disk_inode_cfree = "10%"
 	vars.disk_units = "MB"
 
-	assign where host.address && host.vars.os == "Linux"
+	assign where host.address && host.vars.os == "linux"
 }
 
 
@@ -67,7 +67,7 @@ apply Service "load" {
 
 	vars.load_percpu = "true"
 
-	assign where host.address && host.vars.os == "Linux"
+	assign where host.address && host.vars.os == "linux"
 }
 
 
@@ -84,7 +84,7 @@ apply Service "systemd_units" {
 	retry_interval = 1m
 	check_interval = 5m
 
-	assign where host.address && host.vars.os == "Linux";
+	assign where host.address && host.vars.os == "linux";
 }
 
 
@@ -103,7 +103,7 @@ apply Service "apt-Updates" {
 
 	check_interval = 15m
 
-	assign where host.address && host.vars.os == "Linux"
+	assign where host.address && host.vars.os == "linux"
 }
 
 
@@ -118,7 +118,7 @@ apply Service "running_kernel" {
 
 	check_interval = 15m
 
-	assign where host.address && host.vars.os == "Linux"
+	assign where host.address && host.vars.os == "linux"
 }
 
 
@@ -133,5 +133,5 @@ apply Service "libs" {
 
 	check_interval = 15m
 
-	assign where host.address && host.vars.os == "Linux"
+	assign where host.address && host.vars.os == "linux"
 }

+ 1 - 1
icinga2/services/mail.conf

@@ -18,5 +18,5 @@ apply Service "mailq" {
 	vars.mailq_critical = 10
 #	vars.mailq_sudo = true
 
-	assign where host.address && host.vars.os == "Linux"
+	assign where host.address && host.vars.os == "linux"
 }

+ 10 - 10
icinga2/services/network.conf

@@ -16,7 +16,7 @@ apply Service "ifupdown2" {
 
 	vars.ok_string = "[ OK ]"
 
-	assign where host.address && host.vars.os == "Linux"
+	assign where host.address && host.vars.os == "linux"
 	ignore where "ifupdown-ng" in host.vars.tags
 }
 
@@ -32,7 +32,7 @@ apply Service "conntrack_size" {
 		command_endpoint = host.name
 	}
 
-	assign where host.address && host.vars.os == "Linux"
+	assign where host.address && host.vars.os == "linux"
 }
 
 
@@ -54,7 +54,7 @@ apply Service "bird" {
 	max_check_attempts = 3
 	retry_interval = 3m
 
-	assign where host.address && host.vars.os == "Linux" && "router" in host.vars.roles
+	assign where host.address && host.vars.os == "linux" && "router" in host.vars.roles
 }
 
 apply Service "bird6" {
@@ -73,7 +73,7 @@ apply Service "bird6" {
 	max_check_attempts = 3
 	retry_interval = 3m
 
-	assign where host.address && host.vars.os == "Linux" && "router" in host.vars.roles
+	assign where host.address && host.vars.os == "linux" && "router" in host.vars.roles
 }
 
 
@@ -91,7 +91,7 @@ apply Service "bird_ospf" {
 		command_endpoint = host.name
 	}
 
-	assign where host.address && host.vars.os == "Linux" && "router" in host.vars.roles
+	assign where host.address && host.vars.os == "linux" && "router" in host.vars.roles
 }
 
 apply Service "bird_ospf6" {
@@ -107,7 +107,7 @@ apply Service "bird_ospf6" {
 		command_endpoint = host.name
 	}
 
-	assign where host.address && host.vars.os == "Linux" && "router" in host.vars.roles
+	assign where host.address && host.vars.os == "linux" && "router" in host.vars.roles
 }
 
 
@@ -130,7 +130,7 @@ apply Service "bird_ibgp4" {
 	vars.sessions_down_ok_file = "/etc/bird/ibgp_sessions_down_ok.txt"
 	vars.ignore_missing_file = true
 
-	assign where host.address && host.vars.os == "Linux" && "router" in host.vars.roles
+	assign where host.address && host.vars.os == "linux" && "router" in host.vars.roles
 }
 
 apply Service "bird_ibgp6" {
@@ -150,7 +150,7 @@ apply Service "bird_ibgp6" {
 	vars.sessions_down_ok_file = "/etc/bird/ibgp_sessions_down_ok.txt"
 	vars.ignore_missing_file = true
 
-	assign where host.address && host.vars.os == "Linux" && "router" in host.vars.roles
+	assign where host.address && host.vars.os == "linux" && "router" in host.vars.roles
 }
 
 
@@ -169,7 +169,7 @@ apply Service "bird_ebgp4" {
 	vars.asn = 65132
 	vars.proto = "4"
 
-	assign where host.address && host.vars.os == "Linux" && "ffrl-exit" in host.vars.roles
+	assign where host.address && host.vars.os == "linux" && "ffrl-exit" in host.vars.roles
 }
 
 apply Service "bird_ebgp6" {
@@ -185,5 +185,5 @@ apply Service "bird_ebgp6" {
 	vars.asn = 65132
 	vars.proto = "6"
 
-	assign where host.address && host.vars.os == "Linux" && "ffrl-exit" in host.vars.roles
+	assign where host.address && host.vars.os == "linux" && "ffrl-exit" in host.vars.roles
 }

+ 1 - 1
icinga2/services/ntp.conf

@@ -79,5 +79,5 @@ apply Service "ntpd" {
 	max_check_attempts = 3
 	retry_interval = 5m
 
-	assign where host.address && host.vars.os == "Linux"
+	assign where host.address && host.vars.os == "linux"
 }

+ 1 - 1
icinga2/services/salt.conf

@@ -16,6 +16,6 @@ apply Service "salt" {
 
 	vars.ok_string = "[ OK ]"
 
-	assign where host.address && host.vars.os == "Linux"
+	assign where host.address && host.vars.os == "linux"
 }
 

+ 1 - 1
icinga2/services/ssl_cert.conf

@@ -10,5 +10,5 @@ apply Service "SSL Host Cert" {
 	vars.ssl_cert_warn = 14
 	vars.ssl_cert_crit = 7
 
-	assign where host.address && host.vars.os == "Linux"
+	assign where host.address && host.vars.os == "linux"
 }