#!/bin/sh
#
# Plugin to show the RBL blocks per hour
#
# Contributed by Rob Lensen <rob@bsdfreaks.nl>
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
maillogs=/usr/local/bin/maillogs
if [ ! -f $maillogs ]; then
maillogs=/usr/local/sbin/maillogs
fi
if [ "$1" = "config" ]; then
echo 'graph_title RBL Spam Blocks'
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel blocks/hour'
echo 'graph_category Mail'
echo 'graph_info This graph show the RBL blocks per rbl.'
$maillogs rbl | awk "
BEGIN {
X = 0
}
{
X = split(\$1,RBL,\":\")
for ( i = 1 ; i <= X ; i++)
{
print RBL[i]\".label \"RBL[i]
print RBL[i]\".type COUNTER\"
print RBL[i]\".cdef \" RBL[i]\",3600,\* \"
i++
}
}"
exit 0
fi
print_values(){
X=0
$maillogs rbl | awk "
BEGIN {
X = 0
}
{
X = split(\$1,RBL,\":\")
for ( i = 1 ; i <= X ; i++)
{
print RBL[i]\".value \"RBL[i+1]
i++
}
}"
}
print_values