mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Category Tree: Reduce number of categories
netapp -> san
This commit is contained in:
parent
7042351e74
commit
f523f095f9
18 changed files with 14 additions and 14 deletions
81
plugins/postfix/postgrey
Executable file
81
plugins/postfix/postgrey
Executable file
|
@ -0,0 +1,81 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Plugin to monitor incoming Postgrey
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional)
|
||||
#
|
||||
|
||||
|
||||
mktempfile () {
|
||||
mktemp -t
|
||||
}
|
||||
|
||||
MAIL_LOG=${logfile:-/var/log/mail.log}
|
||||
STATEFILE=/var/lib/munin/plugin-state/postgrey.offset
|
||||
LOGTAIL=${logtail:-`which logtail`}
|
||||
|
||||
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 Postgrey daily filtering'
|
||||
echo 'graph_order delayed passed whitelisted'
|
||||
echo 'graph_category mail'
|
||||
echo 'graph_vlabel Count'
|
||||
echo 'graph_scale no'
|
||||
|
||||
## echo 'graph_args --base 1000 -l 0'
|
||||
echo 'delayed.label delayed'
|
||||
# echo 'delayed.type DERIVE'
|
||||
echo 'passed.label passed'
|
||||
# echo 'passed.type DERIVE'
|
||||
echo 'whitelisted.label whitelisted'
|
||||
# echo 'whitelisted.type DERIVE'
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
delayed=0
|
||||
passed=0
|
||||
whitelisted=0
|
||||
|
||||
ARGS=0
|
||||
`$LOGTAIL /etc/hosts 2>/dev/null >/dev/null`
|
||||
if [ $? = 66 ]; then
|
||||
if [ ! -n "$logtail" ]; then
|
||||
ARGS=1
|
||||
fi
|
||||
fi
|
||||
|
||||
TEMP_FILE=`mktempfile munin-postgrey.XXXXXX`
|
||||
|
||||
if [ -n "$TEMP_FILE" -a -f "$TEMP_FILE" ]
|
||||
then
|
||||
if [ $ARGS != 0 ]; then
|
||||
$LOGTAIL ${MAIL_LOG} $STATEFILE | grep 'post[fix|grey]' > ${TEMP_FILE}
|
||||
else
|
||||
$LOGTAIL ${MAIL_LOG} $STATEFILE | grep 'post[fix|grey]' > ${TEMP_FILE}
|
||||
fi
|
||||
|
||||
delayed=`grep 'Recipient address rejected.*Greylisted' ${TEMP_FILE} | wc -l`
|
||||
passed=`grep 'postgrey\[[0-9]*\]: delayed [0-9]* seconds:' ${TEMP_FILE} | wc -l`
|
||||
whitelisted=`grep 'postgrey\[[0-9]*\]: whitelisted:' ${TEMP_FILE} | wc -l`
|
||||
|
||||
/bin/rm -f $TEMP_FILE
|
||||
fi
|
||||
|
||||
echo "delayed.value ${delayed}"
|
||||
echo "passed.value ${passed}"
|
||||
echo "whitelisted.value ${whitelisted}"
|
||||
|
160
plugins/postfix/postgrey-new
Executable file
160
plugins/postfix/postgrey-new
Executable file
|
@ -0,0 +1,160 @@
|
|||
#! /usr/bin/perl
|
||||
###################################################################
|
||||
# Munins Plugin to monitor actions of postgrey greylisting daemon #
|
||||
# Version 0.1 #
|
||||
###################################################################
|
||||
|
||||
######################### Configuration ###########################
|
||||
# Usually this plugin will look in /var/log/mail.log for the #
|
||||
# output of postgrey. You can change that by setting env.logfile #
|
||||
# The state file is /var/lib/munin/plugin-state/postgrey-new.state#
|
||||
# This can be changed by setting env.statefile #
|
||||
# Keep in mind to grant enough rigths in order to open the #
|
||||
# logfiles etc. #
|
||||
# Parameters understood by this plugin #
|
||||
# #
|
||||
# config (required) #
|
||||
# autoconf (optional) #
|
||||
# #
|
||||
###################################################################
|
||||
# This plgin works with postgrey 1.31 but should also do with 1.32#
|
||||
# Tested under Debian lenny #
|
||||
###################################################################
|
||||
|
||||
|
||||
### Author Rico Sagner hellriegel@sund-xplosion.de
|
||||
### Please send bug reports to this address
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $maillog= $ENV{'logfile'} || "/var/log/mail.log";
|
||||
my $statefile= $ENV{'statefile'} || "/var/lib/munin/plugin-state/postgrey-new.state";
|
||||
|
||||
my $greylisted=0;
|
||||
my $greylisted_old=0;
|
||||
my $passes=0;
|
||||
my $passes_old=0;
|
||||
my $passes_white=0;
|
||||
my $passes_white_old=0;
|
||||
my $retry=0;
|
||||
my $retry_old=0;
|
||||
my $grey_new=0;
|
||||
my $pass_new=0;
|
||||
my $retry_new=0;
|
||||
my $passes_white_new=0;
|
||||
|
||||
if(defined $ARGV[0] and $ARGV[0] eq "autoconf") {
|
||||
if ( -f $maillog) {
|
||||
print "yes\n";
|
||||
exit 0;
|
||||
}
|
||||
else {
|
||||
print "no\n";
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(defined $ARGV[0] and $ARGV[0] eq "config") {
|
||||
print "graph_title Postgrey Actions\n";
|
||||
print "graph_order greylisted retry_early passed passed_w\n";
|
||||
print "graph_category mail\n";
|
||||
print "graph_vlabel Count\n";
|
||||
print "graph_scale no\n";
|
||||
|
||||
print "greylisted.label greylisted_reason_new\n";
|
||||
print "greylisted.type GAUGE\n";
|
||||
print "greylisted.draw AREA\n";
|
||||
print "greylisted.min 0\n";
|
||||
print "retry_early.label greylisted_retry_early\n";
|
||||
print "retry_early.type GAUGE\n";
|
||||
print "retry_early.draw AREA\n";
|
||||
print "retry_early.min 0\n";
|
||||
print "passed.label passed_found\n";
|
||||
print "passed.type GAUGE\n";
|
||||
print "passed.draw AREA\n";
|
||||
print "passed.min 0\n";
|
||||
print "passed_w.label passed_whitelisted\n";
|
||||
print "passed_w.type GAUGE\n";
|
||||
print "passed_w.draw AREA\n";
|
||||
print "passed_w.min 0\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if( -f $statefile) {
|
||||
open ( STATE ,"<$statefile");
|
||||
defined($greylisted_old=<STATE>) or $greylisted_old=0;
|
||||
defined($passes_old=<STATE>) or $passes_old=0;
|
||||
defined($retry_old=<STATE>) or $retry_old=0;
|
||||
defined($passes_white_old=<STATE>) or $passes_white_old=0;
|
||||
chomp($greylisted_old);
|
||||
chomp($passes_old);
|
||||
chomp($retry_old);
|
||||
chomp($passes_white_old);
|
||||
close STATE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
open (LOG ,"<$maillog") or die "Cannot open Maillog";
|
||||
while(my $line = <LOG>)
|
||||
{
|
||||
if($line=~m/postgrey\[/)
|
||||
{
|
||||
if($line=~m/action=greylist/) {
|
||||
if($line=~m/reason=new/)
|
||||
{
|
||||
$greylisted++;
|
||||
}
|
||||
elsif($line=~m/reason=early-retry/)
|
||||
{
|
||||
$retry++;
|
||||
}
|
||||
}
|
||||
elsif($line=~m/action=pass/) {
|
||||
if($line=~m/reason=triplet/)
|
||||
{
|
||||
$passes++;
|
||||
}
|
||||
elsif($line=~m/reason=client/)
|
||||
{
|
||||
$passes_white++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
close(LOG);
|
||||
|
||||
|
||||
open (STATE2,">$statefile");
|
||||
print STATE2 "$greylisted\n";
|
||||
print STATE2 "$passes\n";
|
||||
print STATE2 "$retry\n";
|
||||
print STATE2 "$passes_white\n";
|
||||
close STATE2;
|
||||
|
||||
if($greylisted_old>$greylisted) { $grey_new=$greylisted; }
|
||||
elsif($greylisted_old eq $greylisted) { $grey_new=0;}
|
||||
else { $grey_new=$greylisted-$greylisted_old; }
|
||||
|
||||
if($passes_old>$passes) { $pass_new=$passes;}
|
||||
elsif( $passes_old eq $passes) { $pass_new=0; }
|
||||
else { $pass_new=$passes-$passes_old; }
|
||||
|
||||
if($retry_old>$retry) { $retry_new=$retry;}
|
||||
elsif($retry_old eq $retry) { $retry_new=0;}
|
||||
else { $retry_new=$retry-$retry_old; }
|
||||
|
||||
if($passes_white_old>$passes_white) { $passes_white_new=$passes_white;}
|
||||
elsif($passes_white_old eq $passes_white) { $passes_white_new=0;}
|
||||
else { $passes_white_new=$passes_white-$passes_white_old; }
|
||||
|
||||
print "greylisted.value $grey_new\n";
|
||||
print "retry_early.value $retry_new\n";
|
||||
print "passed.value $pass_new\n";
|
||||
print "passed_w.value $passes_white_new\n";
|
||||
|
||||
exit 0;
|
Loading…
Add table
Add a link
Reference in a new issue