[Dovecot] 1.0-test69

Andrew Hucthings info at a-wing.co.uk
Wed May 11 21:40:00 EEST 2005


Its nothing special.  Code is a bit sloppy as its a 5 minute bodge job,
but it works.  I use something similar to count number of logins.

In mrtg.cfg:
Target[pop2]: `/root/gotmail.php`
MaxBytes[pop2]: 1000
Options[pop2]: gauge
Title[pop2]: POP 21 Messages Statistics
PageTop[pop2]: POP 21 Messages Statistics</H1>
XSize[pop2]: 500
YSize[pop2]: 200
WithPeak[pop2]: dwmy
YLegend[pop2]: No. of Messages
ShortLegend[pop2]: Messages
LegendI[pop2]:  Messages:
LegendO[pop2]:  N/A:

Gotmail.php:
#!/usr/bin/php -q
<?php
$file = "/var/log/maillog";

$count=0;
if($fp = fopen( $file, "r" )){
 while(!feof($fp)){

  $line = fgets($fp,128);

   if($p=strpos($line,"del="))
   {
        $p2=strrpos($line,"/");
        $str=substr($line,$p+4,$p2-$p-4);
        $count+=$str;
   }

 }
  fclose($fp);

$file = "/var/log/mrtgpop2";
if($fp = fopen( $file, "r" )){
  $line = fgets($fp,128);
  $linearray = split(" ", $line);

$oldin=$linearray[0];
fclose($fp);
}

if($fp = fopen( $file, "w" )){
$write="$count 0\n";
fwrite($fp, $write);

fclose($fp);
}
$nowin=$count-$oldin;

echo "$nowin\n0\npop1.nsnoc.com\nPOP Messages\n";

echo "\n$oldin\n";

}
?>


Regards
Andrew

On Wed, 2005-05-11 at 16:04 +0100, Jethro R Binks wrote:
> Oooo, could you publish the code for extracting the data?
> 
> (This patch looks cool, must upgrade soon!)
> 
> 
> On Wed, 11 May 2005, Andrew Hucthings wrote:
> 
> > Timo:  Feature request here I think, I would love this patch (or
> > similar) to be in the tree.  Already creating mrtg graphs based on it to
> > see what is really happening.
> > 
> > Regards
> > Andrew
> > 
> > On Wed, 2005-05-11 at 16:21 +0200, Luigi Rosa wrote:
> > > Hello Andrey Panin <pazke at donpac.ru>,
> > > Monday, May 9, 2005, 9:19:57 AM, you wrote:
> > > 
> > > 
> > > >> Gonna see if I can write a minor patch for dovecot this week so that we
> > > >> can see number of messages downloading in a pop3 session in the logfile.
> > > >> Similar to the way UW does it, will be very useful for us at work trying
> > > >> to trace customers POP problems, I will submit it if anyone will find it
> > > >> useful.
> > > 
> > > AP> Don't waste your time :) Take a look at the attached patch.
> > > 
> > > 
> > > It's GREAT!
> > > 
> > > Is there any chance that will be included in the main build tree?
> > > 
> > > 
> > > 
> > > Ciao,
> > > luigi
> > > 
> > --
> > Andrew Hutchings (A-Wing)
> > Linux Guru - Netserve Consultants Ltd. - www.domaincity.co.uk
> > Admin - North Wales Linux User Group - www.nwlug.org.uk
> > BOFH excuse 371: Incorrectly configured static routes on the
> > corerouters.
> > 
> > 
> 
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> Jethro R Binks
> Computing Officer, IT Services
> University Of Strathclyde, Glasgow, UK
> 
--
Andrew Hutchings (A-Wing)
Linux Guru - Netserve Consultants Ltd. - www.domaincity.co.uk
Admin - North Wales Linux User Group - www.nwlug.org.uk
BOFH excuse 43: boss forgot system password




More information about the dovecot mailing list