Repository
Munin (master)
Last change
2018-08-17
Graph Categories
Family
contrib
Capabilities
Language
Shell
License
GPL-2.0-only

ipac-ng

Name

ipac-ng - Skeleton-plugin to monitor ipac-ng rules.

Configuration

No configuration

Usage

To monitor a rule, copy ipac-ng and edit variables.

Author

Unknown author

License

GPLv2

Magic Markers

#%# family=contrib
#%# capabilities=autoconf
#!/bin/sh

: << =cut

=head1 NAME

ipac-ng - Skeleton-plugin to monitor ipac-ng rules.

=head1 CONFIGURATION

No configuration

=head1 USAGE

To monitor a rule, copy ipac-ng and edit variables.

=head1 AUTHOR

Unknown author

=head1 LICENSE

GPLv2

=head1 MAGIC MARKERS

 #%# family=contrib
 #%# capabilities=autoconf

=cut

# Visible name of graph
TITLE="traffic"
# perlre(1) expressions passed to ipacsum -f. For more info
# `man ipacsum`, `man perlre`.
UP="upload rule"
DOWN="download rule"

if [ "$1" = "autoconf" ]; then
        if [ -x /usr/sbin/fetchipac ] && [ -x /usr/sbin/ipacsum ]; then
                echo yes
                exit 0
        else
                echo "no (can not exectute /usr/sbin/fetchipac or /usr/sbin/ipacsum)"
                exit 0
        fi
fi

if [ "$1" = "config" ]; then
        echo "graph_order down up"
        echo "graph_title $TITLE"
        echo 'graph_args --base 1000'
        echo 'graph_vlabel b/s in (-) / out (+)'
        echo 'graph_category fw'
        echo 'down.label received'
        echo 'down.graph no'
        # Divide it by 1500 seconds (5m), to get b/s
        echo 'down.cdef down,1500,/'
        echo 'up.label b/s'
        echo 'up.negative down'
        echo 'up.cdef up,1500,/'
        exit 0
fi;

if fetchipac; then
        ipacsum -s 5m -x -f "$UP" | tail -n 1 | cut -d : -f 2 | awk \
                '{print "up.value " $1}'
        ipacsum -s 5m -x -f "$DOWN" | tail -n 1 | cut -d : -f 2 | awk \
                '{print "down.value " $1}'
else
        echo 'up.value U'
        echo 'down.value U'
fi