Browse Source

icinga2: sudo feature of check_mailq doesn't work everywhere. Use sudo directly.

Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>
Maximilian Wilhelm 6 years ago
parent
commit
3be5746852
2 changed files with 42 additions and 2 deletions
  1. 40 0
      icinga2/commands.d/mailq_sudo.conf
  2. 2 2
      icinga2/services/mail.conf

+ 40 - 0
icinga2/commands.d/mailq_sudo.conf

@@ -0,0 +1,40 @@
+#
+# Bloody fooking plugin doesn't do sudo correcty.
+#
+
+object CheckCommand "sudo_mailq" {
+	command = [ "sudo", PluginDir + "/check_mailq" ]
+
+	arguments = {
+		"-w" = {
+			value = "$mailq_warning$"
+			description = "Min. number of messages in queue to generate warning"
+			required = true
+		}
+		"-c" = {
+			value = "$mailq_critical$"
+			description = "Min. number of messages in queue to generate critical alert ( w < c )"
+			required = true
+		}
+		"-W" = {
+			value = "$mailq_domain_warning$"
+			description = "Min. number of messages for same domain in queue to generate warning"
+		}
+		"-C" = {
+			value = "$mailq_domain_critical$"
+			description = "Min. number of messages for same domain in queue to generate critical alert ( W < C )"
+		}
+		"-t" = {
+			value = "$mailq_timeout$"
+			description = "Plugin timeout in seconds (default = 15)"
+		}
+		"-M" = {
+			value = "$mailq_servertype$"
+			description = "[ sendmail | qmail | postfix | exim | nullmailer ] (default = autodetect)"
+		}
+		"-s" = {
+			set_if = "$mailq_sudo$"
+			description = "Use sudo for mailq command"
+		}
+	}
+}

+ 2 - 2
icinga2/services/mail.conf

@@ -7,7 +7,7 @@
 apply Service "mailq" {
         import "generic-service"
 
-	check_command = "mailq"
+	check_command = "sudo_mailq"
 
 	if (host.name != NodeName) {
 		command_endpoint = host.name
@@ -16,7 +16,7 @@ apply Service "mailq" {
 	vars.mailq_servertype = "postfix"
 	vars.mailq_warning = 5
 	vars.mailq_critical = 10
-	vars.mailq_sudo = true
+#	vars.mailq_sudo = true
 
 	assign where host.address && host.vars.os == "Linux"
 }