All pastes #568030 Raw Edit

munin plugin for greylistd

public shellscript v1 · immutable
·published 2007-06-15 07:18 UTC
rendered paste body
#!/bin/sh## Plugin to monitor the greylisting-items on a system.## Usage: Link as $basename_{white|black|grey} into /etc/munin/node.d/## $Log$# Revision 0.1 2007/06/13 12:50# Initial# 0.2 splitting items and combos cause tyre too big# 0.3 colorz & filled graphs# 0.4 naming-fixes, typos# 0.5 merging both files again (see 0.1)# 0.6 bugfixing# 0.7 fixed graph-rendering# If run with the "autoconf"-parameter, give our opinion on wether we# should be run on this system or not. This is optinal, and only used by# munin-config. In the case of this plugin, we should most probably# always be included.myname=`basename $0 | sed 's/^greylistd_//g'`name="${name-$myname}"if [ "$1" = "autoconf" ]; then    echo yes    exit 0fi# If run with the "config"-parameter, give out information on how the# graphs should look.if [ "$1" = "config" ]; then    # The host name this plugin is for. (Can be overridden to have    # one machine answer for several)    # The title of the graph    echo 'graph_title '$name'listed combos/mails'    ### Arguments to "rrdtool graph". In this case, tell it that the    ### lower limit of the graph is '0', and that 1k=1000 (not 1024)    ##echo 'graph_args --base 1000 -l 0'    # The Y-axis label    echo 'graph_vlabel combos / mails'    # We want Cur/Min/Avg/Max unscaled (wont happen either)    echo 'graph_scale no'    # Graph category. Defaults to 'other'.    echo 'graph_category mail'    # The fields. "label" is used in the legend. "label" is the only    # required subfield.    echo $name'listed_combos.label '$name'listed combos'    echo $name'listed_mails.label '$name'listed mails'    # Setting fixed colors to recognise affiliation    ## chnage color depending on $name    if [ $name = 'white' ]; then        echo $name'listed_combos.colour 009900'        echo $name'listed_mails.colour 00ff00'        echo $name'listed_mails.colour 00ff00'    elif [ $name = 'black' ]; then        echo $name'listed_combos.colour 990000'        echo $name'listed_mails.colour ff0000'    elif [ $name = 'grey' ]; then        echo $name'listed_combos.colour 000099'        echo $name'listed_mails.colour 0000ff'    fi    # Setting the graphs to be filled    echo $name'listed_combos.draw AREA'    echo $name'listed_mails.draw STACK'    # These two are optional. They are only used if you have    # configured your munin to tell a Nagios-server about any    # problems    ## not needed, useless ;)    #echo 'load.warning 0'    #echo 'load.critical 120'    # This one is purely to add an explanation to the web page. The first    # one is for the graph itself, while the second one is for the field    # "load".    echo 'graph_info '$name'listed combos / '$name'listed mails touched by greylistd.'    echo $name'listed_combos.info Ammount of '$name'listed combos (IP / MAILTO / MAILFROM)'    echo $name'listed_mails.info Ammount of '$name'listed mails'    # Last, if run with the "config"-parameter, quit here (don't    # display any data)    exit 0fi# If not run with any parameters at all (or only unknown ones), do the# real work - i.e. display the data. Almost always this will be# "value" subfield for every data field.greylist stats | awk '/^ *[0-9].*'$name'/{print "'$name'listed_combos.value "$1"\n'$name'listed_mails.value "$4}'