Script to grep ce settings via ndd

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

#Set a tmpfile
TMPFILE=cegrep.txt

echo "Running cegrep script........"

# Got root?
# o_|/ shrink!
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 "cegrep 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 ce stuff

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

# check available modules
echo "available modules" >>$TMPFILE 2>&1
ndd -get /dev/ce \? >>$TMPFILE 2>&1

echo "module settings" >>$TMPFILE 2>&1

echo "ndd -get /dev/ce enable_ipg0" >>$TMPFILE 2>&1
ndd -get /dev/ce enable_ipg0 >>$TMPFILE 2>&1

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

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

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

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

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

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

echo "ndd -get /dev/ce adv_1000fdx_cap" >>$TMPFILE 2>&1
ndd -get /dev/ce adv_1000fdx_cap >>$TMPFILE 2>&1

echo "ndd -get /dev/ce adv_1000hdx_cap" >>$TMPFILE 2>&1
ndd -get /dev/ce adv_1000hdx_cap >>$TMPFILE 2>&1

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

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

echo "ndd -get /dev/ce adv_10fdx_cap" >>$TMPFILE 2>&1
ndd -get /dev/ce adv_10fdx_cap >>$TMPFILE 2>&1

echo "ndd -get /dev/ce adv_10hdx_cap" >>$TMPFILE 2>&1
ndd -get /dev/ce adv_10hdx_cap >>$TMPFILE 2>&1

echo "ndd -get /dev/ce adv_asmpause_cap" >>$TMPFILE 2>&1
ndd -get /dev/ce adv_asmpause_cap >>$TMPFILE 2>&1

echo "ndd -get /dev/ce adv_pause_cap" >>$TMPFILE 2>&1
ndd -get /dev/ce adv_pause_cap >>$TMPFILE 2>&1

echo "ndd -get /dev/ce master_cfg_enable" >>$TMPFILE 2>&1
ndd -get /dev/ce master_cfg_enable >>$TMPFILE 2>&1

echo "ndd -get /dev/ce master_cfg_value" >>$TMPFILE 2>&1
ndd -get /dev/ce master_cfg_value >>$TMPFILE 2>&1

echo "ndd -get /dev/ce rx_intr_pkts" >>$TMPFILE 2>&1
ndd -get /dev/ce rx_intr_pkts >>$TMPFILE 2>&1

echo "ndd -get /dev/ce rx_intr_time" >>$TMPFILE 2>&1
ndd -get /dev/ce rx_intr_time >>$TMPFILE 2>&1

echo "ndd -get /dev/ce red_dv4to6k" >>$TMPFILE 2>&1
ndd -get /dev/ce red_dv4to6k >>$TMPFILE 2>&1

echo "ndd -get /dev/ce red_dv6to8k" >>$TMPFILE 2>&1
ndd -get /dev/ce red_dv6to8k >>$TMPFILE 2>&1

echo "ndd -get /dev/ce red_dv8to10k" >>$TMPFILE 2>&1
ndd -get /dev/ce red_dv8to10k >>$TMPFILE 2>&1

echo "ndd -get /dev/ce red_dv10to12k" >>$TMPFILE 2>&1
ndd -get /dev/ce red_dv10to12k >>$TMPFILE 2>&1

echo "ndd -get /dev/ce tx_dma_weight" >>$TMPFILE 2>&1
ndd -get /dev/ce tx_dma_weight >>$TMPFILE 2>&1

echo "ndd -get /dev/ce infinite_burst" >>$TMPFILE 2>&1
ndd -get /dev/ce infinite_burst >>$TMPFILE 2>&1

echo "ndd -get /dev/ce disable_64bit" >>$TMPFILE 2>&1
ndd -get /dev/ce disable_64bit >>$TMPFILE 2>&1


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

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

echo Check current directory for cegrep.txt file!

0 comments

Post a Comment

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