1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-25 02:18:08 +00:00

Plugin-Gallery: Get better 2nd level headings

Review of category mail
This commit is contained in:
dipohl 2017-02-24 20:20:32 +01:00
parent e777037d06
commit 54a91c13a4
17 changed files with 2 additions and 2 deletions

View file

@ -1,144 +0,0 @@
#!/usr/bin/perl
# +----------------------------------------------------------------------+
# | A Munin Graph Plugin for ASSP |
# | [ assp-envelope-recipient-statistics ] |
# +----------------------------------------------------------------------+
# | Author: Enrico Labedzki |
# | Email: enzo@guel.info |
# | Last Modified: 2010-02-22 |
# | Licence: GPLv3 http://www.gnu.org/licenses/gpl-3.0.txt |
# +----------------------------------------------------------------------+
use strict;
use warnings;
use File::Basename;
use LWP;
use Mail::Sendmail;
# -------------------------- DEBUG VARS ---------------------------------
my $DEBUG = 0; # for debugging purpose
my $EMAILDEBUG = 0; # for email debugging
my $pluginname = &basename( "$0" ); # get the basename of the plugin
my @to = qw( webmaster@guel.info ); # the list of admins receivced messages on an error
my $from = "$pluginname-at-host\@guel.info"; # the host where the plugin is installed
my $muninnodename = "mail.guel.info"; # the real Node from where it comes
my $smtp = "mail.guel.info"; # the smtp relay to send the mail
# ------------------------- GLOBAL VARS ---------------------------------
my $version = "1.0"; # UA Version
my $agentname = "$pluginname Munin Plugin V$version"; # UA String
my $url = "http://localhost:55553/"; # (defaults to localhost)
my $response = 0; # the server output
my @content = (); # the content we're retrive from $response
my %index = ( # for Version 2
'from' => 40, # <-- index frame from ( a tweak for other ASSP Versions )
'to' => 63 # <-- index frame to ( "" )
);
# -----------------------------------------------------------------------
my @muninlabel = (
# Envelope Recipient Statistics --> index 40..63
"Local Recipients Accepted",
"Validated Recipients",
"Unchecked Recipients",
"Spam-Lover Recipients",
"Remote Recipients Accepted",
"Whitelisted Recipients",
"Not Whitelisted Recipients",
"Noprocessed Recipients",
"Email Reports",
"Spam Reports",
"Ham Reports",
"Whitelist Additions",
"Whitelist Deletions",
"Redlist Additions",
"Redlist Deletions",
"Local Recipients Rejected",
"Nonexistent Recipients",
"Delayed Recipients",
"Delayed (Late) Recipients",
"Delayed (Expired) Recipients",
"Embargoed Recipients",
"Spam Bucketed Recipients",
"Remote Recipients Rejected",
"Relay Attempts Rejected"
);
# ============= SANITY CHECKS ================
unless( defined(@ARGV) ){
$ARGV[0] = "";
}
# =============== THE GET ====================
if( $ARGV[0] eq "" ){
my $agent = LWP::UserAgent->new();
$agent->agent("$agentname");
$response = $agent->get( $url );
&response_error() unless $response->is_success;
@content = split( /\n/, $response->content );
my $line = "";
my $count = $index{from};
my $label;
my( $key, $value, $last );
while( 1 ){
&finish() if( $count > $index{to} );
$line = $content[$count];
$count++;
chomp( $line );
next if $line eq ""; # no empty lines
next if $line =~ /^\n$/; # no newlines
next if $line =~ /^\r$/; # or else
next if $line =~ /^\r\n$/; # http specific
( $key, $value, $last) = split( /\|/, $line ); # split up to three values
$key =~ s/^\s//g; $key =~ s/\s$//g; # no spaces at the end and the beginning
$value =~ s/^\s//g; $value =~ s/\s$//g;
$value =~ s/(\d*)\s*.*/$1/g; # remove more than one values from splited data
$value =~ s/[a-zA-Z\(\)\%]//g; # and not alphanummeric glyphs
$last =~ s/^\s//g; $last =~ s/\s$//g;
$label = $key;
$label =~ s/\s/\_/g; # generate a label
$label =~ s/\-/\_/g; # the subs glyph to underline
$label =~ s/[\(\)]//g; # no special glyphs feel free to add more
print "$label.value $value\n"; # print the result to the label
}
}
# =============== FUNCTIONS ==================
sub finish{
exit 0;
}
sub response_error{
if( $DEBUG ){
foreach my $admin ( @to ){
my %mail = ( smtp => "$smtp", To => "$admin", From => "$from", Subject => "Munin Plugin $pluginname", Message => "ERROR: $agentname at $muninnodename\n" );
&sendmail(%mail) or die "ERROR: $Mail::Sendmail::error\n";
if( $EMAILDEBUG ){
print "OK. Log says:\n$Mail::Sendmail::log\n";
}
}
}
exit 1; # if no admin exists
}
# ============== MUNIN GRAPHER COINFIG =======
if( $ARGV[0] eq "config" ){
print "graph_title ASSP - Envelope Recipient Statistics\n";
print "graph_vlabel Counter in k,m\n";
print "graph_category spamfilter\n";
my $label;
foreach my $key ( @muninlabel ){
$label = $key;
$label =~ s/\s/\_/g;
$label =~ s/\-/\_/g;
$label =~ s/[\(\)]//g;
print "$label.label $key\n";
}
exit 0;
}

View file

@ -1,127 +0,0 @@
#!/usr/bin/perl
# +----------------------------------------------------------------------+
# | A Munin Graph Plugin for ASSP |
# | [ assp-general-runtime-information ] |
# +----------------------------------------------------------------------+
# | Author: Enrico Labedzki |
# | Email: enrico.labdzki@brodos.de |
# | Last Modified: 2010-03-05 |
# | Licence: GPLv3 http://www.gnu.org/licenses/gpl-3.0.txt |
# +----------------------------------------------------------------------+
use strict;
use warnings;
use File::Basename;
use LWP;
use Mail::Sendmail;
# -------------------------- DEBUG VARS ---------------------------------
my $DEBUG = 0; # for debugging purpose
my $EMAILDEBUG = 0; # for email debugging
my $pluginname = &basename( "$0" ); # get the basename of the plugin
my @to = qw( webmaster@guel.info ); # the list of admins receivced messages on an error
my $from = "$pluginname-at-host\@guel.info"; # the host from where it comes
my $muninnodename = "mail.guel.info"; # the Node from where it comes
my $smtp = "mail.guel.info"; # the smtp relay to send the mail
# ------------------------- GLOBAL VARS ---------------------------------
my $version = "1.0"; # UA Version
my $agentname = "$pluginname Munin Plugin V$version"; # UA String
my $url = "http://localhost:55553/"; # (defaults to localhost)
my $response = 0; # the server output
my @content = (); # the content we're retrive from $response
my %index = ( # for Version 2
'from' => 2, # <-- index frame from ( a tweak for other ASSP Versions )
'to' => 4 # <-- index frame to ( "" )
);
# -----------------------------------------------------------------------
my @muninlabel = ( # General Runtime Information
#"ASSP Proxy Uptime",
#"Messages Processed",
"Non-Local Mail Blocked",
"CPU Usage",
#"Concurrent SMTP Sessions"
);
# ============= SANITY CHECKS ================
unless( defined(@ARGV) ){
$ARGV[0] = "";
}
# =============== THE GET ====================
if( $ARGV[0] eq "" ){
my $agent = LWP::UserAgent->new();
$agent->agent("$agentname");
$response = $agent->get( $url );
&response_error() unless $response->is_success;
@content = split( /\n/, $response->content );
my $line = "";
my $count = $index{from};
my $label;
my( $key, $value, $last );
while( 1 ){
&finish() if( $count == $index{to} ); # EXIT IF GENERAL SECTION FINISH
$line = $content[$count];
$count++;
chomp( $line );
next if $line eq ""; # no empty lines
next if $line =~ /^\n$/; # no newlines
next if $line =~ /^\r$/; # or else
next if $line =~ /^\r\n$/; # http specific
( $key, $value, $last) = split( /\|/, $line ); # split up to three values
$key =~ s/^\s//g; $key =~ s/\s$//g; # no spaces at the end and the beginning
$value =~ s/^\s//g; $value =~ s/\s$//g;
$value =~ s/(\d*)\s*.*/$1/g; # remove more than one values from splited data
$value =~ s/[a-zA-Z\(\)\%]//g; # and not alphanummeric glyphs
$last =~ s/^\s//g; $last =~ s/\s$//g;
$label = $key;
$label =~ s/\s/\_/g; # generate a label
$label =~ s/\-/\_/g; # the subs glyph to underline
$label =~ s/[\(\)]//g; # no special glyphs feel free to add more
print "$label.value $value\n"; # print the result to the label
}
}
# =============== FUNCTIONS ==================
sub finish{
exit 0;
}
sub response_error{
if( $DEBUG ){
foreach my $admin ( @to ){
my %mail = ( smtp => "$smtp", To => "$admin", From => "$from", Subject => "Munin Plugin $pluginname", Message => "ERROR: $agentname at $muninnodename\n" );
&sendmail(%mail) or die "ERROR: $Mail::Sendmail::error\n";
if( $EMAILDEBUG ){
print "OK. Log says:\n$Mail::Sendmail::log\n";
}
}
}
exit 1; # if no admin exists
}
# ============== MUNIN GRAPHER COINFIG =======
if( $ARGV[0] eq "config" ){
my $count = 0;
my $label;
foreach my $key ( @muninlabel ){
if( $count == 0 ){ # General Runtime Information
print "graph_title ASSP - General Runtime Information\n";
print "graph_vlabel Counter in Percent\n";
print "graph_category spamfilter\n";
}
$label = $key;
$label =~ s/\s/\_/g;
$label =~ s/\-/\_/g;
$label =~ s/[\(\)]//g;
print "$label.label $key\n";
$count++;
}
exit 0;
}

