ipso_monitor.sh
The following script is an exceedingly useful one for monitoring and troubleshooting a Nokia IPSO Appliance.
You will need to create a new script using a text editor such as “vi”, and then copy, paste, and save the script. So type:
vi ipso_monitor.sh
The script is as follows:
#!/bin/sh
INTERVAL=$1
if [ $1 ]; then
echo "Monitoring interval of $2 seconds"
else
echo "Monitoring interval not set; defaulting to 60 seconds"
INTERVAL=60
fi
OUTFILE=/var/admin/MonitorNokia.out
# If you wish to specify the output file uncomment the next 7 lines
#and set OUTFILE=$2
#if [ $2 ]; then
# echo "Output file specified as $2"
# touch $OUTFILE
#else
# echo "Output file not specified, using standard output"
# OUTFILE=/dev/tty
#fi
# Set IF_DETAILS to 1 if you want detailed information about the Interfaces
# You will also need to uncomment and set IF1 and IF2 to appropriate
# values for your configuration. If you want to monitor more than two
# interfaces, you will have to make some additional modifications
# to the script.
IF_DETAILS=0
# IF1=eth-s1p2
# IF2=eth-s1p3
# Check to see if this is a flows-enabled version of IPSO
ipsctl -n net:ip:forward:available_modes | grep -q -s flowpath
if [ $? -eq 0 ]; then
FLOWS=1
else
FLOWS=0
fi
while [ 1 ]; do
echo "===============================" >> $OUTFILE
date >> $OUTFILE
echo "===============================" >> $OUTFILE
echo >> $OUTFILE
echo -n "# uptime: " >> $OUTFILE
echo `uptime` >> $OUTFILE
echo >> $OUTFILE
echo -n "Connection table size: " >> $OUTFILE
echo `fw tab -s -t connections | tail -n 1 | awk '{ print $4 }'` >> $OUTFILE
ipsctl -n net:ip:forward:available_modes | grep -q -s flowpath
if [ $FLOWS -eq 1 ]; then
echo -n "Flows active: " >> $OUTFILE
echo $((`netstat -nF | wc -l`-2)) >> $OUTFILE
echo "Flow stats:" >> $OUTFILE
echo "-----------" >> $OUTFILE
ipsctl -a net:ip:flow >> $OUTFILE
echo "-----------" >> $OUTFILE
fi
echo "# fw ctl pstat" >> $OUTFILE
echo >> $OUTFILE
fw ctl pstat >> $OUTFILE
echo >> $OUTFILE
echo >> $OUTFILE
echo "# ps auxw" >> $OUTFILE
echo >> $OUTFILE
ps auxmw >> $OUTFILE
echo >> $OUTFILE
echo >> $OUTFILE
echo "# vmstat -c 5" >> $OUTFILE
echo >> $OUTFILE
vmstat -c 5 >> $OUTFILE
echo >> $OUTFILE
echo >> $OUTFILE
echo "# netstat -m" >> $OUTFILE
echo >> $OUTFILE
netstat -m >> $OUTFILE
echo >> $OUTFILE
echo >> $OUTFILE
echo "# vmstat -i" >> $OUTFILE
echo >> $OUTFILE
vmstat -i >> $OUTFILE
echo >> $OUTFILE
echo >> $OUTFILE
if [ $IF_DETAILS -eq 1 ]; then
echo "# ipsctl -a (lots of options)" >> $OUTFILE
echo >> $OUTFILE
ipsctl -a ifphys:$IF1:errors ifphys:$IF1:stats ifphys:$IF1:dev \
ifphys:$IF2:errors ifphys:$IF2:stats ifphys:$IF2:dev \
net:ip:rxstats net:ip:txstat net:ip:misc:stats \
net:ip:frag:stats >> $OUTFILE
echo >> $OUTFILE
echo >> $OUTFILE
fi
sleep $INTERVAL
done
Once saved, use chmod 777 ipso_monitor.sh to mark the file as executable script, and then you should be able to invoke with ./ipso_monitor.sh
Find me on: