File: systat.in

package info (click to toggle)
munin 2.0.76-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,068 kB
  • sloc: perl: 11,684; java: 1,924; sh: 1,632; makefile: 636; javascript: 365; python: 267
file content (73 lines) | stat: -rw-r--r-- 1,664 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!@@GOODSH@@
# System statistics for FreeBSD
# Author: 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;}
'