View file

@ -1,156 +0,0 @@
#!/usr/bin/perl
# +----------------------------------------------------------------------+
# | A Munin Graph Plugin for ASSP |
# | [ assp-message-statistics ] |
# +----------------------------------------------------------------------+
# | Author: Enrico Labedzki |
# | Email: enrico.labdzki@brodos.de |
# | Last Modified: 2010-02-22 |
# | Licence: GPLv3 http://www.gnu.org/licenses/gpl-3.0.txt |
# +----------------------------------------------------------------------+
use strict;
use warnings;
use File::Basename;
use LWP;
use Mail::Sendmail;
# -------------------------- DEBUG VARS ---------------------------------
my $DEBUG = 0; # for debugging purpose
my $EMAILDEBUG = 0; # for email debugging
my $pluginname = &basename( "$0" ); # get the basename of the plugin
my @to = qw( webmaster@bguel.info ); # the list of admins receivced messages on an
my $from = "$pluginname-at-host\@guel.info"; # the host from where it comes
my $muninnodename = "mail.guel.info"; # the Node from where it comes
my $smtp = "mail.guel.info"; # the smtp relay to send the mail
# ------------------------- GLOBAL VARS ---------------------------------
my $version = "1.0"; # UA Version
my $agentname = "$pluginname Munin Plugin V$version"; # UA String
my $url = "http://localhost:55553/"; # (defaults to localhost)
my $response = 0; # the server output
my @content = (); # the content we're retrive from $response
my %index = ( # for Version 2
'from' => 66, # <-- index frame from ( a tweak for other ASSP Versions )
'to' => 100 # <-- index frame to ( "" )
);
# -----------------------------------------------------------------------
my @muninlabel = (
# Message Statistics --> index 66..100
"Bayesian Hams",
"Whitelisted",
"Local",
"Noprocessing",
"Spamlover Spams Passed",
"Bayesian Spams",
"Domains Blacklisted",
"HELO Blacklisted",
"HELO Invalid",
"HELO Forged",
"Missing MX",
"Missing PTR",
"Invalid PTR",
"Spam Collected Messages",
"Penalty Trap Messages",
"Bad Attachments",
"Viruses Detected",
"Sender Regex",
"Bomb Regex",
"Penalty Box",
"Message Scoring",
"Invalid Local Sender",
"Invalid Internal Mail",
"Scripts",
"SPF Failures",
"RBL Failures",
"URIBL Failures",
"Max Errors Exceeded",
"Delayed",
"Empty Recipient",
"Not SRS Signed Bounces",
"MSGID Signature",
"DKIM",
"DKIM pre Check",
"Pre Header"
);
# ============= SANITY CHECKS ================
unless( defined(@ARGV) ){
$ARGV[0] = "";
}
# =============== THE GET ====================
if( $ARGV[0] eq "" ){
my $agent = LWP::UserAgent->new();
$agent->agent("$agentname");
$response = $agent->get( $url );
&response_error() unless $response->is_success;
@content = split( /\n/, $response->content );
my $line = "";
my $count = $index{from};
my $label;
my( $key, $value, $last );
while( 1 ){
&finish() if( $count > $index{to} );
$line = $content[$count];
$count++;
chomp( $line );
next if $line eq ""; # no empty lines
next if $line =~ /^\n$/; # no newlines
next if $line =~ /^\r$/; # or else
next if $line =~ /^\r\n$/; # http specific
( $key, $value, $last) = split( /\|/, $line ); # split up to three values
$key =~ s/^\s//g; $key =~ s/\s$//g; # no spaces at the end and the beginning
$value =~ s/^\s//g; $value =~ s/\s$//g;
$value =~ s/(\d*)\s*.*/$1/g; # remove more than one values from splited data
$value =~ s/[a-zA-Z\(\)\%]//g; # and not alphanummeric glyphs
$last =~ s/^\s//g; $last =~ s/\s$//g;
$label = $key;
$label =~ s/\s/\_/g; # generate a label
$label =~ s/\-/\_/g; # the subs glyph to underline
$label =~ s/[\(\)]//g; # no special glyphs feel free to add more
print "$label.value $value\n"; # print the result to the label
}
}
# =============== FUNCTIONS ==================
sub finish{
exit 0;
}
sub response_error{
if( $DEBUG ){
foreach my $admin ( @to ){
my %mail = ( smtp => "$smtp", To => "$admin", From => "$from", Subject => "Munin Plugin $pluginname", Message => "ERROR: $agentname at $muninnodename\n" );
&sendmail(%mail) or die "ERROR: $Mail::Sendmail::error\n";
if( $EMAILDEBUG ){
print "OK. Log says:\n$Mail::Sendmail::log\n";
}
}
}
exit 1; # if no admin exists
}
# ============== MUNIN GRAPHER COINFIG =======
if( $ARGV[0] eq "config" ){
print "graph_title ASSP - Message Statistics\n";
print "graph_vlabel Counter in k,m\n";
print "graph_category spamfilter\n";
my $label;
foreach my $key ( @muninlabel ){
$label = $key;
$label =~ s/\s/\_/g;
$label =~ s/\-/\_/g;
$label =~ s/[\(\)]//g;
print "$label.label $key\n";
}
exit 0;
}

View file

