Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 3rd December 2009, 13:34
vaio1 vaio1 is offline
Senior Member
 
Join Date: Jul 2007
Location: Italy
Posts: 664
Thanks: 77
Thanked 12 Times in 7 Posts
Default CACTI - POSTFIX - ISPConfig

Hi guys,

how can I monitorize the mails?
I have found this script (attached here) that helps to get the data from the postfix but I don't know how can be used together the ISPConfig configuration.

I mean that I don't find some information required by the stat script.

fetch_mail_statistics.pl /var/log/mail.log /var/log/mailstats.db .1.3.6.1.4.1.2021.255 -g .1.3.6.1.4.1.2021.255

where are those files?

thanks in advance
Attached Files
File Type: gz postfix_mailserver.tar.gz (7.1 KB, 216 views)
Reply With Quote
Sponsored Links
  #2  
Old 4th December 2009, 14:24
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,747 Times in 2,578 Posts
Default

Quote:
Originally Posted by mturillo View Post
where are those files?
What files?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 4th December 2009, 14:50
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default

I'm using mailgraph.pl in combination with a cacti template someone made .. works perfectly
Reply With Quote
  #4  
Old 4th December 2009, 16:03
vaio1 vaio1 is offline
Senior Member
 
Join Date: Jul 2007
Location: Italy
Posts: 664
Thanks: 77
Thanked 12 Times in 7 Posts
Default

I would like to configure it too but I have found some problem.
I use CentOS 5.4 & ISPConfig 2.

Where do you have downloaded it?
Reply With Quote
  #5  
Old 4th December 2009, 16:32
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default

1. download mailgraph http://mailgraph.schweikert.ch/

- open the tar.gz file (tar zxf mailgraph-1.14.tar.gz)
- copy the file mailgraph.pl to dir: /usr/local/bin
- copy the file mailgraph-init to dir: /etc/init.d/ and rename it to "mailgraph"

(the following works on debian, i don't know if it works on centos as well, it's to create an autostart when the server reboots)
- run: update-rc.d mailgraph defaults

2. edit /etc/snmp/snmpd.conf and add these lines:
Code:
exec   mailcount_sent           /bin/cat /tmp/mailsent
exec   mailcount_recv           /bin/cat /tmp/mailrecv
exec   mailcount_reject         /bin/cat /tmp/mailrejected
exec   mailcount_bounced        /bin/cat /tmp/mailbounced
exec   mailcount_spam           /bin/cat /tmp/mailspam
exec   mailcount_virus          /bin/cat /tmp/mailvirus
3. restart snmpd (/etc/init.d/snmpd restart)

4. Open the file mailgraph.pl and find the sub "update" (search for "sub update($)")

5. Replace the function with this one:
Code:
sub update($)
{
	my $t = shift;
	my $m = $t - $t%$rrdstep;
	init_rrd($m) unless $rrd_inited;
	return 1 if $m == $this_minute;
	return 0 if $m < $this_minute;

        `echo $sum{sent} > /tmp/mailsent`;
        `echo $sum{received} > /tmp/mailrecv`;
        `echo $sum{bounced} > /tmp/mailbounced`;
	`echo $sum{rejected} > /tmp/mailrejected`;
	`echo $sum{virus} > /tmp/mailvirus`;
        `echo $sum{spam} > /tmp/mailspam`;

#	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'};
#		}
#	}
	$this_minute = $m;
	$sum{sent}=0;
	$sum{received}=0;
	$sum{bounced}=0;
	$sum{rejected}=0;
	$sum{virus}=0;
	$sum{spam}=0;
	return 1;
}
6. Start mailgraph (/etc/init.d/mailgraph start)

What have we done so far:
- Mailgraph will write it's totals to files in /tmp directory.
- We've added some options for snmpd (so cacti can get the totals through snmp)

7. Import the attached xml file in cacti
Attached Files
File Type: zip cacti_graph_template_postfix_stats.xml.zip (3.8 KB, 306 views)

Last edited by Mark_NL; 4th December 2009 at 16:48.
Reply With Quote
  #6  
Old 4th December 2009, 16:42
vaio1 vaio1 is offline
Senior Member
 
Join Date: Jul 2007
Location: Italy
Posts: 664
Thanks: 77
Thanked 12 Times in 7 Posts
Default

I don't understand this part of the installation:

Code:
See the file mailgraph-init for an example init script that you can use to
start mailgraph at system boot.
and then have I just copy the cgi file in the cgi folder of my website previously created on ISPConfig?

