2008-05-05 09:27:46 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
#%# family=auto
|
|
|
|
#%# capabilities=autoconf
|
|
|
|
|
|
|
|
PRSTAT=/usr/bin/prstat
|
2012-09-05 00:00:03 +02:00
|
|
|
PRSTAT_OPTS="-Z -n 1,99 1 1"
|
2008-05-05 09:27:46 +02:00
|
|
|
|
|
|
|
if [ "$1" = 'autoconf' ]; then
|
|
|
|
if [ -f $PRSTAT ]; then
|
|
|
|
zones=`/usr/sbin/zoneadm list | wc -l`
|
|
|
|
if [ $zones -gt 1 ]; then
|
|
|
|
echo yes
|
|
|
|
else
|
2018-09-16 04:09:21 +02:00
|
|
|
echo no
|
2008-05-05 09:27:46 +02:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo no
|
|
|
|
fi
|
2018-09-16 04:09:21 +02:00
|
|
|
exit 0
|
2008-05-05 09:27:46 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = 'config' ]; then
|
|
|
|
echo 'graph_title zone cpu usage'
|
|
|
|
echo 'graph_args --upper-limit 100'
|
|
|
|
echo 'graph_category system'
|
|
|
|
stack=AREA
|
|
|
|
$PRSTAT $PRSTAT_OPTS | sed '1,/^ZONEID/d' | grep -v '^Total' | while read i; do
|
|
|
|
oIFS="$IFS"
|
|
|
|
IFS='
|
|
|
|
'
|
|
|
|
set -$- $i
|
|
|
|
name=$1
|
|
|
|
label=$8
|
|
|
|
printf "$name.label $label\n$name.draw $stack\n$name.warn 95\n"
|
|
|
|
IFS="$oIFS"
|
|
|
|
stack=STACK
|
|
|
|
done
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# ZONEID NPROC SWAP RSS MEMORY TIME CPU ZONE $
|
|
|
|
# 0 48 470M 482M 1.5% 4:05:57 0.0% global $
|
|
|
|
# 3 85 2295M 2369M 7.2% 0:36:36 0.0% pearljam $
|
|
|
|
# 6 74 13G 3273M 10% 16:51:18 0.0% ministry $
|
|
|
|
# Total: 207 processes, 709 lwps, load averages: 0.05, 0.06, 0.11$
|
|
|
|
|
|
|
|
$PRSTAT $PRSTAT_OPTS | sed '1,/^ZONEID/d' | grep -v '^Total' | while read i; do
|
|
|
|
oIFS="$IFS"
|
|
|
|
IFS='%
|
|
|
|
'
|
|
|
|
set -$- $i
|
|
|
|
name=$1
|
|
|
|
value=$7
|
|
|
|
printf "$name.value $value\n"
|
|
|
|
IFS="$oIFS"
|
|
|
|
done
|