openbsd-ports/net/munin/files/pf_states
sthen 0e401c36bc - update/add OpenBSD-specific plugins (interrupt and pf monitoring), from mk@
- redo MESSAGE-main, making it a little more obvious how to get started,
following discussions with stephan@ and jasper@

ok jasper@
(reminder, ports is not fully open, do not commit without specific permission)
2010-02-25 17:07:17 +00:00

51 lines
1.0 KiB
Bash

#!/bin/sh
#
# $OpenBSD: pf_states,v 1.1 2010/02/25 17:07:17 sthen Exp $
#
# (c) 2010 Kim Højgaard-Hansen <kimrhh@gmail.com>
#
# Script to monitor number of pf states from "pfctl -si".
#
# ln -s /usr/local/libexec/munin/plugins/pf_states \
# /etc/munin/plugins/pf_states
#
# ...will monitor number of pf states.
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
# suggest (optional - used by munin-config)
#
# Magic markers (optional):
#%# family=manual
#%# capabilities=autoconf
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 size'
echo 'graph_args --base 1000'
echo 'graph_category pf'
echo 'graph_vlabel entries'
echo 'state.label Entries'
echo 'state.info Number of state table entries'
echo 'state.type GAUGE'
exit 0
fi
pfctl -si | awk '$1=="current" && $2=="entries" { print "state.value " $3 }'