Hi Jeff.
Thank you very much for sharing it with us. That's a very slick tool and
I was looking for something like this for quite some time now.
You just made our lives a lot easier.
We found 2 issues you should be aware of:
1. As this guy pointed out on your blog
(http://blogs.sun.com/JeffV/entry/zonestat_1_4_now_available#comments)
on sparc machine we were getting the same error:
# ./zonestat_1.4.pl.orig
Illegal division by zero at ./zonestat_1.4.pl.orig line 580, line 1.
Broken Pipe
It worked fine on x86 machine btw.
2. On a system with a large zone count we could only see 20 at the time.
In your script your 'zone ID' counter didn't take into consideration
multiple digits like these:
# /usr/sbin/zoneadm list -v
..
2128 ti5-dev running/data/ti5-dev native
shared
..
The reason for such high zoneid is because that value is dynamic and
whenever you reboot a zone it gets a higher number.
This is a dev. machine and the zones on it do get rebooted a lot -;)
Also, I'd recommend using 'zoneadm list' command with a '-p'
(parse-able) switch instead.
My colleague Jason Harley was kind enough to produce a working patch
that I'm attaching to this message.
Something worth considering for a 1.5 release -;)
Best regards,
Andrei Tokarev< and...@oanda.com>
Systems Administrator
OANDA Corporation
www.oanda.com
"It's a good thing I'm Russian. We're used to hopeless situations."
-- Susan Ivanova, Babylon 5
On 4/8/09 11:17 AM, Jeff Victor wrote:
I posted Zonestat v1.4 at the Zone Statistics project page
http://opensolaris.org/os/project/zonestat (click on "Files" in the
left navbar).
My blog http://blogs.sun.com/jeffv lists the new features and bug fixes.
Please send questions and requests to zones-discuss@opensolaris.org .
--JeffV
___
zones-discuss mailing list
zones-discuss@opensolaris.org
--- zonestat_1.4.pl.orig2009-04-28 16:04:57.063090776 -0400
+++ zonestat_1.4.pl 2009-04-28 17:11:56.096857451 -0400
@@ -381,14 +381,13 @@
#
# Gather list of zones, their status and pool type and association.
-if ($DEBUG) { print "/usr/sbin/zoneadm list -v\n"; }
-open (NAMES, "/usr/sbin/zoneadm list -v|");
+if ($DEBUG) { print "/usr/sbin/zoneadm list -p\n"; }
+open (NAMES, "/usr/sbin/zoneadm list -p|");
$znum=0;
while () {
- if (/^\s+(\S+)\s+(\S+)/) {
-if ($1 eq "ID") { next; }
-$znames[$znum++]=$2;
-$zoneid{$2}=$1;
+ if (split(':')) {
+$znames[$znum+...@_[1];
+$zone...@_[1]}=@_[0];
if ($opt_N) {
$zlen = length ($znames[$znum-1]);
$Nmaxznamelen = $zlen > $Nmaxznamelen ? $zlen : $Nmaxznamelen;
@@ -577,10 +576,20 @@
open (D, "$script |");
while () {
if (/CPU-System:\s+(\S+)\s+(\d+)/) { # System time
-$cpu_system{$1} = $2 * $total_cpus / $pset_cfg_cur{$pool{$1}};
+if ($pset_cfg_cur{$pool{$1}} > 0) {
+ $cpu_system{$1} = $2 * $total_cpus / $pset_cfg_cur{$pool{$1}};
+}
+else {
+ $cpu_system{$1} = 'NaN';
+}
}
if (/CPU-User:\s+(\S+)\s+(\d+)/) { # User time
-$cpu_user{$1} = $2 * $total_cpus / $pset_cfg_cur{$pool{$1}};
+if ($pset_cfg_cur{$pool{$1}} > 0) {
+ $cpu_user{$1} = $2 * $total_cpus / $pset_cfg_cur{$pool{$1}};
+}
+else {
+ $cpu_user{$1} = 'NaN';
+}
}
}
close D;
___
zones-discuss mailing list
zones-discuss@opensolaris.org