[ SEA-GHOST MINI SHELL]
#! /bin/bash
NODES=''
DISK=`ls -lpat /dev/disk/by-path/`
COUNT=0
while read line;
do
node=`echo $line | awk '{ print $2 }'`
target=`echo $line | awk '{ print $1 }' | awk -F':' '{print $1}'`
if [[ $DISK != *$node* ]]; then
NODES+="$target: "
NODES+=`echo $node | awk -F'-' '{print $3"-"$4"; "}'`
((COUNT+=1))
fi
done < <(iscsiadm -m node)
#Return status
if [ -n "$NODES" ]; then
echo "WARNING: $COUNT iSCSI nodes not in use: $NODES"
else
echo "OK: All iSCSI nodes are in use"
fi
SEA-GHOST - SHELL CODING BY SEA-GHOST