Browse Source

icinga2: Split common checks for all Hosts and checks for all Linux hosts.

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
Maximilian Wilhelm 3 years ago
parent
commit
e77704ac25
2 changed files with 169 additions and 0 deletions
  1. 66 0
      icinga2/services/common.conf
  2. 103 0
      icinga2/services/linux.conf

+ 66 - 0
icinga2/services/common.conf

@@ -0,0 +1,66 @@
+#
+# Global checks for every Host
+#
+
+apply Service "ping4" {
+	import "generic-service"
+	check_command = "ping4"
+
+	if (host.vars.service_param["ping"]["warn"]) {
+		vars.ping_wrta = host.vars.service_param["ping"]["warn"]
+	}
+
+	if (host.vars.service_param["ping"]["crit"]) {
+		vars.ping_crta = host.vars.service_param["ping"]["crit"]
+	}
+
+	assign where host.address
+}
+
+apply Service "ping6" {
+	import "generic-service"
+	check_command = "ping6"
+
+	if (host.vars.service_param["ping"]["warn"]) {
+		vars.ping_wrta = host.vars.service_param["ping"]["warn"]
+	}
+
+	if (host.vars.service_param["ping"]["crit"]) {
+		vars.ping_crta = host.vars.service_param["ping"]["crit"]
+	}
+
+	assign where host.address6
+}
+
+apply Service "dns" {
+	import "generic-service"
+
+	check_command = "dns"
+	check_interval = 5m
+
+	assign where host.address
+}
+
+apply Service "cluster zone" {
+	import "generic-service"
+
+	check_command = "cluster-zone"
+
+	assign where host.address && host.vars.os == "Linux"
+	ignore where host.vars.noagent
+	ignore where host.name == NodeName
+}
+
+apply Service "icinga" {
+	import "generic-service"
+
+	check_command = "icinga"
+
+
+	if (host.name != NodeName) {
+		command_endpoint = host.name
+	}
+
+	assign where host.address && host.vars.os == "Linux"
+	ignore where host.vars.noagent
+}

+ 103 - 0
icinga2/services/linux.conf

@@ -0,0 +1,103 @@
+#
+# Checks for all Linux Hosts
+#
+
+
+apply Service "cpu_usage" {
+	import "generic-service"
+
+	check_command = "cpu_usage"
+
+	assign where host.address && host.vars.os == "Linux"
+}
+
+
+apply Service "memory" {
+	import "generic-service"
+
+	check_command = "memory"
+
+	if (host.name != NodeName) {
+		command_endpoint = host.name
+	}
+
+	vars.memory.warning = "10"
+	vars.memory.critical = "5"
+
+	assign where host.address && host.vars.os == "Linux"
+}
+
+
+apply Service "disk" {
+	import "generic-service"
+
+	check_command = "disk"
+
+	if (host.name != NodeName) {
+		command_endpoint = host.name
+	}
+
+	# Check all local disks
+	vars.disk_all = true
+	vars.disk_local = true
+	vars.disk_ignore_ereg_path += [ "^/run", "^/var/lib/docker/volumes" ]
+	vars.disk_exclude_type += ["devtmpfs", "sysfs", "procfs", "proc", "aufs", "tmpfs", "fuse.gvfsd-fuse", "fuse.fuse-remount", "fuse.jetbrains-toolbox", "fuse.sshfs", "fuse.nvim", "debugfs", "tracefs", "nsfs", "vfat", "udf", "overlay" ]
+
+	# Set levels
+	vars.disk.critical = "5%"
+	vars.disk.warning = "15%"
+	vars.disk_wfree = "15%"
+	vars.disk_cfree = "10%"
+	vars.disk_inode_wfree = "15%"
+	vars.disk_inode_cfree = "10%"
+	vars.disk_units = "MB"
+
+	assign where host.address && host.vars.os == "Linux"
+}
+
+
+apply Service "load" {
+	import "generic-service"
+
+	check_command = "load"
+
+	if (host.name != NodeName) {
+		command_endpoint = host.name
+	}
+
+	vars.load_percpu = "true"
+
+	assign where host.address && host.vars.os == "Linux"
+}
+
+
+apply Service "uptime" {
+	import "generic-service"
+
+	check_command = "uptime"
+
+	if (host.name != NodeName) {
+		command_endpoint = host.name
+	}
+
+	vars.uptime_w = "5"
+
+	assign where host.address && host.vars.os == "Linux"
+}
+
+
+################################################################################
+#               Checks for updates, newer kernels, libs, etc.                  #
+################################################################################
+
+apply Service "apt-Updates" {
+	import "generic-service"
+
+	check_command = "apt"
+
+	if (host.name != NodeName) {
+		command_endpoint = host.name
+	}
+
+	assign where host.address && host.vars.os == "Linux"
+}