@ -1,134 +0,0 @@
#!/usr/bin/perl
# +----------------------------------------------------------------------+
# | A Munin Graph Plugin for ASSP |
# | [ assp-smtp-connection-statistics ] |
# +----------------------------------------------------------------------+
# | Author: Enrico Labedzki |
# | Email: enrico.labdzki@brodos.de |
# | Last Modified: 2010-02-22 |
# | Licence: GPLv3 http://www.gnu.org/licenses/gpl-3.0.txt |
# +----------------------------------------------------------------------+
use strict;
use warnings;
use File::Basename;
use LWP;
use Mail::Sendmail;
# -------------------------- DEBUG VARS ---------------------------------
my $DEBUG = 0; # for debugging purpose
my $EMAILDEBUG = 0; # for email debugging
my $pluginname = &basename( "$0" ); # get the basename of the plugin
my @to = qw( webmaster@guel.info ); # the list of admins receivced messages on an error
my $from = "$pluginname-at-host\@guel.info"; # the host from where it comes
my $muninnodename = "mail.guel.info"; # the Node from where it comes
my $smtp = "mail.guel.info"; # the smtp relay to send the mail
# ------------------------- GLOBAL VARS ---------------------------------
my $version = "1.0"; # UA Version
my $agentname = "$pluginname Munin Plugin V$version"; # UA String
my $url = "http://localhost:55553/"; # (defaults to localhost)
my $response = 0; # the server output
my @content = (); # the content we're retrive from $response
my %index = ( # for Version 2
'from' => 25, # <-- index frame from ( a tweak for other ASSP Versions )
'to' => 38 # <-- index frame to ( "" )
);
# -----------------------------------------------------------------------
my @muninlabel = (
# SMTP Connection Statistics --> index 25..38
"Accepted Logged SMTP Connections",
"SSL SMTP Connections",
"TLS SMTP Connections",
"Not Logged SMTP Connections",
"SMTP Connection Limits",
"Overall Limits",
"By IP Limits",
"By IP Frequency Limits",
"By Domain IP Limits",
"SMTP Connections Timeout",
"SMTP SSL-Connections Timeout",
"SMTP TLS-Connections Timeout",
"Denied SMTP Connections",
"SMTP damping"
);
# ============= SANITY CHECKS ================
unless( defined(@ARGV) ){
$ARGV[0] = "";
}
# =============== THE GET ====================
if( $ARGV[0] eq "" ){
my $agent = LWP::UserAgent->new();
$agent->agent("$agentname");
$response = $agent->get( $url );
&response_error() unless $response->is_success;
@content = split( /\n/, $response->content );
my $line = "";
my $count = $index{from};
my $label;
my( $key, $value, $last );
while( 1 ){
&finish() if( $count > $index{to} );
$line = $content[$count];
$count++;
chomp( $line );
next if $line eq ""; # no empty lines
next if $line =~ /^\n$/; # no newlines
next if $line =~ /^\r$/; # or else
next if $line =~ /^\r\n$/; # http specific
( $key, $value, $last) = split( /\|/, $line ); # split up to three values
$key =~ s/^\s//g; $key =~ s/\s$//g; # no spaces at the end and the beginning
$value =~ s/^\s//g; $value =~ s/\s$//g;
$value =~ s/(\d*)\s*.*/$1/g; # remove more than one values from splited data
$value =~ s/[a-zA-Z\(\)\%]//g; # and not alphanummeric glyphs
$last =~ s/^\s//g; $last =~ s/\s$//g;
$label = $key;
$label =~ s/\s/\_/g; # generate a label
$label =~ s/\-/\_/g; # the subs glyph to underline
$label =~ s/[\(\)]//g; # no special glyphs feel free to add more
print "$label.value $value\n"; # print the result to the label
}
}
# =============== FUNCTIONS ==================
sub finish{
exit 0;
}
sub response_error{
if( $DEBUG ){
foreach my $admin ( @to ){
my %mail = ( smtp => "$smtp", To => "$admin", From => "$from", Subject => "Munin Plugin $pluginname", Message => "ERROR: $agentname at $muninnodename\n" );
&sendmail(%mail) or die "ERROR: $Mail::Sendmail::error\n";
if( $EMAILDEBUG ){
print "OK. Log says:\n$Mail::Sendmail::log\n";
}
}
}
exit 1; # if no admin exists
}
# ============== MUNIN GRAPHER COINFIG =======
if( $ARGV[0] eq "config" ){
print "graph_title ASSP - SMTP Connection Statistics\n";
print "graph_vlabel Counter in k,m\n";
print "graph_category spamfilter\n";
my $label;
foreach my $key ( @muninlabel ){
$label = $key;
$label =~ s/\s/\_/g;
$label =~ s/\-/\_/g;
$label =~ s/[\(\)]//g;
print "$label.label $key\n";
}
exit 0;
}

View file

@ -1,127 +0,0 @@
#!/usr/bin/perl
# +----------------------------------------------------------------------+
# | A Munin Graph Plugin for ASSP |
# | [ assp-smtp-handler-statistics ] |
# +----------------------------------------------------------------------+
# | Author: Enrico Labedzki |
# | Email: enrico.labdzki@brodos.de |
# | Last Modified: 2010-02-22 |
# | Licence: GPLv3 http://www.gnu.org/licenses/gpl-3.0.txt |
# +----------------------------------------------------------------------+
use strict;
use warnings;
use File::Basename;
use LWP;
use Mail::Sendmail;
# -------------------------- DEBUG VARS ---------------------------------
my $DEBUG = 0; # for debugging purpose
my $EMAILDEBUG = 0; # for email debugging
my $pluginname = &basename( "$0" ); # get the basename of the plugin
my @to = qw( webmaster@guel.info ); # the list of admins receivced messages on an error
my $from = "$pluginname-at-host\@guel.info"; # the host from where it comes
my $muninnodename = "mail.guel.info"; # the Node from where it comes
my $smtp = "mail.guel.info"; # the smtp relay to send the mail
# ------------------------- GLOBAL VARS ---------------------------------
my $version = "1.0"; # UA Version
my $agentname = "$pluginname Munin Plugin V$version"; # UA String
my $url = "http://localhost:55553/"; # (defaults to localhost)
my $response = 0; # the server output
my @content = (); # the content we're retrive from $response
my %index = ( # for Version 2
'from' => 4, # <-- index frame from ( a tweak for other ASSP Versions )
'to' => 5 # <-- index frame to ( "" )
);
#------------------------------------------------------------------------
my @muninlabel = ( # General Runtime Information
#"ASSP Proxy Uptime",
#"Messages Processed",
#"Non-Local Mail Blocked",
#"CPU Usage",
"Concurrent SMTP Sessions"
);
# ============= SANITY CHECKS ================
unless( defined(@ARGV) ){
$ARGV[0] = "";
}
# =============== THE GET ====================
if( $ARGV[0] eq "" ){
my $agent = LWP::UserAgent->new();
$agent->agent("$agentname");
$response = $agent->get( $url );
&response_error() unless $response->is_success;
@content = split( /\n/, $response->content );
my $line = "";
my $count = $index{from};
my $label;
my( $key, $value, $last );
while( 1 ){
&finish() if( $count == $index{to} ); # EXIT IF GENERAL SECTION FINISH
$line = $content[$count];
$count++;
chomp( $line );
next if $line eq ""; # no empty lines
next if $line =~ /^\n$/; # no newlines
next if $line =~ /^\r$/; # or else
next if $line =~ /^\r\n$/; # http specific
( $key, $value, $last) = split( /\|/, $line ); # split up to three values
$key =~ s/^\s//g; $key =~ s/\s$//g; # no spaces at the end and the beginning
$value =~ s/^\s//g; $value =~ s/\s$//g;
$value =~ s/(\d*)\s*.*/$1/g; # remove more than one values from splited data
$value =~ s/[a-zA-Z\(\)\%]//g; # and not alphanummeric glyphs
$last =~ s/^\s//g; $last =~ s/\s$//g;
$label = $key;
$label =~ s/\s/\_/g; # generate a label
$label =~ s/\-/\_/g; # the subs glyph to underline
$label =~ s/[\(\)]//g; # no special glyphs feel free to add more
print "$label.value $value\n"; # print the result to the label
}
}
# =============== FUNCTIONS ==================
sub finish{
exit 0;
}
sub response_error{
if( $DEBUG ){
foreach my $admin ( @to ){
my %mail = ( smtp => "$smtp", To => "$admin", From => "$from", Subject => "Munin Plugin $pluginname", Message => "ERROR: $agentname at $muninnodename\n" );
&sendmail(%mail) or die "ERROR: $Mail::Sendmail::error\n";
if( $EMAILDEBUG ){
print "OK. Log says:\n$Mail::Sendmail::log\n";
}
}
}
exit 1; # if no admin exists
}
# ============== MUNIN GRAPHER COINFIG =======
if( $ARGV[0] eq "config" ){
my $count = 0;
my $label;
foreach my $key ( @muninlabel ){
if( $count == 0 ){ # General Runtime Information
print "graph_title ASSP - General Runtime Information\n";
print "graph_vlabel Counter in Percent\n";
print "graph_category spamfilter\n";
}
$label = $key;
$label =~ s/\s/\_/g;
$label =~ s/\-/\_/g;
$label =~ s/[\(\)]//g;
print "$label.label $key\n";
$count++;
}
exit 0;
}

