Commit 7258c2e
committed
feat(mailq)!: replace count-based alerting with age-based, add --mta autodetection
BREAKING CHANGE: --warning and --critical now take a duration string
(1h, 3D, 30m) instead of a mail count. The defaults change from 2 /
250 mails to 1h / 3D. The rationale is that a queue with 100 fresh
mails is still OK when they are delivered within minutes, while a
single mail stuck for more than an hour is always interesting.
Adds --mta=auto|postfix|exim|sendmail to override MTA autodetection.
Postfix is now read via "postqueue -j" (JSON with arrival_time as
Unix epoch) for a rock-solid timestamp that needs no date parser.
Exim still reads "mailq" (aliased to "exim -bp") and uses the age
literals exim prints next to each queued message. Everything else
falls back to "mailq" with RFC2822 Date: line parsing.
The mail count stays in perfdata (mailq) so existing Grafana
dashboards keep working, and a new oldest_mail_age perfdata metric
carries the age in seconds with warn/crit thresholds.
Existing Icinga services that pass the old mail-count syntax (e.g.
mailq_warning=2 mailq_critical=250) will hard-UNKNOWN with a clear
"Invalid duration" message after the upgrade, forcing the admin to
read the release notes and migrate to duration strings. A silent
fallback that reinterprets old integer values as hours was
considered and rejected because it would silently change the
alerting semantic from "queue size" to "queue age" without the
admin noticing, which is the worst possible outcome for monitoring.
Unit test fixtures were renamed to follow the CONTRIBUTING
convention (name describes the shape of the data, not the expected
plugin state). Tests pin TZ=UTC and use a hidden --now test hook to
make age-based assertions deterministic regardless of the host
timezone.
Bump linuxfabrik-lib pin from 3.1.0 to 3.1.1, picking up the
human2seconds() / humanduration2seconds() lowercase d/w day/week
marker support that the mailq plugin now relies on to parse exim
age literals like 1d12h without normalizing the input first.
The mailq Icinga Director basket needs a regen to pick up the new
--mta parameter and the changed --warning/--critical semantics.
Closes #7811 parent 203b2ef commit 7258c2e
File tree
21 files changed
+457
-130
lines changed- check-plugins/mailq
- unit-test
- stderr
- stdout
21 files changed
+457
-130
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
73 | | - | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
38 | 47 | | |
39 | 48 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
49 | 72 | | |
50 | 73 | | |
51 | 74 | | |
| |||
0 commit comments