--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: After upgrade to Etch amavis-stats stop working After ugrade from Sarge to etch amavis-stats stop completly working. I have using amavisd-new from volatile and I mean that in amavisd log changes names of some identifiers. I made two small patches that give me functioanlity of amavis-stats back.
- From: Daniel Smolik <marvin@mydatex.cz>
- Date: Tue, 01 Apr 2008 11:48:17 +0200
- Message-id: <20080401094817.24180.94733.reportbug@shiva.sitour.cz>
Package: amavis-stats
Version: 0.1.12-7.3
Severity: important
Tags: patch
--- amavis-stats 2006-12-04 08:24:33.000000000 +0100
+++ amavis-stats.new 2008-04-01 11:27:34.000000000 +0200
@@ -508,16 +508,16 @@
# If this line contains a SPAM tag of some sort don't classify it
# now, but record the fact and move on to the next line
#
- if ($line =~ /\sSPAM(-TAG)*,\s/) {
- dbg("SPAM: $epoch: $isodate $sid");
- $spamsess{$sid} = 1;
- return;
- }
+# if ($line =~ /\sSPAM(-TAG)*,\s/) {
+# dbg("SPAM: $epoch: $isodate $sid");
+# $spamsess{$sid} = 1;
+# return;
+# }
#
# Save the stats according to the classification of the email
#
- if ($line =~ /Passed/) {
+ if ($line =~ /Passed CLEAN/) {
#
# Update the overall passed emails statistics
@@ -532,7 +532,8 @@
}
upCount($id, $epoch);
- } elsif ($line =~ /\sNot-Delivered,\s/) {
+ #} elsif ($line =~ /\sSPAM,\s/) {
+ } elsif ($line =~ /Blocked SPAM/) {
#
# Update the overall not delivered statistics
--- amavis-stats.php 2006-12-04 08:24:33.000000000 +0100
+++ amavis-stats.php.new 2008-04-01 11:26:33.000000000 +0200
@@ -85,6 +85,8 @@
$cmd = "rrdtool graph $img '". implode("' \\\n'",$opts) . "'" .
" 2>&1";
+
+
asDbg($cmd, 1);
$out = exec($cmd, $output, $rrd_error_val);
@@ -145,10 +147,13 @@
} else { // Stand-alone command line usage
$cmd = true;
- $outdir = $_SERVER["PWD"];
+ $outdir = "img";
}
+
+
+
if (isset($GLOBALS["rate"])) {
$rate = $GLOBALS["rate"];
} else {
@@ -159,6 +164,7 @@
if (isset($fullpage) || isset($cmd)) {
asHtmlStart();
+
if (asLoadStats()) {
$minsec = 60;
@@ -312,6 +318,7 @@
$virus[$fields[0]]["id"] = $fields[0];
$virus[$fields[0]]["name"] = $fields[1];
+
if ($fields[1] == "Passed") {
$pid = $fields[0];
}
@@ -345,20 +352,28 @@
$virus[$fields[0]]["lastseen"] = $fields[2];
}
+
+
$readfile = @file($as_statefile);
if (!is_array($readfile)) {
asErr("Couldn't open state file.");
}
+
+
asDbg("$as_statefile");
asDbg($readfile);
for ($k = 0; $k <= (count($readfile) - 1); $k++) {
- $fields = preg_split("/\s+/",$readfile[$k], -1, PREG_SPLIT_NO_EMPTY);
- if ($fields[0] == "lastupdate:" && is_numeric($fields[1])) {
- $lastupdate = $fields[1];
+
+ $fields = split("\ ",$readfile[$k],6);
+
+ if ($fields[0] == "lastupdate:" && is_numeric(trim($fields[1]))) {
+ $lastupdate = trim($fields[1]);
} elseif ($fields[0] == "LC_TIME:") {
setlocale(LC_TIME, $fields[1]);
}
+
+
}
if (!isset($lastupdate)) {
@@ -499,7 +514,7 @@
$opts[] = "PRINT:gvt$id:AVERAGE:%.0lf";
}
- $ret = rrd_graph($img, $opts, count($opts));
+ $ret = rrd_graph("/usr/share/amavis-stats/$img", $opts, count($opts));
/*
* debugging - graph definitions
@@ -645,7 +660,7 @@
$opts[] = "COMMENT:\\n";
$opts[] = "COMMENT:amavis-stats v$asVersion ";
- $opts[] = "COMMENT:$enddate \\r";
+ $opts[] = "COMMENT:".str_replace(":", "\:", $enddate)."\\r";
asDbg($opts);
$ret = rrd_graph("/usr/share/amavis-stats/$img" , $opts, count($opts));
@@ -769,7 +784,7 @@
}
*/
$opts[] = "COMMENT:amavis-stats v$asVersion ";
- $opts[] = "COMMENT:$enddate" . str_replace(":", "\:", $enddate) . " \\r";
+ $opts[] = "COMMENT:". str_replace(":", "\:", $enddate) . " \\r";
/*
* debugging - graph definitions
-- System Information:
Debian Release: 4.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.21.1
Locale: LANG=cs_CZ.ISO8859-2, LC_CTYPE=cs_CZ.ISO8859-2 (charmap=ISO-8859-2)
Versions of packages amavis-stats depends on:
ii adduser 3.102 Add and remove users and groups
ii debconf [debconf-2.0] 1.5.11etch1 Debian configuration management sy
ii librrds-perl 1.2.15-0.3 Time-series data storage and displ
ii rrdtool 1.2.15-0.3 Time-series data storage and displ
ii wwwconfig-common 0.0.48 Debian web auto configuration
Versions of packages amavis-stats recommends:
pn amavis <none> (no description available)
-- debconf-show failed
--- End Message ---