There are a number of fine stand-alone mail statistics generating packages out there, most based on RRD. We, however, are happily using ganglia to aggregate and display statistics in a dashboard. Here’s the quick and dirty patch to take the simple mailgraph perl script and transform it into a gmetric data source:
--- mailgraph.pl 2007-08-29 09:06:01.000000000 +0000
+++ mailgraph-ganglia.pl 2009-05-09 17:21:52.000000000 +0000
@@ -871,15 +871,13 @@
return 0 if $m < $this_minute;
print "update $this_minute:$sum{sent}:$sum{received}:$sum{bounced}:$sum{rejected}:$sum{virus}:$sum{spam}\n" if $opt{verbose};
- RRDs::update $rrd, "$this_minute:$sum{sent}:$sum{received}:$sum{bounced}:$sum{rejected}" unless $opt{'only-virus-rrd'};
- RRDs::update $rrd_virus, "$this_minute:$sum{virus}:$sum{spam}" unless $opt{'only-mail-rrd'};
- if($m > $this_minute+$rrdstep) {
- for(my $sm=$this_minute+$rrdstep;$sm< $m;$sm+=$rrdstep) {
- print "update $sm:0:0:0:0:0:0 (SKIP)\n" if $opt{verbose};
- RRDs::update $rrd, "$sm:0:0:0:0" unless $opt{'only-virus-rrd'};
- RRDs::update $rrd_virus, "$sm:0:0" unless $opt{'only-mail-rrd'};
- }
- }
+ system("gmetric -c /etc/gmond.conf --name=mail_sent --value=$sum{sent} --type=int8 --units=messages");
+ system("gmetric -c /etc/gmond.conf --name=mail_received --value=$sum{received} --type=int8 --units=messages");
+ system("gmetric -c /etc/gmond.conf --name=mail_bounced --value=$sum{bounced} --type=int8 --units=messages");
+ system("gmetric -c /etc/gmond.conf --name=mail_rejected --value=$sum{rejected} --type=int8 --units=messages");
+ system("gmetric -c /etc/gmond.conf --name=mail_virus --value=$sum{virus} --type=int8 --units=messages");
+ system("gmetric -c /etc/gmond.conf --name=mail_spam --value=$sum{spam} --type=int8 --units=messages");
+
$this_minute = $m;
$sum{sent}=0;
$sum{received}=0;
I’m sure there are plenty of other ways to do this, but this seems like the most straightforward.
Like
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.