View file

@ -1,66 +0,0 @@
#!/bin/sh
#
# Plugin to count specific log categories for courier servers (pop3/imap)
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=suggest
CATEGORIES="peer_reset Reset_by_peer Connection reset by peer
conn_timeout Connection_timeout Connection timed out
disconnected Disconnected DISCONNECTED
timeout Timeout TIMEOUT
login Login LOGIN
logout Logout LOGOUT
mem_full FAM_needs_restart malloc: Input/output error
conn_full Connection_limit_reached malloc: Input/output error"
LOG_FILE=${LOG_FILE:-/var/log/mail.info}
SUGGESTIONS="pop3d pop3d-ssl imapd imapd-ssl"
# "autoconf" and "suggest" only work reliably if the mail server already
# contains some log entries.
if [ "$1" = "autoconf" ]; then
[ ! -e "$LOG_FILE" ] && echo "no (no log file found: $LOG_FILE)" && exit 0
for suggestion in $SUGGESTIONS; do
grep -q " $suggestion: " "$LOG_FILE" && echo "yes" && exit 0
done
# no suitable line found in the log file
echo "no (no courier pop3d/imapd lines in $LOG_FILE found)"
exit 0
fi
if [ "$1" = "suggest" ]; then
for suggestion in $SUGGESTIONS; do
grep -q " $suggestion: " "$LOG_FILE" && echo "$suggestion"
done
exit 0
fi
type=$(basename "$0" | tr "_" "\n" | tail -1)
if [ "$1" = "config" ]; then
cat <<EOT
graph_title Courier log ($type)
graph_args --base 1000 -l 0
graph_vlabel events per second
graph_category Mail
EOT
echo "$CATEGORIES" | while read field label match; do
echo "${field}.label $(echo "$label" | tr "_" " ")"
echo "${field}.type DERIVE"
echo "${field}.min 0"
done
exit 0
fi
echo "$CATEGORIES" | while read field label match; do
echo -n "${field}.value "
grep " $type: " "$LOG_FILE" | grep "$match" | wc -l
done

View file

@ -1,88 +0,0 @@
#!/bin/bash
#
# Plugin to monitor incoming DKIM mail.
#
# Florian Sager, sager@agitos.de, 2008-02-06
#
# Parameters understood:
#
# config (required)
# autoconf (optional)
#
# Gives the result of the verification. The following values are possible:
#
# pass
# Returned if a valid DKIM-Signature header was found, and the signature contains a correct value for the message.
#
# fail
# Returned if a valid DKIM-Signature header was found, but the signature does not contain a correct value for the message.
#
# invalid
# Returned if no valid DKIM-Signature headers were found, but there is at least one invalid DKIM-Signature header. For a reason why a DKIM-Signature header found in the message was invalid, see $dkim->{signature_reject_reason}.
#
# none
# Returned if no DKIM-Signature headers (valid or invalid) were found.
#
# In case of multiple signatures, the "best" result will be returned. Best is defined as "pass", followed by "fail", "invalid", and "none".
#
mktempfile () {
mktemp -t
}
MAIL_LOG=${logfile:-/var/log/mail.log}
LOGTAIL=${logtail:-`which logtail`}
STATEFILE=/var/lib/munin/plugin-state/dkimproxy_mails.offset
if [ "$1" = "autoconf" ]; then
if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title DKIM Proxy mails'
echo 'graph_order dkimnone dkimpass dkiminvalid dkimfail'
echo 'graph_category mail'
echo 'graph_vlabel Count'
echo 'graph_args --base 1000 -l 0'
# echo 'graph_total total'
echo 'dkimnone.label No DKIM-Sigs'
echo 'dkimnone.min 0'
echo 'dkimpass.label Valid DKIM-Sigs'
echo 'dkimpass.min 0'
echo 'dkiminvalid.label Invalid DKIM-Sigs'
echo 'dkiminvalid.min 0'
echo 'dkimfail.label Failed DKIM-Sigs'
echo 'dkimfail.min 0'
exit 0
fi
dkimnone=U
dkimpass=U
dkiminvalid=U
dkiminfail=U
TEMP_FILE=`mktempfile munin-dkimproxy_mails.XXXXXX`
if [ -n "$TEMP_FILE" -a -f "$TEMP_FILE" ]
then
$LOGTAIL ${MAIL_LOG} $STATEFILE | grep "DKIM verify - " > ${TEMP_FILE}
dkimnone=`grep 'DKIM verify - none' ${TEMP_FILE} | wc -l`
dkimpass=`grep 'DKIM verify - pass' ${TEMP_FILE} | wc -l`
dkiminvalid=`grep 'DKIM verify - invalid' ${TEMP_FILE} | wc -l`
dkimfail=`grep 'DKIM verify - fail' ${TEMP_FILE} | wc -l`
/bin/rm -f $TEMP_FILE
fi
echo "dkimnone.value ${dkimnone}"
echo "dkimpass.value ${dkimpass}"
echo "dkiminvalid.value ${dkiminvalid}"
echo "dkimfail.value ${dkimfail}"

View file

@ -1,128 +0,0 @@
#!/bin/sh
#
# plugin to monitor mixminion stats
# pesco 2011, isc license
# munin metadata:
#%# capabilities=autoconf suggest
PATH=/bin:/usr/bin:/usr/local/bin
case $0 in
*_relay)
FIELDNAMES="AttemptedRelay SuccessfulRelay FailedRelay UnretriableRelay ReceivedPacket";;
*_exit)
FIELDNAMES="AttemptedDelivery SuccessfulDelivery FailedDelivery UnretriableDelivery";;
*)
FIELDNAMES="ReceivedConnection AttemptedConnect SuccessfulConnect FailedConnect";;
esac
case $1 in
autoconf)
# see if we got mixminion installed
if which mixminiond >/dev/null; then
echo "yes"
else
echo "no"
fi
exit 0;;
suggest)
desc="`cat /var/lib/mixminion/current-desc`"
echo connections
grep -q '^\[Incoming/MMTP\]' "$desc" && echo relay
grep -q '^\[Delivery/SMTP\]' "$desc" && echo exit
exit 0;;
config)
echo "graph_category mail"
echo "graph_args --base 1000 -l 0"
case $0 in
*_relay)
cat <<'EOM'
graph_title Mixminion relay
graph_vlabel packets per second
AttemptedRelay.label packets to relay
AttemptedRelay.info Total number of packets that we attempted to relay
AttemptedRelay.draw LINE2
FailedRelay.label relay errors
FailedRelay.info Number of packets that we (momentarily) failed to relay
FailedRelay.draw AREASTACK
UnretriableRelay.label permanent failures
UnretriableRelay.info Number of packets that we permanently gave up trying to relay
UnretriableRelay.draw AREASTACK
SuccessfulRelay.label relay success
SuccessfulRelay.info Number of packets that we successfully relayed
SuccessfulRelay.draw AREASTACK
SuccessfulRelay.graph no
ReceivedPacket.label incoming packets
ReceivedPacket.info Total number of packets that we received
ReceivedPacket.draw LINE2
EOM
;;
*_exit)
cat <<'EOM'
graph_title Mixminion exit
graph_vlabel messages per second
AttemptedDelivery.label messages to deliver
AttemptedDelivery.info Total number of emails that we tried to deliver
AttemptedDelivery.draw LINE2
FailedDelivery.label delivery errors
FailedDelivery.info Number of emails that we (momentarily) failed to deliver
FailedDelivery.draw AREASTACK
UnretriableDelivery.label permanent failures
UnretriableDelivery.info Number of emails that we permanently gave up trying to deliver
UnretriableDelivery.draw AREASTACK
SuccessfulDelivery.label delivery successes
SuccessfulDelivery.info Number of emails successfully delivered
SuccessfulDelivery.draw AREASTACK
SuccessfulDelivery.graph no
EOM
;;
*)
cat <<'EOM'
graph_title Mixminion connections
graph_vlabel connections in (-) / out (+) per second
ReceivedConnection.label incoming
ReceivedConnection.info number of successful incoming connections
ReceivedConnection.graph no
AttemptedConnect.label total conn's
AttemptedConnect.info Total number of attempted outgoing connections
AttemptedConnect.draw LINE2
AttemptedConnect.negative ReceivedConnection
FailedConnect.label conn. failures
FailedConnect.info Number of failed outgoing connections
FailedConnect.draw AREASTACK
SuccessfulConnect.label successful
SuccessfulConnect.info Number of successful in-/outgoin connections
SuccessfulConnect.draw AREASTACK
SuccessfulConnect.graph no
EOM
;;
esac
for field in $FIELDNAMES; do
echo "$field.type DERIVE"
echo "$field.min 0"
done
exit 0;;
esac
mixminion server-stats 2>/dev/null | perl -e '
while(<STDIN>) {
if(/^ *([[:alnum:]]+): *([.[:digit:]]+)/ &&
grep {$_ eq $1} @ARGV) {
print "$1.value $2\n";
}
}
' $FIELDNAMES

