Repository
Munin (master)
Last change
2018-05-21
Graph Categories
Family
auto
Capabilities
Keywords
Language
Shell

systat

Sadly there is no documentation for this plugin

#!/bin/sh
# System statistics for FreeBSD
#
# Copyright: Gergely Czuczy <phoemix@harmless.hu>
#
# Define the environment variable "logarithmic" in plugins.conf to
# make graphs with logarithmic scale. Default is linear scale.
#
#%# family=auto
#%# capabilities=autoconf

sysctl='/sbin/sysctl'

if [ "$logarithmic" ]; then
    graph_args="--logarithmic --units=si"
else
    graph_args="--lower-limit 0"
fi

case $1 in
    config)
	cat <<EOF
graph_title System Statistics
graph_vlabel per second
graph_scale no
graph_category system
graph_args $graph_args
graph_info FreeBSD systat plugin
softint.label Software interrupts
softint.type DERIVE
softint.min 0
hardint.label Hardware interrupts
hardint.type DERIVE
hardint.min 0
syscall.label System calls
syscall.type DERIVE
syscall.min 0
cs.label Context switches
cs.type DERIVE
cs.min 0
forks.label Fork rate
forks.type DERIVE
forks.min 0
EOF
	exit 0
	;;
    autoconf)
	if [ ! -x ${sysctl} ]; then
	    echo "no (${sysctl} is not executable)"
	    exit 0
	fi
	ostype=`uname -s`
	if [ ${ostype} = "FreeBSD" ]; then
	    echo "yes"
	    exit 0
	fi
	echo "no (Your OS is not supported by this plugin)"
	exit 0
	;;
    suggest)
	exit 0
	;;
esac

${sysctl} vm.stats.sys.v_soft vm.stats.sys.v_intr vm.stats.sys.v_syscall vm.stats.sys.v_trap vm.stats.sys.v_swtch \
    vm.stats.vm.v_forks vm.stats.vm.v_rforks vm.stats.vm.v_vforks | awk '
BEGIN {forks=0;}
/^vm.stats.sys.v_soft/{print "softint.value",$2}
/^vm.stats.sys.v_intr/{print "hardint.value",$2}
/^vm.stats.sys.v_syscall/{print "syscall.value",$2}
/^vm.stats.sys.v_swtch/{print "cs.value",$2}
/^vm.stats.vm.v_[rv]?forks/ {forks+=$2}
END {print "forks.value",forks;}
'