Skip to content

check_mailq: use postqueue JSON output - #432

Draft
c-kr wants to merge 4 commits into
ConSol-Monitoring:mainfrom
c-kr:fix/check-mailq-postqueue-json
Draft

check_mailq: use postqueue JSON output#432
c-kr wants to merge 4 commits into
ConSol-Monitoring:mainfrom
c-kr:fix/check-mailq-postqueue-json

Conversation

@c-kr

@c-kr c-kr commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Read Postfix queue statistics through postqueue -j so the check does not require direct access to queue directories. The existing directory-based mode remains active as a fallback when postqueue fails.

Tested against real postfix postqueue json output. Draft status as it could need some more real life testing before merging

Fixes #431

c-kr added 2 commits July 29, 2026 12:08
Read Postfix queue statistics through postqueue -j so the check does not require direct access to queue directories. The existing directory-based mode remains active as a fallback when postqueue fails.

Fixes ConSol-Monitoring#431
Keep the anonymized postqueue output in its original one-entry-per-line format and disable the line-length check for this test only.
@sni

sni commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

It would work without any custom configuration on the target host if we run postqueue as root, right?

@c-kr

c-kr commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

I just tested it. Root user can always access queue via postqueue no matter whats restricted, even with authorized_mailq_users = - Also the old fallback count mechanism should work just like before as root user.

But the default should be that any user can read postqueue -j.

Side node, even if MTA is down, root can access the queue via postqueue -j:

postqueue: warning: Mail system is down -- accessing queue directly

c-kr added 2 commits July 29, 2026 12:49
Keep the generated check_mailq documentation in sync with the check metadata so the documentation cleanliness check passes.
The postqueue fixture uses Unix shell utilities and the check itself is not implemented on Windows, so restrict the test to non-Windows platforms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG REPORT: check_mailq always returns 0

2 participants