View file

@ -28,7 +28,7 @@ fi
if [ "$1" = "config" ]; then
echo 'graph_title Postfwd'
echo 'graph_category Mail'
echo 'graph_category fw'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel Postfwd statistics'
echo 'spamhaus.label Listed on Spamhaus.org'

View file

@ -1,64 +0,0 @@
#!/bin/sh
#
# Plugin to show amount of smtp-connections per hour
#
# Contributed by Håkon Nessjøen <lunatic@cpan.org>
#
# Modified by Massimiliano Cianelli <massimiliano@cianelli.eu>
# 2013-02-02 - Added support for Greylist and simscan Virus\Spam detect
# Added LOGPATH env var
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf
# get: env.logpath
LOGPATH=${logpath:-/var/log/qmail/qmail-smtpd/}
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Qmail SMTP connections'
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel connections/hour'
echo 'graph_category mail'
echo 'graph_order rbl greylisted accepted simscan_spam simscan_virus total'
echo 'rbl.label RBL rejected connections'
echo 'rbl.min 0'
echo 'rbl.draw AREA'
echo 'greylisted.label Greylisted connections'
echo 'greylisted.min 0'
echo 'greylisted.draw STACK'
echo 'accepted.label Accepted connections'
echo 'accepted.min 0'
echo 'accepted.draw STACK'
echo 'simscan_spam.label Rejected SPAM'
echo 'simscan_spam.min 0'
echo 'simscan_spam.draw STACK'
echo 'simscan_virus.label Rejected VIRUS'
echo 'simscan_virus.min 0'
echo 'simscan_virus.draw STACK'
echo 'total.label Total connections'
echo 'total.min 0'
echo 'total.draw LINE1'
exit 0
fi
rbl=`cat $LOGPATH/@* $LOGPATH/current | grep -c rblsmtp`
accepted=`cat $LOGPATH/@* $LOGPATH/current | grep -c 'tcpserver: ok'`
greylisted=`cat $LOGPATH/@* $LOGPATH/current | grep -ce "jgreylist\[[[:digit:]]\+\]: .\+\: GREY"`
simscan_spam=`cat $LOGPATH/@* $LOGPATH/current | grep -ce "simscan:\[[[:digit:]]\+\]:SPAM"`
simscan_virus=`cat $LOGPATH/@* $LOGPATH/current | grep -ce "simscan:\[[[:digit:]]\+\]:VIRUS"`
echo -n "rbl.value " && ( echo $rbl || echo U )
echo -n "accepted.value " && ( echo $accepted || echo U )
echo -n "greylisted.value " && ( echo $greylisted || echo U )
echo -n "simscan_spam.value " && ( echo $simscan_spam || echo U )
echo -n "simscan_virus.value " && ( echo $simscan_virus || echo U )
echo "total.value $(expr $rbl + $accepted + $greylisted)"

View file

@ -1,97 +0,0 @@
#!/usr/bin/perl -w
#
# Plugin to show amount of individual outgoing smtp-replies per hour
#
# Contributed by Håkon Nessjøen <lunatic@cpan.org>
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf
use strict;
my $logpath = $ENV{'logpath'} || '/var/log/mail/';
if (exists $ARGV[0]) {
if ($ARGV[0] eq "autoconf") {
if (-f "${logpath}current") {
print "yes\n";
exit 0;
} else {
print STDERR "no (Cannot find ${logpath}current. Please specify env.logpath)\n";
exit 1;
}
}
}
my %responses;
# '453' => 'You have no mail (atrn)',
# '503' => 'Bad sequence of commands',
my %descriptions = (
'250' => 'Mail delivery ok',
'421' => 'Service unavail or timeout',
'441' => 'No established connection',
'442' => 'Connection Died',
'450' => 'Mbox unavail or greylist',
'451' => 'Err processing or greylist',
'452' => 'Insufficient storage space',
'454' => 'TLS not available now',
'472' => 'DNS transaction timeout',
'500' => 'Unsolicited mail',
'501' => 'Syntax error',
'511' => 'Blocked or blacklisted',
'522' => 'Mailbox full',
'550' => 'Mailbox unavailable',
'551' => 'User not local',
'552' => 'Content or storage error',
'553' => 'Mailbox name not allowed',
'554' => 'Session failed or blocked',
'557' => 'Too many duplicate msgs'
);
#open(DATA,"cat ${logpath}current $logpath\@* | perl -ne'm/Remote_host_said:_(\\d+)/ && print \$1.\"\n\";' | sort | uniq -c|");
open(DATA,"grep -E '_\\(\\#4\\.4\\.1\\)|_\\(\\#4\\.4\\.2\\)|Remote_host_said:_' ${logpath}current | sed 's/_(\\#4\\.4\\.1)/\\/Remote_host_said:_441_/; s/_(\\#4\\.4\\.2)/\\/Remote_host_said:_442_/' | perl -ne'm/Remote_host_said:_(\\d+)/ && print \$1.\"\n\";' | sort -n | uniq -c|");
while (<DATA>) {
if (m/\s*(\d+)\s+(\d+)/) {
$responses{$2} = $1;
}
}
close(DATA);
if (exists $ARGV[0]) {
if ($ARGV[0] eq 'config') {
print "graph_title Qmail outgoing SMTP replies\n";
print "graph_args --base 1000 -l 0 \n";
print "graph_vlabel replies/hour\n";
print "graph_category Mail\n";
print "graph_total Total\n" if (keys (%descriptions) > 1);
print "graph_info This graph shows qmail-send transaction response codes.\n";
print "graph_order res" . join(" res", sort by_code keys %descriptions) . "\n";
foreach (sort by_code keys %descriptions) {
my $name = 'res' . $_;
print "$name.label ";
print $_." ".$descriptions{$_}."\n";
print "$name.min 0\n";
print "$name.draw LINE1\n";
}
exit;
}
}
foreach (sort by_code keys %descriptions) {
#print "res$_.value ".int($responses{$_})."\n";
if (exists $responses{$_}) {
print "res$_.value $responses{$_}\n";
}else{
print "res$_.value 0\n";
}
}
sub by_code {
return $a cmp $b;
}

View file

