* Benning, Markus <i...@markusbenning.de>: > 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.
At the moment I need to know the top senders in a mail queue with more than 2 million messages. I'd rather not dig in the logs, but use Postfix internal knowledge about messages currently in queue. > But i think you're looking for more detailed stats. Nope. I'm looking for a (more) machine readable format. > 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. 2 million messages make it slower, but it is still handable. > 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. Yes, but that's not an option at the moment. It requires infrastructure and software the customer doesn't have and maybe will not buy. p@rick -- Patrick Ben Koetter p...@state-of-mind.de