2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/system/zones_mem

62 lines
1.7 KiB
Plaintext
Raw Normal View History

2008-05-05 09:29:29 +02:00
#!/bin/sh
2012-12-25 03:28:38 +01:00
# This plugin shows Solaris zone memory usage.
2008-05-05 09:29:29 +02:00
#%# family=auto
#%# capabilities=autoconf
PRSTAT=/usr/bin/prstat
PRSTAT_OPTS="-Z -n 1,99 1 1"
2008-05-05 09:29:29 +02:00
if [ "$1" = 'autoconf' ]; then
if [ -f $PRSTAT ]; then
2012-12-25 03:29:12 +01:00
zones=`/usr/sbin/zoneadm list | wc -l`
if [ $zones -gt 1 ]; then
echo yes
else
echo yes
fi
2008-05-05 09:29:29 +02:00
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = 'config' ]; then
echo 'graph_title zone memory usage'
echo 'graph_args --upper-limit 100'
2012-12-25 03:29:12 +01:00
echo 'graph_category system'
stack=AREA
2008-05-05 09:29:29 +02:00
$PRSTAT $PRSTAT_OPTS | sed '1,/^ZONEID/d' | grep -v '^Total' | while read i; do
2012-12-25 03:29:12 +01:00
oIFS="$IFS"
IFS='
2008-05-05 09:29:29 +02:00
'
2012-12-25 03:29:12 +01:00
set -$- $i
name=$1
label=$8
2008-05-05 09:29:29 +02:00
printf "$name.label $label\n$name.draw $stack\n$name.warn 95\n"
2012-12-25 03:29:12 +01:00
IFS="$oIFS"
stack=STACK
2008-05-05 09:29:29 +02:00
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
2012-12-25 03:29:12 +01:00
oIFS="$IFS"
IFS='%
2008-05-05 09:29:29 +02:00
'
2012-12-25 03:29:12 +01:00
set -$- $i
name=$1
value=$5
printf "$name.value $value\n"
IFS="$oIFS"
2008-05-05 09:29:29 +02:00
done