banshee/services-collection/services/postfix/ssh/
queue
The messages queued by a Postfix server, by queue, and the age of the oldest deferred message, by SSH and postqueue -j.
by banshee1 installation1 version
Published on October 27, 2026. First version.
Postfix queue, by SSH
Returns the mail queue of a Postfix server: the messages queued, by queue (deferred, being delivered, held, arriving), and the age of the oldest deferred message, read by postqueue -j over SSH. Four watches are offered, each one set on the probe.
Versions
Postfix 3.1 and later (postqueue -j): Debian 9, Ubuntu 18.04, RHEL 8 and later. Generic: no folder of version. An older Postfix knows no -j: the collector stops misconfigured.
How it works
The collector runs postqueue -j, which writes one JSON object per message, one per line:
{"queue_name": "deferred", "queue_id": "4BPm4N2tVLz1x", "arrival_time": 1793062803, "message_size": 2048, "sender": "app@www.example", "recipients": [{"address": "user@mail.example", "delay_reason": "connect to mail.example[192.0.2.25]:25: Connection timed out"}]} queuedcounts every message;deferred,active,holdcount those of each queue;incomingcounts those ofincomingandmaildrop, the mail arriving and not yet taken up.oldest-deferredis the time since the arrival of the oldest deferred message, in hours, against the poller's clock;0when none is deferred. Postfix gives up on a message aftermaximal_queue_lifetime(5 days by default) and bounces it: a message deferred for hours is mail that does not leave.- A Postfix that is stopped (
postqueuesays "mail system is down") is critical: "Postfix is not running". Any other failure ofpostqueuestops the collectormisconfigured, with what it said. - Nothing is written:
postqueue -jonly lists the queue. The senders and recipients are read, never returned.
Prerequisites
- An SSH account for monitoring, without write rights, on the Postfix server.
postqueuein its path (/usr/sbin/postqueue), and the account allowed to list the queue:authorized_mailq_usersisstatic:anyoneby default; where it was narrowed, add the account to it (postconf -e 'authorized_mailq_users = monitoring', with the others it names).- No
sudo. - The fingerprint of the server's host key, set in
protocol:ssh:fingerprint(not needed when the Security settings trust the first SSH fingerprint presented).
Outputs
| Name | Label | Unit | Per instance |
|---|---|---|---|
queued | Messages queued | — | no |
deferred | Messages deferred | — | no |
active | Messages being delivered | — | no |
hold | Messages held | — | no |
incoming | Messages arriving | — | no |
oldest-deferred | Oldest deferred message | h | no |
Watches
| Name | Title | Kind | Defaults | Checked by default |
|---|---|---|---|---|
queued | Queue too long | above a threshold, on queued | warning above 500, critical above 2000 | yes |
deferred | Many messages deferred | above a threshold, on deferred | warning above 50, critical above 200, for 3 runs | yes |
oldest-deferred | Deferred message too old | above a threshold, on oldest-deferred | warning above 4 h, critical above 24 h | yes |
hold | Messages held | above a threshold, on hold | warning above 0 | no |
Limits
- The whole queue is listed at each run: a queue of tens of thousands of messages makes an answer of several megabytes, which the poller may refuse as too large; the probe then stops, which says the queue is huge.
- One Postfix instance per probe, the default one; the other instances of
postmultiare not read. - Not checked against a Postfix: the format is the one the manual page
postqueue(1)gives for-j.