Script to grep hme settings via ndd

Monday, August 30, 2010 at 10:04 PM
#! /bin/ksh
# hmegrep version 0.0.1 - grep hme settings via ndd.
# o_|/ hme
# June 17 2003 Sam Nelson
# As usual, not clever or efficient, but quick, dirty and effective.
# tested on Solaris 8 and 9.

#Set a tmpfile

echo "Running hmegrep script........"

# Got root?
if [ $ID != "root" ]; then
echo "$ID, you must be root to run this script."
exit 1

# Get uname (useful!)
echo "hmegrep report for host:" >$TMPFILE
/usr/bin/uname -a >>$TMPFILE 2>&1

# Get some basic stuff:
echo "netstat -s -P tcp" >>$TMPFILE 2>&1
netstat -s -P tcp >>$TMPFILE 2>&1
echo "netstat -s -P udp" >>$TMPFILE 2>&1
netstat -s -P udp >>$TMPFILE 2>&1

###get hme stuff

echo "hme settings..." >>$TMPFILE 2>&1

echo "ndd -get /dev/hme transceiver_inuse" >>$TMPFILE 2>&1
ndd -get /dev/hme transceiver_inuse >>$TMPFILE 2>&1

echo "ndd -get /dev/hme link_status" >>$TMPFILE 2>&1
ndd -get /dev/hme link_status >>$TMPFILE 2>&1

echo "ndd -get /dev/hme link_speed" >>$TMPFILE 2>&1
ndd -get /dev/hme link_speed >>$TMPFILE 2>&1

echo "ndd -get /dev/hme link_mode" >>$TMPFILE 2>&1
ndd -get /dev/hme link_mode >>$TMPFILE 2>&1

echo "ndd -get /dev/hme ipg1" >>$TMPFILE 2>&1
ndd -get /dev/hme ipg1 >>$TMPFILE 2>&1

echo "ndd -get /dev/hme ipg2" >>$TMPFILE 2>&1
ndd -get /dev/hme ipg2 >>$TMPFILE 2>&1

echo "ndd -get /dev/hme use_int_xcvr" >>$TMPFILE 2>&1
ndd -get /dev/hme use_int_xcvr >>$TMPFILE 2>&1

echo "ndd -get /dev/hme pace_size" >>$TMPFILE 2>&1
ndd -get /dev/hme pace_size >>$TMPFILE 2>&1

echo "ndd -get /dev/hme adv_autoneg_cap" >>$TMPFILE 2>&1
ndd -get /dev/hme adv_autoneg_cap >>$TMPFILE 2>&1

echo "ndd -get /dev/hme adv_100T4_cap" >>$TMPFILE 2>&1
ndd -get /dev/hme adv_100T4_cap >>$TMPFILE 2>&1

echo "ndd -get /dev/hme adv_100fdx_cap" >>$TMPFILE 2>&1
ndd -get /dev/hme adv_100fdx_cap >>$TMPFILE 2>&1

echo "ndd -get /dev/hme adv_100hdx_cap" >>$TMPFILE 2>&1
ndd -get /dev/hme adv_100hdx_cap >>$TMPFILE 2>&1

echo "ndd -get /dev/hme 10fdx_cap" >>$TMPFILE 2>&1
ndd -get /dev/hme 10fdx_cap >>$TMPFILE 2>&1

echo "ndd -get /dev/hme 10hdx_cap" >>$TMPFILE 2>&1
ndd -get /dev/hme 10hdx_cap >>$TMPFILE 2>&1

echo "ndd -get /dev/hme lp_autoneg_cap" >>$TMPFILE 2>&1
ndd -get /dev/hme lp_autoneg_cap >>$TMPFILE 2>&1

echo "ndd -get /dev/hme lp_100T4_cap" >>$TMPFILE 2>&1
ndd -get /dev/hme lp_100T4_cap >>$TMPFILE 2>&1

echo "ndd -get /dev/hme lp_100fdx_cap" >>$TMPFILE 2>&1
ndd -get /dev/hme lp_100fdx_cap >>$TMPFILE 2>&1

echo "ndd -get /dev/hme lp_100hdx_cap" >>$TMPFILE 2>&1
ndd -get /dev/hme lp_100hdx_cap >>$TMPFILE 2>&1

echo "ndd -get /dev/hme lp_10fdx_cap" >>$TMPFILE 2>&1
ndd -get /dev/hme lp_10fdx_cap >>$TMPFILE 2>&1

echo "ndd -get /dev/hme lp_10hdx_cap" >>$TMPFILE 2>&1
ndd -get /dev/hme lp_10hdx_cap >>$TMPFILE 2>&1

echo "ndd -get /dev/hme instance" >>$TMPFILE 2>&1
ndd -get /dev/hme instance >>$TMPFILE 2>&1

echo "ndd -get /dev/hme lance_mode" >>$TMPFILE 2>&1
ndd -get /dev/hme lance_mode >>$TMPFILE 2>&1

echo "ndd -get /dev/hme ipg0" >>$TMPFILE 2>&1
ndd -get /dev/hme ipg0 >>$TMPFILE 2>&1

# hot kstat action:
echo "kstat hme output" >>$TMPFILE 2>&1
kstat hme >>$TMPFILE 2>&1

echo "OK script finished" >>$TMPFILE 2>&1

echo Check current directory for hmegrep.txt file!


Post a Comment

Solaris | Powered by Blogger | Entries (RSS) | Comments (RSS) | Designed by MB Web Design | XML Coded By