#!/bin/sh

G_REMOTE_TMP_FILE="/tmp/tmpfile"
LOG_FILE="/var/log/inspect.log"

function LOG 
{
   time=$(date)
   echo [${time}][$$]$@ >> $LOG_FILE
}


filename="DsMap"
cat /proc/monc_dsmap  > $G_REMOTE_TMP_FILE$filename 2>&1
iRet=$?
if [ $iRet -ne 0 ];then
   LOG "Get monc_dsmap ret[$iRet]"
fi 

#жǷudsƷ
ProductType=$(cat "/opt/huawei/snas/etc/snas.ini"|grep productType|awk -F= '{print $2}')
if [ "80" = "$productType" ];then
    LOG "the node is uds"
    exit 0
fi	
#ȡڵ洢
node_service_type=$(egrep '[[]|^'node_service_type'=' /opt/huawei/snas/etc/snas.ini | tr -d '\n' | grep -Po '(?<=[[]'NODE'[]]'node_service_type'=)[0-9]+')

if [ "${node_service_type}" != "1" ];then
	LOG "node_service_type :${node_service_type}."
	exit 0
fi

filename="MdsMap"
cat /proc/monc_mdsmap  > $G_REMOTE_TMP_FILE$filename 2>&1
iRet=$?
if [ $iRet -ne 0 ];then
   LOG "Get monc_mdsmap ret[$iRet]"
fi      


filename="CaMap"
cat /proc/monc_camap  > $G_REMOTE_TMP_FILE$filename 2>&1
iRet=$?
if [ $iRet -ne 0 ];then
   LOG "Get monc_camap ret[$iRet]"
fi 

filename="PipMap"
cat /proc/monc_pipmap  > $G_REMOTE_TMP_FILE$filename 2>&1
iRet=$?
if [ $iRet -ne 0 ];then
   LOG "Get monc_pipmap ret[$iRet]"
fi 

filename="Monc_MonMap"
/usr/local/bin/MmlBatch 988 "monc monmap 0"  > $G_REMOTE_TMP_FILE$filename 2>&1
iRet=$?
if [ $iRet -ne 0 ];then
   LOG "Get monc_monmap ret[$iRet]"
fi