Chinaunix首页 | 论坛 | 博客
  • 博客访问: 143168
  • 博文数量: 30
  • 博客积分: 30
  • 博客等级: 民兵
  • 技术积分: 310
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-31 15:35
文章分类

全部博文(30)

文章存档

2020年(1)

2019年(10)

2016年(19)

我的朋友

分类: 服务器与存储

2016-10-02 16:11:38

1.需要先运行vspop.sh脚本获取存储端配置信息。
vspop.sh -t getinfoforopcm -s 0
2.需要先运行主机端配置信息获取脚本,获取主机端信息后才能运行func_st_hostinfo,进行信息整合
--------------------------------------
#!/bin/ksh
#ScriptName :  hdscfginfo.sh
#Author     :  wangtao039
#VERSION    :  V1.0 20160930
#VERSION    :  V1.1 20161003
#Description:  source info is come from raidcom .


DATEINFO=`date +%y%m%d`
ST_DG_LDEV_HOST=/vspcfgstore/history/stinfoforopcm/st_dg_ldev_host_$DATEINFO.opi
ST_DG_LV_MP_HOST=/vspcfgstore/history/stinfoforopcm/st_dg_lv_mp_host_$DATEINFO.opi
ST_HG_STPORT_HOSTPORT=/vspcfgstore/history/stinfoforopcm/st_hg_stport_hostport_$DATEINFO.opi
ST_HG_STPORT_LDEV=/vspcfgstore/history/stinfoforopcm/st_hg_stport_ldev_$DATEINFO.opi
ST_LV_DETAIL=/vspcfgstore/history/stinfoforopcm/st_lv_detail_$DATEINFO.opi
ST_POOL_PLDEV=/vspcfgstore/history/stinfoforopcm/st_pool_pldev_$DATEINFO.opi
ST_POOL_VLDEV=/vspcfgstore/history/stinfoforopcm/st_pool_vldev_$DATEINFO.opi
ST_RG_PLDEV=/vspcfgstore/history/stinfoforopcm/st_rg_pldev_$DATEINFO.opi
ST_STORAGE_PORT=/vspcfgstore/history/stinfoforopcm/st_storage_port_$DATEINFO.opi
ST_ST_RG=/vspcfgstore/history/stinfoforopcm/st_st_rg_$DATEINFO.opi
STSNLIST=/tmp/stsnlistfile
STRESULTFILE=/vspcfgstore/history/hdscfginfo/hdscfginfo.$DATEINFO;touch $STRESULTFILE
HOSTRESULTFILE=/vspcfgstore/history/hdscfginfo/host_hdscfginfo.$DATEINFO;touch $HOSTRESULTFILE


func_stcfginfo()
{
cat $ST_STORAGE_PORT|grep -v _G..._|awk -F, '{print $1,$2}'|sort -u>$STSNLIST
cat $STSNLIST|while read name
do
  STNAME=`echo $name|awk '{print $1}'`
  STSN=`echo $name|awk '{print $2}'`
  cat $ST_POOL_VLDEV|grep $STNAME|while read line
  do
    LDEVNAME=`echo $line|awk -F, '{print $2}'`
    LDEVSIZE=`echo $line|awk -F, '{print $4}'`
    LDEVPOOL=`echo $line|awk -F, '{print $5}'`
    cat $ST_HG_STPORT_LDEV|grep -i $STNAME|grep -i ",$LDEVNAME,"|awk -F, '{print $2","$4}'|while read info
    do
      PORTNAME=`echo $info|awk -F, '{print $1}'`
      HGNAME=`echo $info|awk -F, '{print $2}'`
      HOSTLIST=`cat $ST_HG_STPORT_HOSTPORT|grep -i $STNAME|grep -i $PORTNAME|grep ",$HGNAME,"|awk -F, '{print $6}'|sed 's/_...[0-9]$//g'|sort -u|xargs|sed 's/ /;/g'`
      RGNAME="NA"
      RGTYPE="NA"
      echo $STNAME,$STSN,$LDEVNAME,$PORTNAME,$HOSTLIST,$HGNAME,$LDEVSIZE,$RGNAME,$RGTYPE,$LDEVPOOL
    done
  done >/tmp/hdscfginfo.$STNAME &
  echo "."|awk '{printf"%s",$1}'
done


wait
sort -u -m -o $STRESULTFILE `ls /tmp/hdscfginfo*`
rm /tmp/hdscfginfo*
}


func_st_hostinfo()
{
rm /tmp/xa* >/dev/null 2>&1
cd /tmp/
split -3000 $STRESULTFILE
>$HOSTRESULTFILE
ls /tmp/xa*|while read name
do
  cat $name|while read line
  do
    STSN=`echo $line|awk -F, '{print $2}'`
    LDEVNAME=`echo $line|awk -F, '{print $3}'`
    DGNAME=`cat $ST_DG_LDEV_HOST|grep -i ",$STSN,"|grep -i ",$LDEVNAME,"|awk -F, '{print $1}'|sort -u|xargs|sed 's/ /;/g'|sed 's/-;//g'`
    if [ $DGNAME"x" = "x" ]
    then
      ESXVALUE=`echo $line|grep -i cns.06|wc -l`
      SVCVALUE=`echo $line|grep -i _svc_|wc -l`
      FASVALUE=`echo $line|grep -i _fas|wc -l`
      if [ $ESXVALUE -eq 1 ]
      then
        DGNAME=ESXUSED
      elif [ $FASVALUE -eq 1 ]
      then
        DGNAME=FASUSED
      elif [ $SVCVALUE -eq 1 ]
      then
        DGNAME=SVCUSED
      else
        DGNAME=needcheck
      fi
    elif [ $DGNAME = "-" ]
    then
    DGNAME=invalid
    fi
    echo $DGNAME,$line >>$HOSTRESULTFILE
    echo "."|awk '{printf"%s",$1}'
  done &
done
wait
rm /tmp/xa* >/dev/null 2>&1
}


############ main ####################
func_stcfginfo
func_st_hostinfo


阅读(3474) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~