In past, we have seen configuration of Auto Port Aggregation in HPUX
which explains what is APA and what is the purpose of using APA in your setup. In another post we learned how to test APA if working perfectly or not.
In this post, I will be sharing a script which I coded to automate this APA test
Also, make a note that you need to run this script in normal terminal login and not on server console. Since if APA test fails you will lost server connectivity on primary NIC IP address. It is recommended to keep a continuous ping session on to IP address (configured on APA) to make sure that you monitor connectivity during whole APA test. I have also explained use of this continuous ping in manual APA test post.
Script code :
Execute this script on your own risk!
See below APA configuration testing script. Save below code in apa_test.sh file on your server. Execute script with root privileges using sh apa_test.sh or ./apa_test.sh command. Make sure executable permissions are set for the file.
| #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# |
| #Script: apa_check.sh |
| #Author: Shrikant Lavhate |
| #Description: Verify the functionality of APA configuration |
| #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# |
| echo "******* APA Configuration Check *******" |
| echo "Caution !! Do not run this script from console & in production server" |
|
|
| nwmgr -S apa |grep -v "-"|grep -v "="|grep ^lan|awk '{print $1,$8}'>group1 |
| cat group1 |tr " " ,>group |
| flag=1 |
| lanchecking () |
| { |
|
|
| echo "" |
| echo "APA group : $3" |
| echo "IP : $2" |
| echo "Lan PPA : $1" |
| lanadmin -r $1 |
| ping $2 -n 100 >pingx |
| grep "100 packets received" pingx >/dev/null |
| if [ `echo $?` -eq 0 ]; then |
| flag=0 |
| fi |
| sleep 30 |
| } |
|
|
| for i in `cat group` |
| do |
| mygrp=`echo $i|cut -d, -f1` |
| lanx=`echo $i|cut -d, -f2` |
| lany=`echo $i|cut -d, -f3` |
| myip=`netstat -nvr |grep -i 900|grep -i ' U ' | awk '{print $2}'` |
| lanchecking $lanx $myip $mygrp |
| lanchecking $lany $myip $mygrp |
|
|
| if [ $flag -eq 0 ]; then |
| echo "APA is working normally!" |
| else |
| echo "APA failed" |
| fi |
| done |
|
|
| rm pingx group group1 |
Sample output :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
******* APA Configuration Check *******
Caution !! Do not run this script from console
APA group : 900
IP : 10.10.5.2
Lan PPA : 0
APA group : 900
IP : 10.10.5.2
Lan PPA : 1
APA is working normally!
|
0 comments:
Post a Comment