Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Sun Apr 21, 2019 9:36 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: MailScanner/SendMail/Spamassassin
PostPosted: Tue May 17, 2005 2:33 am 
Offline
Cacti User

Joined: Thu Mar 31, 2005 4:24 pm
Posts: 124
Location: Sydney, Asutralia
Hi,

Attached are the scripts to graph daily mail/spam/virus usage and average kilobytes transfered. Similar to what MailScanner-mrtg does.

You will need to make sure that MailScanner is logging the maillog to the DB.


Attachments:
MailScanner_Avg_KB_transfered.png
MailScanner_Avg_KB_transfered.png [ 4.91 KiB | Viewed 32434 times ]
MailScanner_Virus.png
MailScanner_Virus.png [ 5.42 KiB | Viewed 32434 times ]
MailScanner_Mail.png
MailScanner_Mail.png [ 6.02 KiB | Viewed 32434 times ]
Top
 Profile  
 
 Post subject: Scripts
PostPosted: Tue May 17, 2005 2:34 am 
Offline
Cacti User

Joined: Thu Mar 31, 2005 4:24 pm
Posts: 124
Location: Sydney, Asutralia
Scripts attached here.


Attachments:
MailScanner.zip [31.75 KiB]
Downloaded 2835 times
Top
 Profile  
 
 Post subject:
PostPosted: Thu May 19, 2005 7:58 am 
Offline

Joined: Thu Apr 28, 2005 3:00 am
Posts: 19
There seems to be a bug in the php files.
cacti feeds the database parameters in reverse order to the _virus.php file then how the .php is interpeting them.
After switching the parameters around in the .php the graph starts forming. but the daily mail is still showing 'nan'
The mail/spam graph is getting feed data but there is nothing showing on the graph.
The avg kb graph seems to be working ok.
Below the debug output for those 2 graphs.

CACTID: Host[1] SCRIPT: /usr/bin/php -q /var/www/html/cacti/scripts/MailScanner_Virus.php Z Y X <ip>, output: maildaily:738 virusdaily:12 blockeddaily:6
CACTID: DEBUG: SQLCMD: insert into poller_output (local_data_id,rrd_name,time,output) values (298,'','2005-05-19 14:47:21','maildaily:738 virusdaily:12 blockeddaily:6')
CACTID: Host[1] SCRIPT: /usr/bin/php -q /var/www/html/cacti/scripts/MailScanner_Mail.php <ip> X Y Z, output: maildaily:738 spamdaily:202 highspamdaily:141
CACTID: DEBUG: SQLCMD: insert into poller_output (local_data_id,rrd_name,time,output) values (297,'','2005-05-19 14:47:21','maildaily:738 spamdaily:202 highspamdaily:141')


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 1:51 am 
Offline

Joined: Thu Apr 28, 2005 3:00 am
Posts: 19
Never mind on the not showing graphs, it just took a while before it actually put something in there.
Only remaining problem was that the MailScanner_Virus.php gets its parameters in the wrong order but thats an easy fix by just renumbering the $_SERVER parameters in the file.
Thanks for the great script.


Top
 Profile  
 
 Post subject: Help Needed
PostPosted: Mon Aug 04, 2008 5:22 am 
Offline

Joined: Mon Aug 04, 2008 5:08 am
Posts: 23
Location: Cape Town
Hallo cacti Users, I hope someone can help me, Please :)

My MailScanner graphs are almost working, but I have a problem with
- Daily Mail
- Daily Spam
- Daily High Spam

Image

and

Image

However, from command line it appears to work just fine,

Code:
# /usr/bin/php -q /www/hosts/cacti/scripts/MailScanner_Mail.php IP_ADDRESS DB_USER DB_PASS DB_NAME IP_ADDRESS
maildaily:17354 spamdaily:13787 highspamdaily:13244


and

Code:
# /usr/bin/php -q /www/hosts/cacti/scripts/MailScanner_Virus.php IP_ADDRESS DB_USER DB_PASS DB_NAME IP_ADDRESS
maildaily:17400 virusdaily:12 blockeddaily:2


the logs also shows no errors, even in debug mode,

