1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-09-19 00:53:19 +00:00

NetBSD support added

This commit is contained in:
Pascal Cabaud 2011-07-15 08:55:00 +02:00 committed by Steve Schnepp
parent fc51c3a69e
commit acb3839b40

View file

@ -32,44 +32,37 @@
#
#%# family=auto
#%# capabilities=autoconf
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH
pfctl='/sbin/pfctl'
pfctl="/sbin/pfctl"
case $1 in
config)
cat <<EOF
graph_title OpenBSD pf statistics
graph_vlabel Entries per second
graph_scale no
graph_category network
graph_args -l 0
graph_info OpenBSD's pf usage statistics
states.label States
states.type GAUGE
EOF
${pfctl} -sm 2> /dev/null | awk '
/states/ {print "states.warning "$4*0.9; print "states.critical "$4*0.95}
'
echo "graph_title OpenBSD pf statistics"
echo "graph_vlabel Entries per second"
echo "graph_scale no"
echo "graph_category network"
echo "graph_args -l 0"
echo "graph_info OpenBSD's pf usage statistics"
echo "states.label States"
echo "states.type GAUGE"
${pfctl} -sm 2> /dev/null | awk '/states/ {print "states.warning "$4*0.9; print "states.critical "$4*0.95}'
if [ "x${do_searches}" = "xyes" ]; then
cat <<EOF
searches.label Searches
searches.min 0
searches.type DERIVE
EOF
echo "searches.label Searches"
echo "searches.min 0"
echo "searches.type DERIVE"
fi
cat <<EOF
matches.label Matches
matches.min 0
matches.type DERIVE
mismatches.label State mismatches
mismatches.min 0
mismatches.type DERIVE
blocks.label Blocked packets
blocks.type DERIVE
blocks.min 0
EOF
pfctl -sl | awk '
{
echo "matches.label Matches"
echo "matches.min 0"
echo "matches.type DERIVE"
echo "mismatches.label State mismatches"
echo "mismatches.min 0"
echo "mismatches.type DERIVE"
echo "blocks.label Blocked packets"
echo "blocks.type DERIVE"
echo "blocks.min 0"
${pfctl} -sl 2>/dev/null | awk '{
l="";
for (i=1; i<NF-2; i=i+1) l=l" "$i;
sub(/^ /, "", l);
@ -78,16 +71,23 @@ pfctl -sl | awk '
print f".label L: "l;
print f".type DERIVE"
print f".min 0"}'
exit 0
;;
autoconf)
# FreeBSD
ostype=`uname -s`
if [ ${ostype} = "FreeBSD" ]; then
# NetBSD
if [ ${ostype} = "NetBSD" ]; then
# enabled?
if [ `pfctl -si 2>/dev/null | awk '/^Status:/{print $2}'` != "Enabled" ]; then
echo "no (pf(4) is not enabled, consult pfctl(8)"
if [ `${pfctl} -si 2>/dev/null | awk '/^Status:/{print $2}'` != "Enabled" ]; then
echo "no (pf(4) is not enabled, consult pfctl(8))"
exit 1
fi
# FreeBSD
elif [ ${ostype} = "FreeBSD" ]; then
# enabled?
if [ `${pfctl} -si 2>/dev/null | awk '/^Status:/{print $2}'` != "Enabled" ]; then
echo "no (pf(4) is not enabled, consult pfctl(8))"
exit 1
fi
# OpenBSD
@ -98,8 +98,8 @@ pfctl -sl | awk '
exit 1
fi
# enabled?
if [ `pfctl -si 2>/dev/null | awk '/^Status:/{print $2}'` != "Enabled" ]; then
echo "no (pf(4) is not enabled, consult pfctl(8)"
if [ `${pfctl} -si 2>/dev/null | awk '/^Status:/{print $2}'` != "Enabled" ]; then
echo "no (pf(4) is not enabled, consult pfctl(8))"
exit 1
fi
# Other OSes
@ -110,9 +110,11 @@ pfctl -sl | awk '
echo "yes"
exit 0
;;
suggest)
exit 0;
;;
esac
#
@ -124,7 +126,7 @@ $1~/^match$/{print "matches.value",$2}
${pfctl} -vsr 2> /dev/null| grep -A 1 ^block | awk 'BEGIN {sum=0}/^[ \t]*\[/{sum=sum+$5} END {print "blocks.value",sum}'
# the labeled ones
pfctl -sl | awk '
${pfctl} -sl 2>/dev/null | awk '
BEGIN {
total=0
}