summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2019-01-26 18:16:53 +0000
committerintrigeri <intrigeri@boum.org>2019-01-26 18:25:09 +0000
commitd458286f38cca2ca41bce289931d857834495ab8 (patch)
treedecab134d5464917bdd173209feb448f97536b51
parentc47a1302fa9c8c7bc778907b15dc8659ecaec67d (diff)
Monitoring: set warning and critical thresholds for all Postfix queues (refs: #16271)
This applies to all queues monitored by this plugin except "corrupt", which has a sane default value (critical = 1) in the script. Note that the script says "By default, all thresholds are 0 except corrupt_crit", which suggests any value >> 0 will trigger a warning or something. But this comment is incorrect: by default, all thresholds are *empty*, which means the corresponding value will never put the monitored service in warning/critical state. Which explains why we've never been notified about email breakage. Lesson learned: "read the source, Luke" :) For now I'm adding only two parameters in the Puppet defined resource and all queues (except "corrupt") will share the same threshold. But if we ever need per-queue thresholds, I've prepared things in the Service template and CheckCommand configuration so they should be ready for that.
-rw-r--r--files/monitoring/icinga2/checkcommands/check_postfix_mailqueue.conf40
-rw-r--r--manifests/monitoring/service/postfix_mailqueue.pp4
-rw-r--r--templates/monitoring/service/postfix_mailqueue.erb11
3 files changed, 55 insertions, 0 deletions
diff --git a/files/monitoring/icinga2/checkcommands/check_postfix_mailqueue.conf b/files/monitoring/icinga2/checkcommands/check_postfix_mailqueue.conf
index 0a64554..dbcee3b 100644
--- a/files/monitoring/icinga2/checkcommands/check_postfix_mailqueue.conf
+++ b/files/monitoring/icinga2/checkcommands/check_postfix_mailqueue.conf
@@ -8,6 +8,46 @@ object CheckCommand "postfix-mailqueue" {
value = "$config_dir$"
description = "Postfix config directory."
}
+ "--deferred_warn" = {
+ value = "$deferred_warn$"
+ description = "Warning level for deferred queue."
+ }
+ "--deferred_crit" = {
+ value = "$deferred_crit$"
+ description = "Critical level for deferred queue."
+ }
+ "--active_warn" = {
+ value = "$active_warn$"
+ description = "Warning level for active queue."
+ }
+ "--active_crit" = {
+ value = "$active_crit$"
+ description = "Critical level for active queue."
+ }
+ "--maildrop_warn" = {
+ value = "$maildrop_warn$"
+ description = "Warning level for maildrop queue."
+ }
+ "--maildrop_crit" = {
+ value = "$maildrop_crit$"
+ description = "Critical level for maildrop queue."
+ }
+ "--incoming_warn" = {
+ value = "$incoming_warn$"
+ description = "Warning level for incoming queue."
+ }
+ "--incoming_crit" = {
+ value = "$incoming_crit$"
+ description = "Critical level for incoming queue."
+ }
+ "--hold_warn" = {
+ value = "$hold_warn$"
+ description = "Warning level for hold queue."
+ }
+ "--hold_crit" = {
+ value = "$hold_crit$"
+ description = "Critical level for hold queue."
+ }
}
}
diff --git a/manifests/monitoring/service/postfix_mailqueue.pp b/manifests/monitoring/service/postfix_mailqueue.pp
index 74eee26..0f7a9c1 100644
--- a/manifests/monitoring/service/postfix_mailqueue.pp
+++ b/manifests/monitoring/service/postfix_mailqueue.pp
@@ -9,6 +9,10 @@ define tails::monitoring::service::postfix_mailqueue (
Optional[String] $display_name = undef,
Boolean $enable_notifications = true,
Stdlib::Absolutepath $config_dir = '/etc/postfix',
+ # Thresholds apply to every queue except "corrupt",
+ # which has critical=1 by default in the check script.
+ Integer[0] $warning_threshold = 5,
+ Integer[0] $critical_threshold = 5,
){
if $display_name == undef {
diff --git a/templates/monitoring/service/postfix_mailqueue.erb b/templates/monitoring/service/postfix_mailqueue.erb
index 0145409..f643bb2 100644
--- a/templates/monitoring/service/postfix_mailqueue.erb
+++ b/templates/monitoring/service/postfix_mailqueue.erb
@@ -14,4 +14,15 @@ object Service "<%= @displayed_name %>" {
vars.config_dir = "<%= @config_dir %>"
+ vars.deferred_warn = "<%= @warning_threshold %>"
+ vars.deferred_crit = "<%= @critical_threshold %>"
+ vars.active_warn = "<%= @warning_threshold %>"
+ vars.active_crit = "<%= @critical_threshold %>"
+ vars.maildrop_warn = "<%= @warning_threshold %>"
+ vars.maildrop_crit = "<%= @critical_threshold %>"
+ vars.incoming_warn = "<%= @warning_threshold %>"
+ vars.incoming_crit = "<%= @critical_threshold %>"
+ vars.hold_warn = "<%= @warning_threshold %>"
+ vars.hold_crit = "<%= @critical_threshold %>"
+
}