taus-itcapp1#powermt display dev=all
Pseudo name=emcpower0a
CLARiiON ID=APM00105201788 [Sol_Taus_itcapp1]
Logical device ID=60060160B2202B001094F0E0AF5CE011 [SolDA_Taus_itcapp1_data]
state=alive; policy=CLAROpt; priority=0; queued-IOs=0;
Owner: default=SP A, current=SP A Array failover mode: 1
==============================================================================
--------------- Host --------------- - Stor - -- I/O Path -- -- Stats ---
### HW Path I/O Paths Interf. Mode State Q-IOs Errors
==============================================================================
3072 pci@1d,700000/SUNW,qlc@1/fp@0,0 c3t5006016446E01FEFd0s0 SP A4 active alive 0 0
3072 pci@1d,700000/SUNW,qlc@1/fp@0,0 c3t5006016C46E01FEFd0s0 SP B4 active dead 0 1
3073 pci@1e,600000/SUNW,qlc@3/fp@0,0 c4t5006016546E01FEFd0s0 SP A5 active alive 0 0
3073 pci@1e,600000/SUNW,qlc@3/fp@0,0 c4t5006016D46E01FEFd0s0 SP B5 active dead 0 1
The script is running every 10 mins to detect the ECM dead path ( see above) and sendind an email only when it detect the dead paths
The simple way is
10,20,30,40,50,59 * * * * /ect/powermt display dev=all|awk '{print $7}' |grep -i dead |mail orafup@mymail.com <---work perfect when there is a dead path
and the script
#!/bin/sh
MYMAIL="orafup@mymail.com"
powermt display dev=all|awk '{print $7}' |grep -i dead|mail $MYMAIL
exit
the problem is there is no subject with the "mail" but if i am using the "mailx -s" , it will deliver a blank email even if there is no dead path detection.
I am trying to add an argument into the script but it seems not working
#!/bin/sh
HOSTNAME=`uname -a`
EMCSTATUS=`powermt display dev=all|awk '{print $7}' |grep -i dead
MYMAIL="orafup@mymail.com"
TEMPF=/tmp/prog$$
powermt display dev=all|awk '{print $7}' |grep -i dead |wc -l >$TEMPF
if [ ($TEMPF) -ne 0 ]
then
echo " there is the dead path "
else
:
fi
mailx -s "Please check $HOSTNAME of $EMCSTATUS" $MYMAIL
exit
Please help me out.
Thanks!