Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

More on cluster monitoring



Folks,

Here's a script that might be useful for monitoring OS X clusters:

#!/bin/zsh
echo $HOST
ncpu=$(/usr/sbin/sysctl -n hw.ncpu)
vec=$(/usr/sbin/sysctl -n hw.vectorunit)
speed=$(/usr/sbin/sysctl -n hw.cpufrequency)
echo "CPUs: " $ncpu "    Vector Unit: "$vec "    Clock Speed: " $speed "Hz"
uptime | sed 's/^[ ]*//'
top -l2 1 | awk '{if (FNR==12) print "CPU Usage - user:" $(NF-5) " system:"
$(NF-3) " idle:" $(NF-1)}'
top -l1 0.1 | awk '{if (FNR==5) print "Memory: " $(NF-3) " " $(NF-2) " "
$(NF-1) " " $(NF)}'

(the last two lines wrap around)

On a cluster node, this will spit out something like:

xserve29
CPUs:  2     Vector Unit: 1     Clock Speed:  999999997 Hz
4:56PM  up 6 days,  7:02, 1 user, load averages: 0.01, 0.01, 0.00
CPU Usage - user:0.0% system:1.9% idle:98.1%
Memory: 187M used, 1.32G free

(for vector unit, 1=yes 0=no)

Assuming the script is called something like "nodestat" and is in the bin in
my home space (accessible from all nodes), I'm calling it from the master
node like this:

#!/bin/zsh
for node in xserve{26..32}; do
    echo ""
    rsh $node bin/nodestat
done

Of course, you can tweak this a zillion ways.  If I had a really large
cluster, I might have a single line of output per node.

I was able to wrap a GUI around this script using AppleScript Studio.  You
can see what it looks like here:

    http://members.cox.net/craig.hunter/clstat.jpg

This can also be tweaked a zillion different ways depending on your cluster
setup, and could even be generalized for arbitrary clusters if you had the
right interface design.  I may see if I can come up with something for one
of our larger Linux clusters (50+ nodes), but right now it looks like a real
interface challenge!  May be better to stick to the command line for large
clusters.  I guess the main point is that it's relatively easy to make this
into a nice package.

I'd be glad to give out the source and project files if anyone would find it
useful.

Craig

-- 
Dr. Craig Hunter
NASA Langley Research Center
AAAC/Configuration Aerodynamics Branch
email@hidden
(757) 864-3020
(Dual G4 - OS X)
_______________________________________________
scitech mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/scitech
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.