@ -1,97 +0,0 @@
#!/usr/bin/perl -w
#
# Plugin to show amount of individual outgoing smtp-replies per hour
#
# Contributed by Håkon Nessjøen <lunatic@cpan.org>
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf
use strict;
my $logpath = $ENV{'logpath'} || '/usr/local/psa/var/log/';
if (exists $ARGV[0]) {
if ($ARGV[0] eq "autoconf") {
if (-f "${logpath}maillog") {
print "yes\n";
exit 0;
} else {
print STDERR "no (Cannot find ${logpath}maillog. Please specify env.logpath)\n";
exit 1;
}
}
}
my %responses;
# '453' => 'You have no mail (atrn)',
# '503' => 'Bad sequence of commands',
my %descriptions = (
'250' => 'Mail delivery ok',
'421' => 'Service unavail or timeout',
'441' => 'No established connection',
'442' => 'Connection Died',
'450' => 'Mbox unavail or greylist',
'451' => 'Err processing or greylist',
'452' => 'Insufficient storage space',
'454' => 'TLS not available now',
'472' => 'DNS transaction timeout',
'500' => 'Unsolicited mail',
'501' => 'Syntax error',
'511' => 'Blocked or blacklisted',
'522' => 'Mailbox full',
'550' => 'Mailbox unavailable',
'551' => 'User not local',
'552' => 'Content or storage error',
'553' => 'Mailbox name not allowed',
'554' => 'Session failed or blocked',
'557' => 'Too many duplicate msgs'
);
#open(DATA,"cat ${logpath}maillog $logpath\@* | perl -ne'm/Remote_host_said:_(\\d+)/ && print \$1.\"\n\";' | sort | uniq -c|");
open(DATA,"grep -E '_\\(\\#4\\.4\\.1\\)|_\\(\\#4\\.4\\.2\\)|Remote_host_said:_' ${logpath}maillog | sed 's/_(\\#4\\.4\\.1)/\\/Remote_host_said:_441_/; s/_(\\#4\\.4\\.2)/\\/Remote_host_said:_442_/' | perl -ne'm/Remote_host_said:_(\\d+)/ && print \$1.\"\n\";' | sort -n | uniq -c|");
while (<DATA>) {
if (m/\s*(\d+)\s+(\d+)/) {
$responses{$2} = $1;
}
}
close(DATA);
if (exists $ARGV[0]) {
if ($ARGV[0] eq 'config') {
print "graph_title Qmail outgoing SMTP replies\n";
print "graph_args --base 1000 -l 0 \n";
print "graph_vlabel replies/hour\n";
print "graph_category Mail\n";
print "graph_total Total\n" if (keys (%descriptions) > 1);
print "graph_info This graph shows qmail-send transaction response codes.\n";
print "graph_order res" . join(" res", sort by_code keys %descriptions) . "\n";
foreach (sort by_code keys %descriptions) {
my $name = 'res' . $_;
print "$name.label ";
print $_." ".$descriptions{$_}."\n";
print "$name.min 0\n";
print "$name.draw LINE1\n";
}
exit;
}
}
foreach (sort by_code keys %descriptions) {
#print "res$_.value ".int($responses{$_})."\n";
if (exists $responses{$_}) {
print "res$_.value $responses{$_}\n";
}else{
print "res$_.value 0\n";
}
}
sub by_code {
return $a cmp $b;
}

View file

@ -1,29 +0,0 @@
#!/bin/sh
#
# Plugin to count the qmail-remote processes
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
echo "yes"
exit 0
fi
if [ "$1" = "config" ]; then
cat <<EOT
graph_title Qmail-remote processes
graph_args --base 1000 -l 0
graph_vlabel running processes
graph_category Mail
remote.label remote
remote.type GAUGE
EOT
exit 0
fi
echo -n "remote.value " && pgrep qmail-remote | wc -l

View file

@ -1,30 +0,0 @@
#!/bin/sh
#
# Plugin to count the qmail queue
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
echo "yes"
exit 0
fi
if [ "$1" = "config" ]; then
cat <<EOT
graph_title Qmail queue stats
graph_args --base 1000 -l 0
graph_vlabel mails in queue
graph_category Mail
queue.label queue
queue.type GAUGE
queue.min 0
EOT
exit 0
fi
echo -n "queue.value " && /usr/bin/find $queue/mess/ -type f -print | /usr/bin/wc -l

View file

@ -1,75 +0,0 @@
#!/bin/bash
: <<=cut
=head1 NAME
sa-learn - Munin plugin to monitor spamassasin bayes database size
=head1 APPLICABLE SYSTEMS
Any server running spamassassin
=head1 CONFIGURATION
This plugin assumes your Spamassassin database is in /var/lib/MailScanner.
If it's elsewhere (or you want to use a different database) you will need
a configuration such as:
[sa-learn]
env.BayesDir /path/to/bayes/directory/
user mail
(where 'user mail' refers to a user that can read the database).
=head1 MAGIC MARKERS
#%# family=contrib
=head1 VERSION
2
=head1 AUTHOR
Paul Saunders L<darac+munin@darac.org.uk>
=cut
#'
case $1 in
config)
cat <<'EOM'
graph_title SA-Learn Magic
graph_vlabel Count
graph_args --base 1000 -l 0
graph_category Mail
spam.label Num Spam
spam.type GAUGE
ham.label Num Ham
ham.type GAUGE
tokens.label Num Tokens
tokens.type GAUGE
EOM
exit 0;;
esac
## Print values
BayesDir=${BayesDir:-/var/lib/MailScanner}
sa-learn --dbpath $BayesDir/ --dump magic 2>/dev/null | while read line
do
case "$line" in
*nspam*)
echo -n "spam.value "
echo $line | awk '{print $3}'
;;
*nham*)
echo -n "ham.value "
echo $line | awk '{print $3}'
;;
*ntokens*)
echo -n "tokens.value "
echo $line | awk '{print $3}'
;;
esac
done

View file

@ -1,182 +0,0 @@
#!/usr/bin/perl
# -*- perl -*-
=head1 NAME
sendmail_mailq
=head1 APPLICABLE SYSTEMS
Systems running sendmail as MTA
=head1 CONFIGURATION
[sendmail_mailq]
# shall run as root in order to get access to sendmail queues
user root
# warning and critical thresholds
env.warning 200
env.critical 300
# include total and/or detail of MTA queues
# rem : mtatotal is changed to "yes" if both are "no"
# in case of just one queue only one is shown
env.mtatotal yes
env.mtadetail yes
# include total and/or detail of MSP queues
# rem : mtatotal is changed to "yes" if both are "no"
# in case of just one queue only one is shown
env.msptotal yes
env.mspdetail yes
=head1 BUGS/GOTCHAS
If you find one, drop a message to the author
* The autoconfiguration returns yes if it finds both sendmail
mailq and sendmail.cf configuration files. This may be wrong
if the system has both postfix and sendmail installed but the
enabled MTA is postfix.
=head1 AUTHOR
Jose-Marcio Martins da Cruz - mailto:Jose-Marcio.Martins@mines-paristech.fr
Ecole Nationale Superieure des Mines de Paris
=head1 VERSION
1.0 - Jan, 04, 2014
=head1 LICENSE
GPLv2
=head1 MAGIC MARKERS
#%# family=contrib
#%# capabilities=autoconf
=cut
use strict;
use warnings;
my $MAILQ = "mailq";
my $SMCF = "/etc/mail/sendmail.cf";
my %EnvConf = (
'warning' => defined $ENV{'warning'} ? $ENV{'warning'} : '200',
'critical' => defined $ENV{'critical'} ? $ENV{'critical'} : '300'
);
foreach my $k (qw(mtatotal mtadetail msptotal mspdetail)) {
if (exists $ENV{$k}) {
$EnvConf{$k} = $ENV{$k} =~ /^(yes|true|oui|vrai|1)$/i;
} else {
$EnvConf{$k} = 1;
}
}
if ($#ARGV >= 0 && $ARGV[0] eq "autoconf") {
unless (-f $SMCF) {
print "no\n";
exit 0;
}
unless (system("$MAILQ > /dev/null 2>&1") == 0) {
print "no\n";
exit 0;
}
print "yes\n";
exit 0;
}
if ($#ARGV >= 0 && $ARGV[0] eq "config") {
my %MTAQueue = ();
my %MSPQueue = ();
GetQueue(\%MTAQueue, "", $EnvConf{mtadetail}, $EnvConf{mtatotal});
GetQueue(\%MSPQueue, "-Ac", $EnvConf{mspdetail}, $EnvConf{msptotal});
print <<EOT;
graph_title sendmail queue size
graph_category mail
graph_vlabel messages
graph_scale no
EOT
my @ord = qw();
push @ord, sort grep {$_ = "mta_" . $_;} keys %MTAQueue;
push @ord, sort grep {$_ = "msp_" . $_;} keys %MSPQueue;
printf "graph_order %s\n", join " ", @ord;
foreach my $k (sort keys %MTAQueue) {
printf "mta_%s.label MTA %s\n", $k, $MTAQueue{$k}{name};
printf "mta_%s.warning %d\n", $k, $EnvConf{warning};
printf "mta_%s.critical %d\n", $k, $EnvConf{critical};
}
foreach my $k (sort keys %MSPQueue) {
printf "msp_%s.label MSP %s\n", $k, $MSPQueue{$k}{name};
printf "msp_%s.warning %d\n", $k, $EnvConf{warning};
printf "msp_%s.critical %d\n", $k, $EnvConf{critical};
}
exit 0;
}
if ($#ARGV < 0) {
my %MTAQueue = ();
my %MSPQueue = ();
GetQueue(\%MTAQueue, "", $EnvConf{mtadetail}, $EnvConf{mtatotal});
foreach my $k (sort keys %MTAQueue) {
printf "mta_%s.value %d\n", $k, $MTAQueue{$k}{value};
}
GetQueue(\%MSPQueue, "-Ac", $EnvConf{mspdetail}, $EnvConf{msptotal});
foreach my $k (sort keys %MSPQueue) {
printf "msp_%s.value %d\n", $k, $MSPQueue{$k}{value};
}
exit 0;
}
exit 1;
sub GetQueue {
my ($h, $opt, $detail, $total, undef) = @_;
my @QUEUE = `$MAILQ $opt 2>/dev/null`;
my $totsz = 0;
my $ndetail = 0;
foreach my $qline (@QUEUE) {
if ($qline =~ /^\s*(\S+)\s+\((\d+)\s+request.*\)/) {
$ndetail++;
if ($detail || !$total) {
my ($field, $name) = QueueName($1);
$h->{$field}{name} = $name;
$h->{$field}{value} = $2;
$totsz += $2;
}
next;
}
if ($qline =~ /^\s*(\S+)\s+is\s+empty/) {
$ndetail++;
if ($detail || !$total) {
my ($field, $name) = QueueName($1);
$h->{$field}{name} = $name;
$h->{$field}{value} = 0;
}
next;
}
}
if ($total && $ndetail > 1) {
$h->{zztotal}{name} = "=== Total ===";
$h->{zztotal}{value} = $totsz;
}
}
sub QueueName {
my ($q, undef) = @_;
my ($field, $name) = (undef, undef);
$name = `basename $q`;
chomp $name;
$field = $name;
$field =~ s/[^A-Za-z0-9_]/_/g;
return ($field, $name);
}

