Révision dbcd6af2
Initial version
| plugins/other/systat | ||
|---|---|---|
| 1 |
#!/bin/sh |
|
| 2 |
# System statistics for FreeBSD |
|
| 3 |
# Author: Gergely Czuczy <phoemix@harmless.hu> |
|
| 4 |
# |
|
| 5 |
#%# family=auto |
|
| 6 |
#%# capabilities=autoconf |
|
| 7 |
|
|
| 8 |
sysctl='/sbin/sysctl' |
|
| 9 |
|
|
| 10 |
case $1 in |
|
| 11 |
config) |
|
| 12 |
cat <<EOF |
|
| 13 |
graph_title System Statistics |
|
| 14 |
graph_vlabel per second |
|
| 15 |
graph_scale no |
|
| 16 |
graph_category system |
|
| 17 |
graph_args -l 0 |
|
| 18 |
graph_info FreeBSD systat plugin |
|
| 19 |
softint.label Software interrupts |
|
| 20 |
softint.type DERIVE |
|
| 21 |
softint.min 0 |
|
| 22 |
hardint.label Hardware interrupts |
|
| 23 |
hardint.type DERIVE |
|
| 24 |
hardint.min 0 |
|
| 25 |
syscall.label System calls |
|
| 26 |
syscall.type DERIVE |
|
| 27 |
syscall.min 0 |
|
| 28 |
cs.label Context switches |
|
| 29 |
cs.type DERIVE |
|
| 30 |
cs.min 0 |
|
| 31 |
forks.label Fork rate |
|
| 32 |
forks.type DERIVE |
|
| 33 |
forks.min 0 |
|
| 34 |
EOF |
|
| 35 |
exit 0 |
|
| 36 |
;; |
|
| 37 |
autoconf) |
|
| 38 |
if [ ! -x ${sysctl} ]; then
|
|
| 39 |
echo "no (${sysctl} is not executable)"
|
|
| 40 |
exit 1 |
|
| 41 |
fi |
|
| 42 |
ostype=`uname -s` |
|
| 43 |
if [ ${ostype} = "FreeBSD" ]; then
|
|
| 44 |
echo "yes" |
|
| 45 |
exit 0 |
|
| 46 |
fi |
|
| 47 |
echo "no (You're OS is not supported by this plugin)" |
|
| 48 |
exit 1 |
|
| 49 |
;; |
|
| 50 |
suggest) |
|
| 51 |
exit 0 |
|
| 52 |
;; |
|
| 53 |
esac |
|
| 54 |
|
|
| 55 |
${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 \
|
|
| 56 |
vm.stats.vm.v_forks vm.stats.vm.v_rforks vm.stats.vm.v_vforks| awk ' |
|
| 57 |
BEGIN {forks=0;}
|
|
| 58 |
/^vm.stats.sys.v_soft/{print "softint.value",$2}
|
|
| 59 |
/^vm.stats.sys.v_intr/{print "hardint.value",$2}
|
|
| 60 |
/^vm.stats.sys.v_syscall/{print "syscall.value",$2}
|
|
| 61 |
/^vm.stats.sys.v_swtch/{print "cs.value",$2}
|
|
| 62 |
/^vm.stats.vm.v_[rv]?forks/ {forks+=$2}
|
|
| 63 |
END {print "forks.value",forks;}
|
|
| 64 |
' |
|
Formats disponibles : Unified diff