
#!/bin/sh
# File	: emc-rpt-de-carbon-kpi-s.sh
# By	: guy.mechelmans@atos.net, 201002
# Subject	: Script to collect storage (pool)information from EMC-(VMAX)systems
#
# System-names should be placed in /home/scripting/reportingshare/templates/Storage_EMC/sid.list
#
workpath="/home/scripting/jenkins_scripts/VMAX"
outputfile="$workpath/emc-rpt-de-carbon-kpi-s_$(hostname)_$(date +'%Y-%m-%d-%H-%M-%S')_disk_pool_vmax.csv"

echo "array ; tech ; pool_name ; owner ; pool_usable ; pool_used ; pool_physical" > $outputfile

for i in $(cat /home/scripting/reportingshare/templates/Storage_EMC/sid.list)
do
  symcfg -sid $i list -pool -gb | grep " T[EFSM]F" | while read pname ptype praid pusable pfree pused pfull pratio
  do
    tech=hdd
    if [ ${ptype:1:1} = "E" ]; then tech=ssd;fi
    if [[ "$tech" = "ssd" ]]; then
      physical_used=$(($pusable * 8 / 7))
    else
      physical_used=$(($pusable * 8 / 6))
    fi
    pu=$(echo "$physical_used" | xargs printf "%.*f\n" 0)
    echo "'"$i";"$tech";"$pname";belgium_guymechelmans;"$pusable";"$pused";"$pu >>$outputfile
  done
done

mailx  -s "emc-de-carbon-kpi-s: from $(hostname)" -r emcadmins.be@atos.net -a $outputfile emcadmins.be@atos.net nl19471@nlxnetapp01.bcklan.ao-srv.com  < /dev/null

exit 0