View file

@ -1,214 +0,0 @@
#!/bin/bash
#
# Plugin to monitor spamdyke
#
# Spamdyke logs expected to be inside /var/log/mail.info
# logtail must be installed
# Plugin state stored in /var/lib/munin/plugin-state
# (statedir as defined in munin debian packages)
#
# You may override spamdyke logfile in plugin-conf.d/munin-node, and
# give the user/group with enough rights to read your logs (group
# adm on stock debian works fine)
#
# [spamdyke]
# env.logfile /var/log/maillog
# group adm
#
#
#
# Parameters understood:
#
# config (required)
# autoconf (optional)
#
mktempfile () {
mktemp -t
}
MAIL_LOG=${logfile:-/var/log/mail.info}
LOGTAIL=${logtail:-`which logtail`}
STATEFILE=/var/lib/munin/plugin-state/spamdyke.offset
if [ "$1" = "autoconf" ]; then
if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title spamdyke filtering'
echo 'graph_category mail'
echo 'graph_vlabel Count'
echo 'graph_args --base 1000 -l 0'
echo 'graph_total total'
echo 'allowed.label ALLOWED'
echo 'allowed.info The message passed all filters. qmail may still bounce the message for other reasons, however. '
echo 'allowed.min 1'
echo 'allowedauthenticated.label ALLOWED_AUTHENTICATED'
echo 'allowedauthenticated.info The remote client successfully authenticated using SMTP AUTH with spamdyke. If qmail is patched to provide SMTP AUTH, this code will never be used '
echo 'allowedauthenticated.min 1'
echo 'allowedtls.label ALLOWED_TLS'
echo 'allowedtls.info The remote client successfully started a TLS session with spamdyke '
echo 'allowedtls.min 1'
echo 'timeout.label TIMEOUT'
echo 'timeout.info The connection timed out, either in total time ("connection-timeout-secs") or idle time ("idle-timeout-secs"). If the connection was already being blocked for another reason, the code for that error is given as REALCODE '
echo 'timeout.min 1'
echo 'deniedtoomanyrecipients.label DENIED_TOO_MANY_RECIPIENTS'
echo 'deniedtoomanyrecipients.info The recipient was blocked because the limit ("max-recipients") was reached for this connection. The SMTP connection continues after this error occurs'
echo 'deniedtoomanyrecipients.min 1'
echo 'deniedunqualifiedrecipient.label DENIED_UNQUALIFIED_RECIPIENT'
echo 'deniedunqualifiedrecipient.info The recipient was blocked because the address had no domain name. The SMTP connection continues after this error occurs'
echo 'deniedunqualifiedrecipient.min 1'
echo 'deniedgraylisted.label DENIED_GRAYLISTED'
echo 'deniedgraylisted.info recipient was blocked because the sender/recipient combination was graylisted '
echo 'deniedgraylisted.min 1'
echo 'deniedrdnsmissing.label DENIED_RDNS_MISSING'
echo 'deniedrdnsmissing.info The connection was blocked because the remote server has no rDNS name at all'
echo 'deniedrdnsmissing.min 1'
echo 'deniedrdnsresolve.label DENIED_RDNS_RESOLVE'
echo 'deniedrdnsresolve.info The connection was blocked because the remote servers rDNS name does not resolve '
echo 'deniedrdnsresolve.min 1'
echo 'deniedipinccrdns.label DENIED_IP_IN_CC_RDNS'
echo 'deniedipinccrdns.info The connection was blocked because the remote servers IP address was found in the remote servers rDNS name _and_ the remote servers rDNS name ends in a country code ("reject-ip-in-cc-rdns"). '
echo 'deniedipinccrdns.min 1'
echo 'deniedipinrdns.label DENIED_IP_IN_RDNS'
echo 'deniedipinrdns.info The connection was blocked because the remote servers IP address was found in the remote servers rDNS name _and_ a prohibited keyword was found in the remote servers rDNS name ("ip-in-rdns-keyword-file"). '
echo 'deniedipinrdns.min 1'
echo 'deniedearlytalker.label DENIED_EARLYTALKER'
echo 'deniedearlytalker.info The connection was blocked because the remote server began sending data before the SMTP greeting was issued ("greeting-delay-secs"). '
echo 'deniedearlytalker.min 1'
echo 'deniedblacklistname.label DENIED_BLACKLIST_NAME'
echo 'deniedblacklistname.info The connection was blocked because the base domain of the remote servers rDNS name is blacklisted ("rdns-blacklist-file" or "rdns-blacklist-dir"). '
echo 'deniedblacklistname.min 1'
echo 'deniedblacklistip.label DENIED_BLACKLIST_IP'
echo 'deniedblacklistip.info The connection was blocked because the remote servers IP address is blacklisted ("ip-blacklist-file"). '
echo 'deniedblacklistip.min 1'
echo 'deniedsenderblacklisted.label DENIED_SENDER_BLACKLISTED'
echo 'deniedsenderblacklisted.info The connection was blocked because the senders email address is blacklisted ("sender-blacklist-file"). '
echo 'deniedsenderblacklisted.min 1'
echo 'deniedrecipientblacklisted.label DENIED_RECIPIENT_BLACKLISTED'
echo 'deniedrecipientblacklisted.info The recipient was blocked because the recipient email address is blacklisted ("recipient-blacklist-file"). '
echo 'deniedrecipientblacklisted.min 1'
echo 'deniedrblmatch.label DENIED_RBL_MATCH'
echo 'deniedrblmatch.info The connection was blocked because the remote servers IP address was found on a DNS RBL ("check-dnsrbl"). '
echo 'deniedrblmatch.min 1'
echo 'deniedrhsblmatch.label DENIED_RHSBL_MATCH'
echo 'deniedrhsblmatch.info The connection was blocked because the remote servers reverse DNS name was found on a righthand-side DNS blacklist (RHSBL) OR the connection was blocked because the senders domain name was found on a righthand-side DNS blacklist (RHSBL). '
echo 'deniedrhsblmatch.min 1'
echo 'deniedsendernomx.label DENIED_SENDER_NO_MX'
echo 'deniedsendernomx.info The connection was blocked because the senders domain has no mail exchanger, making the sender address invalid'
echo 'deniedsendernomx.min 1'
echo 'deniedccessdenied.label DENIED_ACCESS_DENIED'
echo 'deniedaccessdenied.info The connection was blocked because the remote servers IP address or rDNS name was found in the access file with a "deny" command ("access-file"). '
echo 'deniedccessdenied.min 1'
echo 'deniedrelaying.label DENIED_RELAYING'
echo 'deniedrelaying.info The recipient was blocked because the recipients domain is not locally hosted ("local-domains-file") and the remote server is not allowed to relay ("access-file"). '
echo 'deniedrelaying.min 1'
echo 'deniedother.label DENIED_OTHER'
echo 'deniedother.info The connection was rejected by qmail (or another downstream filter), not spamdyke. '
echo 'deniedother.min 1'
echo 'failedauth.label FAILED_AUTH'
echo 'failedauth.info The remote server attempted to authenticate but the given username and/or password were incorrect ("smtp-auth-command" or "smtp-auth-command-encryption"). '
echo 'failedauth.min 1'
echo 'unknownauth.label UNKNOWN_AUTH'
echo 'unknownauth.info The remote server requested an authentication method spamdyke doesnt support. This should not happen. '
echo 'unknownauth.min 1'
echo 'failedtls.label FAILED_TLS'
echo 'failedtls.info The remote client attempted to start a TLS session but SSL negotiation failed.'
echo 'failedtls.min 1'
exit 0
fi
allowed=u
allowedauthenticated=u
allowedtls=u
timeout=u
deniedtoomanyrecipients=U
deniedunqualifiedrecipient=U
deniedgraylisted=U
deniedrdnsmissing=U
deniedrdnsresolve=U
deniedipinccrdns=U
deniedipinrdns=U
deniedearlytalker=U
deniedblacklistname=U
deniedblacklistip=U
deniedsenderblacklisted=U
deniedrecipientblacklisted=U
deniedrblmatch=U
deniedrhsblmatch=U
deniedsendernomx=U
deniedccessdenied=U
deniedrelaying=U
deniedother=U
failedauth=U
unknownauth=U
failedtls=U
TEMP_FILE=`mktempfile munin.spamdyke.XXXXXX`
if [ -n "$TEMP_FILE" -a -f "$TEMP_FILE" ]
then
$LOGTAIL ${MAIL_LOG} $STATEFILE | grep "spamdyke\[.*\]:" > ${TEMP_FILE}
allowed=`grep 'spamdyke\[[0-9\]*]: ALLOWED' ${TEMP_FILE} | wc -l`
allowedauthenticated=`grep 'spamdyke\[[0-9]*\]: ALLOWED_AUTHENTICATED' ${TEMP_FILE} | wc -l`
allowedtls=`grep 'spamdyke\[[0-9]\]: ALLOWED_TLS' ${TEMP_FILE} | wc -l`
timeout=`grep 'spamdyke\[[0-9]*\]: TIMEOUT' ${TEMP_FILE} | wc -l`
deniedtoomanyrecipients=`grep 'spamdyke\[[0-9]*\]: DENIED_TOO_MANY_RECIPIENTS' ${TEMP_FILE} | wc -l`
deniedunqualifiedrecipient=`grep 'spamdyke\[[0-9]*\]: DENIED_UNQUALIFIED_RECIPIENT' ${TEMP_FILE} | wc -l`
deniedgraylisted=`grep 'spamdyke\[[0-9]*\]: DENIED_GRAYLISTED' ${TEMP_FILE} | wc -l`
deniedrdnsmissing=`grep 'spamdyke\[[0-9]*\]: DENIED_RDNS_MISSING' ${TEMP_FILE} | wc -l`
deniedrdnsresolve=`grep 'spamdyke\[[0-9]*\]: DENIED_RDNS_RESOLVE' ${TEMP_FILE} | wc -l`
deniedipinccrdns=`grep 'spamdyke\[[0-9]*\]: DENIED_IP_IN_CC_RDNS' ${TEMP_FILE} | wc -l`
deniedipinrdns=`grep 'spamdyke\[[0-9]*\]: DENIED_IP_IN_RDNS' ${TEMP_FILE} | wc -l`
deniedearlytalker=`grep 'spamdyke\[[0-9]*\]: DENIED_EARLYTALKER' ${TEMP_FILE} | wc -l`
deniedblacklistname=`grep 'spamdyke\[[0-9]*\]: DENIED_BLACKLIST_NAME' ${TEMP_FILE} | wc -l`
deniedblacklistip=`grep 'spamdyke\[[0-9]*\]: DENIED_BLACKLIST_IP' ${TEMP_FILE} | wc -l`
deniedsenderblacklisted=`grep 'spamdyke\[[0-9]*\]: DENIED_SENDER_BLACKLISTED' ${TEMP_FILE} | wc -l`
deniedrecipientblacklisted=`grep 'spamdyke\[[0-9]*\]: DENIED_RECIPIENT_BLACKLISTED' ${TEMP_FILE} | wc -l`
deniedrblmatch=`grep 'spamdyke\[[0-9]*\]: DENIED_RBL_MATCH' ${TEMP_FILE} | wc -l`
deniedrhsblmatch=`grep 'spamdyke\[[0-9]*\]: DENIED_RHSBL_MATCH' ${TEMP_FILE} | wc -l`
deniedsendernomx=`grep 'spamdyke\[[0-9]*\]: DENIED_SENDER_NO_MX' ${TEMP_FILE} | wc -l`
deniedccessdenied=`grep 'spamdyke\[[0-9]*\]: DENIED_ACCESS_DENIED' ${TEMP_FILE} | wc -l`
deniedrelaying=`grep 'spamdyke\[[0-9]*\]: DENIED_RELAYING' ${TEMP_FILE} | wc -l`
deniedother=`grep 'spamdyke\[[0-9]*\]: DENIED_OTHER' ${TEMP_FILE} | wc -l`
failedauth=`grep 'spamdyke\[[0-9]*\]: FAILED_AUTH' ${TEMP_FILE} | wc -l`
unknownauth=`grep 'spamdyke\[[0-9]*\]: UNKNOWN_AUTH' ${TEMP_FILE} | wc -l`
failedtls=`grep 'spamdyke\[[0-9]*\]: FAILED_TLS' ${TEMP_FILE} | wc -l`
/bin/rm -f $TEMP_FILE
fi
echo "allowed.value ${allowed}"
echo "allowedauthenticated.value ${allowedauthenticated}"
echo "allowedtls.value ${allowedtls}"
echo "timeout.value ${timeout}"
echo "deniedtoomanyrecipients.value ${deniedtoomanyrecipients}"
echo "deniedunqualifiedrecipient.value ${deniedunqualifiedrecipient}"
echo "deniedgraylisted.value ${deniedgraylisted}"
echo "deniedrdnsmissing.value ${deniedrdnsmissing}"
echo "deniedrdnsresolve.value ${deniedrdnsresolve}"
echo "deniedipinccrdns.value ${deniedipinccrdns}"
echo "deniedipinrdns.value ${deniedipinrdns}"
echo "deniedearlytalker.value ${deniedearlytalker}"
echo "deniedblacklistname.value ${deniedblacklistname}"
echo "deniedblacklistip.value ${deniedblacklistip}"
echo "deniedsenderblacklisted.value ${deniedsenderblacklisted}"
echo "deniedrecipientblacklisted.value ${deniedrecipientblacklisted}"
echo "deniedrblmatch.value ${deniedrblmatch}"
echo "deniedrhsblmatch.value ${deniedrhsblmatch}"
echo "deniedsendernomx.value ${deniedsendernomx}"
echo "deniedccessdenied.value ${deniedccessdenied}"
echo "deniedrelaying.value ${deniedrelaying}"
echo "deniedother.value ${deniedother}"
echo "failedauth.value ${failedauth}"
echo "unknownauth.value ${unknownauth}"
echo "failedtls.value ${failedtls}"