kirby 3f043c7ae9 fix pf_changes plugin autoconfigure
patch from Dimitri Sokolyuk, thanks!
2014-11-08 20:08:20 +00:00

51 lines
987 B
Bash

#!/bin/sh
#
# $OpenBSD: pf_changes,v 1.2 2014/11/08 20:08:20 kirby Exp $
#
# Script to monitor OpenBSD pf statistics
#
# (c) 2010 Michael Knudsen <mk@openbsd.org>
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
# suggest (optional - used by munin-config)
#
if [ "$1" = "autoconf" ]; then
if [ "$(uname -s)" = "OpenBSD" ]; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "suggest" ]; then
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title pf state table changes'
echo 'graph_args --base 1000'
echo 'graph_category pf'
echo 'graph_vlabel State table changes'
echo 'ins.label Insertions'
echo 'ins.info State table entry insertions'
echo 'ins.type DERIVE'
echo 'ins.min 0'
echo 'rem.label Removals'
echo 'rem.info State table entry removals'
echo 'rem.type DERIVE'
echo 'ins.min 0'
exit 0
fi
pfctl -si | awk '
$1 == "inserts" { print "ins.value " $2; }
$1 == "removals" { print "rem.value " $2; }
';