mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 14:16:00 +00:00
dovecot plugin check log file type by name
If dovecot plugin found dovecot-only log it will analyze it without filtering by 'dovecot' tag
This commit is contained in:
parent
65e4a94cea
commit
e5260be436
1 changed files with 27 additions and 16 deletions
|
@ -21,8 +21,14 @@ $aborted = 0;
|
||||||
|
|
||||||
($dirname = $0) =~ s/[^\/]+$//;
|
($dirname = $0) =~ s/[^\/]+$//;
|
||||||
|
|
||||||
|
$dovelogfile = 0 ;
|
||||||
|
|
||||||
$logfile = $ENV{'LOGFILE'} || '/var/log/mail.log';
|
$logfile = $ENV{'LOGFILE'} || '/var/log/mail.log';
|
||||||
|
|
||||||
|
if ( $logfile =~ /dovecot/ ) {
|
||||||
|
$dovelogfile = 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
# Use an overrided $PATH for all external programs if needed
|
# Use an overrided $PATH for all external programs if needed
|
||||||
$DOVEADM = "doveadm";
|
$DOVEADM = "doveadm";
|
||||||
|
|
||||||
|
@ -171,6 +177,10 @@ if (!defined $pos) {
|
||||||
$pos = $startsize;
|
$pos = $startsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print "# Logfile: $logfile\n";
|
||||||
|
print "# Pos: $pos\n";
|
||||||
|
print "# Startsize: $startsize\n";
|
||||||
|
|
||||||
if ($startsize < $pos) {
|
if ($startsize < $pos) {
|
||||||
# Log rotated
|
# Log rotated
|
||||||
parseDovecotfile ($rotlogfile, $pos, (stat $rotlogfile)[7]);
|
parseDovecotfile ($rotlogfile, $pos, (stat $rotlogfile)[7]);
|
||||||
|
@ -208,8 +218,8 @@ sub parseDovecotfile {
|
||||||
my $line =<logf>;
|
my $line =<logf>;
|
||||||
chomp ($line);
|
chomp ($line);
|
||||||
|
|
||||||
if ($line !~ m/dovecot/) { next; }
|
if ( $dovelogfile == 0 and $line !~ m/dovecot/) { next; }
|
||||||
|
else {
|
||||||
if ($line =~ m/Aborted/) {
|
if ($line =~ m/Aborted/) {
|
||||||
$aborted++;
|
$aborted++;
|
||||||
|
|
||||||
|
@ -229,6 +239,7 @@ sub parseDovecotfile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
close(logf);
|
close(logf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue