ports/net/munin/files/pf_changes

49 lines
924 B
Text
Raw Normal View History

2023-08-16 22:26:55 +00:00
#!/bin/sh
#
# 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; }
';