Use below Command to find out number of Machines connected to Server.
#netstat -nat | awk '{ print }' | cut -d: -f1 | sed -e '/^$/d' | uniq
Search This Blog
Wednesday, May 25, 2011
Tuesday, May 24, 2011
How to find VM guests having Network issue.
This has helped me for finding machines having network issues.
Such machines can then be tracked and further analyzed to find the root cause behind the network issue.
First You will need to login to your VM server.
Issue following command.
watch -n 1 -d netstat -i
Now observe Parameters in Bold.
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
If you find any of above (In bold only ) parameter value to be non 0 and continuously increasing Then this might be an indication of network problem in your vm guest.
Below is typical example of vm machine having network problem.
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
vif22.0 1500 0 0 0 0 0 0 0 39072827 0 BMRU
vif122.0 1500 0 0 0 0 0 0 0 37392429 0 BMRU
vif276.0 1500 0 0 0 0 0 0 0 22717649 0 BMRU
As you can observe Packet are getting dropped while transmitting. So all you need to do is
find the associated vm guests to that virtual interface.
This can be done using following command.
ps -ef | grep tap122.0 (Notice here vif is replaced with tap).
output will contain the name of vm guest having network issue.
You may use following script to find the vm guests.
#!/bin/bash
FIND=`netstat -i | grep vif* | awk '{ if ($10 > 100) print $1":"$10}'`
if [ -z "$FIND" ]
then
echo "No Packet drop (More than 100)"
exit
fi
for I in $FIND
do
Search=`echo $I |awk -F ":" '{print $1}' |awk -F "vif" '{print "tap"$2}'`
if [ -z "$FIND" ]
then
echo "No Interface Found"
exit
fi
ps -ef | grep $Search | grep -v grep | awk '{print $12}'
done
Such machines can then be tracked and further analyzed to find the root cause behind the network issue.
First You will need to login to your VM server.
Issue following command.
watch -n 1 -d netstat -i
Now observe Parameters in Bold.
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
If you find any of above (In bold only ) parameter value to be non 0 and continuously increasing Then this might be an indication of network problem in your vm guest.
Below is typical example of vm machine having network problem.
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
vif22.0 1500 0 0 0 0 0 0 0 39072827 0 BMRU
vif122.0 1500 0 0 0 0 0 0 0 37392429 0 BMRU
vif276.0 1500 0 0 0 0 0 0 0 22717649 0 BMRU
As you can observe Packet are getting dropped while transmitting. So all you need to do is
find the associated vm guests to that virtual interface.
This can be done using following command.
ps -ef | grep tap122.0 (Notice here vif is replaced with tap).
output will contain the name of vm guest having network issue.
You may use following script to find the vm guests.
#!/bin/bash
FIND=`netstat -i | grep vif* | awk '{ if ($10 > 100) print $1":"$10}'`
if [ -z "$FIND" ]
then
echo "No Packet drop (More than 100)"
exit
fi
for I in $FIND
do
Search=`echo $I |awk -F ":" '{print $1}' |awk -F "vif" '{print "tap"$2}'`
if [ -z "$FIND" ]
then
echo "No Interface Found"
exit
fi
ps -ef | grep $Search | grep -v grep | awk '{print $12}'
done
Monday, May 23, 2011
Calling one linux scipt from another.
This might not be the general practice being followed by script writer .
Most of the time it is recommended to write a function inside a script and call it whenever necessary.
Create script.sh and test.sh in /usr/local/sbin
Parent Script.
# cat script.sh
# script.sh file
[[ -f /usr/local/sbin/test.sh ]] && . /usr/local/sbin/test.sh
Var=123
echo "Calling Function"
echo "Value of Var is $Var"
my_test
echo "Returning the control"
Child Script.
# cat test.sh
my_test()
{
echo "Just testing here:)"
echo "Value of Var is $Var"
}
Now execute the parent script.
./script.sh
# ./script.sh
Calling Function
Value of Var is 123
Just testing here:)
Value of Var is 123
Returning the control
Most of the time it is recommended to write a function inside a script and call it whenever necessary.
Create script.sh and test.sh in /usr/local/sbin
Parent Script.
# cat script.sh
# script.sh file
[[ -f /usr/local/sbin/test.sh ]] && . /usr/local/sbin/test.sh
Var=123
echo "Calling Function"
echo "Value of Var is $Var"
my_test
echo "Returning the control"
Child Script.
# cat test.sh
my_test()
{
echo "Just testing here:)"
echo "Value of Var is $Var"
}
Now execute the parent script.
./script.sh
# ./script.sh
Calling Function
Value of Var is 123
Just testing here:)
Value of Var is 123
Returning the control
All about ssh
A good article over ssh and its configuration file can be found here.
http://www.thegeekstuff.com/2011/05/openssh-options/comment-page-1/#comment-104670
http://www.thegeekstuff.com/2011/05/openssh-options/comment-page-1/#comment-104670
Monday, May 9, 2011
How to find VNC port for Guest machines running on Oracle VM.
Use below script for finding VNC port of all Guest Machines running on the Oracle VM server.
xm list > temp
y=`xm list | wc -l`
z=`expr $y - 2`
while [ $y -gt 1 ]
do
x=`awk -F" " '{print $1}' temp | sed -n "${y}p"`
echo -e '\E[32m'
y=`expr $y - 1`
xm list $x -l |grep 0.0:|awk -v Host=$x -F[:\)] '{print "Vnc Port for " Host " :" $2 }'
echo -e '\E[37m'
done
xm list > temp
y=`xm list | wc -l`
z=`expr $y - 2`
while [ $y -gt 1 ]
do
x=`awk -F" " '{print $1}' temp | sed -n "${y}p"`
echo -e '\E[32m'
y=`expr $y - 1`
xm list $x -l |grep 0.0:|awk -v Host=$x -F[:\)] '{print "Vnc Port for " Host " :" $2 }'
echo -e '\E[37m'
done
Sunday, May 8, 2011
Disk Monitoring Using IOZONE.
iozone is a filesystem benchmarking tool.
iozone help us identify disk performance. I would recommend it to test SAN,NAS or Local Harddisk performance.
Step 1:
Download the utility from its official source.
http://www.iozone.org/
iozone help us identify disk performance. I would recommend it to test SAN,NAS or Local Harddisk performance.
Step 1:
Download the utility from its official source.
http://www.iozone.org/
Labels:
Hard Disk Monitoring,
iozone,
Performance Monitoring
Saturday, May 7, 2011
Tweaking bashrc file.
A good article on tweaking bashrc file can be read here.
http://www.novell.com/coolsolutions/tools/17142.html
http://www.novell.com/coolsolutions/tools/17142.html
Please Leave us with your comments and Queries/Suggestions.
I will try to reply asap.
Subscribe to:
Posts (Atom)