Package: munin-node
Version: 1.2.5-1
Severity: normal

Personally I prefer rotating logfiles using logrotate's "dateext"
option which changes e.g. mail.log into mail.log-20070829 instead of
mail.log.1; however, two of the postfix_* plugins which try to read
yesterday's logfile cannot cope with that for two reasons:

- They don't check for "$logfile-$prevdate".
- $prevdate is composed without leading zeros, e.g. 2007829, correct
  was 20070829.

The attached patch fixes both errors in postfix_mailstats, the changes
for postfix_mailvolume are virtually identical.

On a side note, the way prevdate is calculated may lead to funny plugin
results around daylight saving time switching days.

    Christoph

-- 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.15.53
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=UTF-8)

Versions of packages munin-node depends on:
ii  adduser                       3.102      Add and remove users and groups
ii  libnet-server-perl            0.94-1     An extensible, general perl server
ii  lsb-base                      3.1-23.1   Linux Standard Base 3.1 init scrip
ii  perl                          5.8.8-7    Larry Wall's Practical Extraction 
ii  procps                        1:3.2.7-3  /proc file system utilities

Versions of packages munin-node recommends:
ii  libnet-snmp-perl              5.2.0-1    Script SNMP connections

-- no debconf information

--- postfix_mailstats.in	2007-08-15 12:57:55.000000000 +0200
+++ postfix_mailstats.in	2007-08-29 12:20:39.000000000 +0200
@@ -112,6 +112,10 @@
 {
     $rotlogfile = "$logfile.$prevdate";
 }
+elsif (-f "$logfile-$prevdate")
+{
+    $rotlogfile = "$logfile-$prevdate";
+}
 elsif (-f "$logfile.0")
 {
     $rotlogfile = $logfile . ".0";
@@ -246,7 +250,7 @@
 sub get_prev_date
 {
 	my @date = localtime (time - 86400);
-	my $prevdate = $date[5]+1900 . $date[4]+1 . $date[3];
+	my $prevdate = sprintf ('%4d%02d%02d', $date[5]+1900, $date[4]+1, $date[3]);
 	return $prevdate;
 }
 

Attachment: signature.asc
Description: Digital signature

Reply via email to