Am 2015-09-08 08:56, schrieb Patrick Ben Koetter:
I need (nearly) real time stats on mail queues in a machine readable format. I'd like to use this on command line in scripts and/or in (web) interfaces to show queue/delivery states. I also need it e.g. to easily identify phished
accounts (by number of messages/recipients).

I think it is easier to implement a more machine readable format (e.g. JSON)
once in Postfix than n-times in n-scripts that deal with various mail
management issues.

You can gather stats on the mailq with collectd and the filecount plugin.
It can output CSV, RRD, whatever.
But the statistics are limited to size of the different queue in mails/bytes.
You can monitor the size of bounce, deferred queues this way.

But i think you're looking for more detailed stats.
The information you're looking for should be also in the mail logs.
A problem with the queue mailq output may be that it only a snapshot of the current
queue state. You may miss things that happen between these snapshots.
It also may be slow in times you have a lot of mails in your queue.

May be you want to give saftpresse my near-realtime logfile analyser a try:

https://github.com/benningm/saftpresse

https://metacpan.org/release/Log-Saftpresse

The Postfix plugin is based on the pflogsumm code.

It can read the log from files or recieve it from rsyslog/syslog with syslog or better RELP protocol. If you write the output to an elasticsearch database you can use a dashboard
like Kibana to build your statistics.


 Markus
--
Markus Benning, https://markusbenning.de/

Reply via email to