MailScanner/SendMail/Spamassassin
Moderators: Developers, Moderators
-
- Cacti User
- Posts: 130
- Joined: Thu Mar 31, 2005 4:24 pm
- Location: Sydney, Asutralia
- Contact:
MailScanner/SendMail/Spamassassin
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.
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_Mail.png (6.02 KiB) Viewed 34245 times
-
- MailScanner_Virus.png (5.42 KiB) Viewed 34245 times
-
- MailScanner_Avg_KB_transfered.png (4.91 KiB) Viewed 34245 times
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')
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')
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.
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.
Help Needed
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
and
However, from command line it appears to work just fine,
and
the logs also shows no errors, even in debug mode,
As always, thank you very much for taking the time to help me, it's much appreciated
Riaan
My MailScanner graphs are almost working, but I have a problem with
- Daily Mail
- Daily Spam
- Daily High Spam
and
However, from command line it appears to work just fine,
Code: Select all
# /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
Code: Select all
# /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
Code: Select all
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
Riaan
Hi Great news, I managed to get this working, by, following this advice,
http://docs.cacti.net/node/283
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
http://docs.cacti.net/node/283
# Check rrd file numbersrrdtool tune <rrd file> --maximum <ds-name>:<new ds maximum>
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
old topic.. anyone still using...
Maybe I'm missing something... MailScanner_Mail.php is pulling from a mysql table called maillog... what creates and populates this table?
Re: old topic.. anyone still using...
*bumpbumpsgroom wrote:Maybe I'm missing something... MailScanner_Mail.php is pulling from a mysql table called maillog... what creates and populates this table?
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Re: MailScanner/SendMail/Spamassassin
Thanks for posting this. We now encourage contributors to publish their work at the central cacti repository at http://docs.cacti.net/templatesafricanw 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.
Reinhard
Re: MailScanner/SendMail/Spamassassin
Hello,
What rights does the DB-user maximum. Because I do not want to distribute to many rights.
What rights does the DB-user maximum. Because I do not want to distribute to many rights.
Who is online
Users browsing this forum: No registered users and 9 guests