Quote:
You need to put mailgraph.cgi on somewhere accessible though a web-server, it
needs to be executeable and the web-server needs to execute it as a CGI.
The files contained inside the TAR archive are:
Code:
-rw-r--r-- 1 1000 1000  8519 29 ago  2007 CHANGES
-rw-r--r-- 1 1000 1000 17976 29 ago  2007 COPYING
-rwxr-xr-x 1 1000 1000  6898 29 ago  2007 mailgraph.cgi --------> /var/www/web2/cgi-bin/
-rw-r--r-- 1 1000 1000   672 29 ago  2007 mailgraph.css
-rw-r--r-- 1 1000 1000   777 29 ago  2007 mailgraph-init  -------> ???
-rwxr-xr-x 1 1000 1000 29230 29 ago  2007 mailgraph.pl  -------> ???
-rw-r--r-- 1 1000 1000  2683 29 ago  2007 README

Last edited by vaio1; 4th December 2009 at 16:48.
Reply With Quote
  #7  
Old 4th December 2009, 16:48
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default

No, we're not going to use the cgi part of the script .. the cgi part is for when you want to view the stats in an image created by the cgi script (we don't want that, we want postfix to do it, so skip that)

I've updated my previous post to make things more clear.
Reply With Quote
  #8  
Old 4th December 2009, 16:51
vaio1 vaio1 is offline
Senior Member
 
Join Date: Jul 2007
Location: Italy
Posts: 664
Thanks: 77
Thanked 12 Times in 7 Posts
Default

This command doesn't exist in CentOS: update-rc.d mailgraph defaults

Other steps to do are:

1. chmod 777 /etc/init.d/mailgraph
2. /etc/init.d/mailgraph start

Furthermore I get this message from CACTI:

Code:
12/04/2009 04:05:02 PM - CMDPHP: Poller[0] Host[1] DS[22] WARNING: Result from SNMP not valid. Partial Result: /bin/cat: /tmp/mailv
12/04/2009 04:05:01 PM - CMDPHP: Poller[0] Host[1] DS[21] SNMP: v3: 127.0.0.1, dsname: spam, oid: .1.3.6.1.4.1.2021.8.1.101.5, output: U
12/04/2009 04:05:01 PM - CMDPHP: Poller[0] Host[1] DS[21] WARNING: Result from SNMP not valid. Partial Result: /bin/cat: /tmp/mails
12/04/2009 04:05:01 PM - CMDPHP: Poller[0] Host[1] DS[20] SNMP: v3: 127.0.0.1, dsname: send, oid: .1.3.6.1.4.1.2021.8.1.101.1, output: U
12/04/2009 04:05:01 PM - CMDPHP: Poller[0] Host[1] DS[20] WARNING: Result from SNMP not valid. Partial Result: /bin/cat: /tmp/mails
12/04/2009 04:05:01 PM - CMDPHP: Poller[0] Host[1] DS[19] SNMP: v3: 127.0.0.1, dsname: reject, oid: .1.3.6.1.4.1.2021.8.1.101.3, output: U
12/04/2009 04:05:01 PM - CMDPHP: Poller[0] Host[1] DS[19] WARNING: Result from SNMP not valid. Partial Result: /bin/cat: /tmp/mailr
12/04/2009 04:05:01 PM - CMDPHP: Poller[0] Host[1] DS[18] SNMP: v3: 127.0.0.1, dsname: recv, oid: .1.3.6.1.4.1.2021.8.1.101.2, output: U
12/04/2009 04:05:01 PM - CMDPHP: Poller[0] Host[1] DS[18] WARNING: Result from SNMP not valid. Partial Result: /bin/cat: /tmp/mailr
12/04/2009 04:05:01 PM - CMDPHP: Poller[0] Host[1] DS[17] SNMP: v3: 127.0.0.1, dsname: bounced, oid: .1.3.6.1.4.1.2021.8.1.101.4, output: U
12/04/2009 04:05:01 PM - CMDPHP: Poller[0] Host[1] DS[17] WARNING: Result from SNMP not valid. Partial Result: /bin/cat: /tmp/mailb

Last edited by vaio1; 4th December 2009 at 17:06.
Reply With Quote
  #9  
Old 4th December 2009, 17:11
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default

did you edit snmpd.conf? and restarted snmpd?


run: /bin/cat /tmp/mailsent

that does is return?
Reply With Quote
  #10  
Old 4th December 2009, 17:12
vaio1 vaio1 is offline
Senior Member
 
Join Date: Jul 2007
Location: Italy
Posts: 664
Thanks: 77
Thanked 12 Times in 7 Posts
 
Default

yes of course.
I have restarted it after the edit.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
421 Unexpected failure Lizard King Installation/Configuration 20 7th July 2009 21:43
i dont recive any mail of any domain chua_jose Installation/Configuration 18 10th November 2008 19:55
ISPconfig after installation cannot reach www.xyz.de:81 Figth4Linux Installation/Configuration 23 6th March 2008 23:38
Centos 4.4 32bit Hangs, High Server load 3cwired_com Server Operation 11 16th November 2006 16:47
Verify email setup meekish Installation/Configuration 28 27th October 2006 16:36


All times are GMT +2. The time now is 23:36.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.