#! /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
TMPFILE=hmegrep.txt
echo "Running hmegrep script........"
# Got root?
#
Check_ID()
{
ID=$(/usr/ucb/whoami)
if [ $ID != "root" ]; then
echo "$ID, you must be root to run this script."
exit 1
fi
}
Check_ID
# 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!
Script to grep hme settings via ndd
Monday, August 30, 2010
at
10:04 PM
| Posted by
Elumalai M
Posted In Shell Scripting | |
Subscribe to:
Post Comments (Atom)
0 comments