Code:
08/04/2008 12:20:06 PM - CMDPHP: Poller[0] Host[42] DS[891] CMD: /usr/bin/php -q /www/hosts/cacti/scripts/MailScanner_Mail.php 172.16.200.100 mailwatch gm1p! mailscanner, output: maildaily:17568 spamdaily:13936 highspamdaily:13390
08/04/2008 12:20:06 PM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (891, '', '2008-08-04 12:20:04', 'maildaily:17568 spamdaily:13936 highspamdaily:13390')"
08/04/2008 12:20:06 PM - POLLER: Poller[0] Parsed MULTI output field 'maildaily:17568' [map maildaily->maildaily]
08/04/2008 12:20:06 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /www/hosts/cacti/rra/mg1_iol_-_mailscanner_maildaily_891.rrd --template maildaily:spamdaily:highspamdaily 1217845204:17568:13936:13390


As always, thank you very much for taking the time to help me, it's much appreciated :)

Riaan


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 04, 2008 9:12 am 
Offline

Joined: Mon Aug 04, 2008 5:08 am
Posts: 23
Location: Cape Town
Hi Great news, I managed to get this working, by, following this advice,
http://docs.cacti.net/node/283

Quote:
rrdtool tune <rrd file> --maximum <ds-name>:<new ds maximum>


# Check rrd file numbers

You're perhaps wondering about this step, if the former was ok. But due to data sources MINIMUM and MAXIMUM definitions, it is possible, that valid updates for rrd files are suppressed, because MINIMUM was not reached or MAXIMUM was exceeded.

Assuming, you've got some valid rrdtool update in step 3, perform a
Code:

rrdtool fetch <rrd file> AVERAGE

and look at the last 10-20 lines. If you find NaN's there, perform
Code:

rrdtool info <rrd file>

and check the ds[...].min and ds[...].max entries, e.g.
Code:

ds[loss].min = 0.0000000000e+00
ds[loss].max = 1.0000000000e+02

In this example, MINIMUM = 0 and MAXIMUM = 100. For a ds.[...].type=GAUGE verify, that e.g. the number returned by the script does not exceed ds[...].MAX (same holds for MINIMUM, respectively).

If you run into this, please do not only update the data source definition within the Data Template, but perform a
Code:

rrdtool tune <rrd file> --maximum <ds-name>:<new ds maximum>

for all existing rrd files belonging to that Data Template.

At this step, it is wise to check step and heartbeat of the rrd file as well. For standard 300 seconds polling intervals (step=300), it is wise to set minimal_heartbeat to 600 seconds. If a single update is missing and the next one occurs in less than 600 seconds from the last one, rrdtool will interpolate the missing update. Thus, gaps are "filled" automatically by interpolation. Be aware of the fact, that this is no "real" data! Again, this must be done in the Data Template itself and by using rrdtool tune for all existing rrd files of this type.

Hope this helps someone :)

ciao Riaan


Top
 Profile  
 
 Post subject: old topic.. anyone still using...
PostPosted: Thu Apr 09, 2009 10:07 am 
Offline

Joined: Tue Feb 12, 2008 11:09 am
Posts: 5
Maybe I'm missing something... MailScanner_Mail.php is pulling from a mysql table called maillog... what creates and populates this table?


Top
 Profile  
 
 Post subject: Re: old topic.. anyone still using...
PostPosted: Mon Apr 13, 2009 12:17 pm 
Offline

Joined: Tue Feb 12, 2008 11:09 am
Posts: 5
sgroom wrote:
Maybe I'm missing something... MailScanner_Mail.php is pulling from a mysql table called maillog... what creates and populates this table?


*bumpbump


Top
 Profile  
 
 Post subject: Re: MailScanner/SendMail/Spamassassin
PostPosted: Sat Apr 18, 2009 6:11 am 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22376
Location: Muenster, Germany
africanw wrote:
Hi,

Attached are the scripts to graph daily mail/spam/virus usage and average kilobytes transfered. Similar to what MailScanner-mrtg does.

You will need to make sure that MailScanner is logging the maillog to the DB.
Thanks for posting this. We now encourage contributors to publish their work at the central cacti repository at http://docs.cacti.net/templates
Reinhard

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject: Re: MailScanner/SendMail/Spamassassin
PostPosted: Thu Jul 07, 2011 5:08 am 
Offline

Joined: Thu Jun 09, 2011 5:49 am
Posts: 32
Location: Cologne, Germany
Hello,
What rights does the DB-user maximum. Because I do not want to distribute to many rights.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group