Shell script to check the SAN dual path.

Hello,
I would like to create a shell script which would check whether the hosts have SAN dual path or not. If yes, then I should get a success message, else should get a list of hosts on which SAN dual path is not working.

Thanks..

Where is the problem? Things you should do:

  • Get to know the command to display the number/status of your SAN paths. If you have no clue, maybe tell the people here what OS you are using together with which pathing software you use.
  • Using this command, there would be some kind of output which could be parsed by grep or awk etc., maybe with some if/then/fi logic etc., but that depends on the output what might be better suited or not.

If you have a particular problem, do not hesitate to ask but don't expect the people to write a script for you especially not without this scarce info.

Well, I myself would'nt like someone doing my homework and it was my mistake that I did not entered the requested details in my request.
Sorry for not mentioning the type of os on which this script needs to run. I am probably looking for SAN dual path information on Linux, AIX and Solaris hosts.

I have made a script for Linux and would like to know whether it looks good or not

====================================================

#! /bin/ksh
for i in `cat /var/scripts/SAN/hostns_list`
do
echo === $i ===
ssh $i /opt/MLsan/inq
done

=====================================================

Similarly for SUN and AIX, the script is as follows:

#!/bin/ksh
/usr/sbin/fcinfo hba-port | egrep 'State|lpfc'
/sbin/multipath -ll
/usr/sbin/lsdev -Cc adapter | grep fcs
for i in `vxdisk -o alldgs list | sed 1d | awk '{print $1}'`
do
echo "$i - `vxdisk list $i | grep numpaths`"
done

=====================================================

These scripts needs to be integrated in my buildcheck so that the scripts can run on any hosts we desire and get the result.

So logically you will have to check what type of OS you are on, maybe use uname -a which should work on most types. According to this, issue the command you want to use. You could do that in case / esac block for example.

Hello,
We have a script which when run on the host gives us the status of the internal and SAN attached disks. The output of which is as follows:

Nm DEVICE VEND PROD LunID SYM DevID DISKGROUP SIZE N E
----------------------------------------------------------------------------------------

  1. cciss/c0d0 HP LOGICAL VOLUME N/A N/A N/A 68.33 1 1
  2. sdb EMC SYMMETRIX 27 7300 251 app_DG 50.58 2 2
    ----------------------------------------------------------------------------------------
    N =Number of Paths (NE =Not Enabled)
    E =Number of Currently Enabled Paths

================================================== =======

The requirement now is to create another script which will check the SAN path status from the above script. If the no of Paths shows less than 1 for SAN disks, then I should get an alert that SAN path failed or if all the path is ok, then SAN path is ok.

Thanking in anticipation.

Regards,
Mahive.