#!/bin/sh
BACKUP_TIMESTAMP=`date +%Y%m%d`
HOSTNAME=`hostname`
num=89
###################核查文件系统opt################
MemUseOpt=`/bin/df -kP
| grep /opt | awk -F ‘ ‘ ‘{print $5}‘ | awk -F ‘%‘ ‘ {print $1}‘ `
if [ $MemUseOpt -gt
$num ]
then
echo
${BACKUP_TIMESTAMP},${HOSTNAME},/opt,${MemUseOpt},超过阀值>>xunjian.csv
else
echo
${BACKUP_TIMESTAMP},${HOSTNAME},/opt,${MemUseOpt},正常>>xunjian.csv
fi
###################核查文件系统var################
MemUseVar=`/bin/df -kP
| grep /var | awk -F ‘ ‘ ‘{print $5}‘ | awk -F ‘%‘ ‘ {print $1}‘ `
if [ $MemUseVar -gt
$num ]
then
echo
${BACKUP_TIMESTAMP},${HOSTNAME},/var,${MemUseVar},超过阀值>>xunjian.csv
else
echo
${BACKUP_TIMESTAMP},${HOSTNAME},/var,${MemUseVar},正常>>xunjian.csv
fi
###################核查文件系统tmp################
MemUseTmp=`/bin/df -kP
| grep /tmp | awk -F ‘ ‘ ‘{print $5}‘ | awk -F ‘%‘ ‘ {print $1}‘ `
if [ $MemUseTmp -gt
$num ]
then
echo
${BACKUP_TIMESTAMP},${HOSTNAME},/tmp,${MemUseTmp},超过阀值>>xunjian.csv
else
echo
${BACKUP_TIMESTAMP},${HOSTNAME},/tmp,${MemUseTmp},正常>>xunjian.csv
fi
###################核查ism
web进程################
CheckMonitor=`ps
-efw|grep java | awk -F ‘/‘ ‘NR==1 {print $2}‘`
MonitorSH=‘usr‘
if [ $CheckMonitor ==
$MonitorSH ]
then
echo
${BACKUP_TIMESTAMP},${HOSTNAME},ism web状态,OK,正常>>xunjian.csv
else
echo
${BACKUP_TIMESTAMP},${HOSTNAME},ism web状态,
,需要重启>>xunjian.csv
fi
###################核查ICMP进程################
CheckICMP=`ps -efw|grep
icmp | awk -F ‘/‘ ‘NR==1 {print $7}‘`
ICMPSH=‘nco_m_icmp‘
if [ $CheckICMP ==
$ICMPSH ]
then
echo
${BACKUP_TIMESTAMP},${HOSTNAME},ICMP状态,OK,正常>>xunjian.csv
else
echo
${BACKUP_TIMESTAMP},${HOSTNAME},ICMP状态,
,需要重启>>xunjian.csv
fi
###################核查SNMP进程################
CheckSNMP=`ps -efw|grep
snmp | awk -F ‘/‘ ‘NR==1 {print $7}‘`
SNMPSH=‘nco_m_snmp‘
if [ $CheckSNMP ==
$SNMPSH ]
then
echo
${BACKUP_TIMESTAMP},${HOSTNAME},SNMP状态,OK,正常>>xunjian.csv
else
echo
${BACKUP_TIMESTAMP},${HOSTNAME},SNMP状态,
,需要重启>>xunjian.csv
fi
###################核查BRIDGE进程################
CheckBridge=`ps
-efw|grep bridge | awk -F ‘/‘ ‘NR==1 {print $7}‘`
BridgeSH=‘nco_m_bridge‘
if [ $CheckBridge ==
$BridgeSH ]
then
echo
${BACKUP_TIMESTAMP},${HOSTNAME},BRIDGE状态,OK,正常>>xunjian.csv
else
echo
${BACKUP_TIMESTAMP},${HOSTNAME},BRIDGE状态,
,需要重启>>xunjian.csv
fi
###################核查事件数量################
AlertCount=`/opt/netcool/maintenance/select.sh
| awk -F ‘ ‘ ‘NR==3 {print $1}‘`
AlertSum=10000
if [ $AlertCount -gt
$AlertSum ]
then
echo
${BACKUP_TIMESTAMP},${HOSTNAME},事件数量,${AlertCount},数量超阀值>>xunjian.csv
else
echo
${BACKUP_TIMESTAMP},${HOSTNAME},事件数量,${AlertCount},正常>>xunjian.csv
fi
###################核查ncolog更新时间################
CheckLog=`ls -l
/var/log/ncolog | awk -F ‘ ‘ ‘{print $6" "$7" "$8}‘`
echo
${BACKUP_TIMESTAMP},${HOSTNAME},ncolog更新时间,${CheckLog}
>>xunjian.csv
###################核查网管系统时间################
SysDate=`date|awk -F ‘
‘ ‘{print $4}‘`
echo
${BACKUP_TIMESTAMP},${HOSTNAME},系统时间,${SysDate}
>>xunjian.csv
网管系统二
#!/bin/sh
BACKUP_TIMESTAMP=`date
+%Y%m%d`
HOSTNAME=`hostname`
num=89
###################核查文件系统opt################
MemUseOpt=`/bin/df -kP
| grep /opt | awk -F ‘ ‘ ‘{print $5}‘ | awk -F ‘%‘ ‘ {print $1}‘ `
if [ $MemUseOpt -gt
$num ]
then
echo
${BACKUP_TIMESTAMP},${HOSTNAME},/opt,${MemUseOpt},超过阀值>>xunjian.csv
else
echo
${BACKUP_TIMESTAMP},${HOSTNAME},/opt,${MemUseOpt},正常>>xunjian.csv
fi
###################核查文件系统var################
MemUseVar=`/bin/df -kP
| grep /var | awk -F ‘ ‘ ‘{print $5}‘ | awk -F ‘%‘ ‘ {print $1}‘ `
if [ $MemUseVar -gt
$num ]
then
echo
${BACKUP_TIMESTAMP},${HOSTNAME},/var,${MemUseVar},超过阀值>>xunjian.csv
else
echo
${BACKUP_TIMESTAMP},${HOSTNAME},/var,${MemUseVar},正常>>xunjian.csv
fi
###################核查文件系统tmp################
MemUseTmp=`/bin/df -kP
| grep /tmp | awk -F ‘ ‘ ‘{print $5}‘ | awk -F ‘%‘ ‘ {print $1}‘ `
if [ $MemUseTmp -gt
$num ]
then
echo
${BACKUP_TIMESTAMP},${HOSTNAME},/tmp,${MemUseTmp},超过阀值>>xunjian.csv
else
echo
${BACKUP_TIMESTAMP},${HOSTNAME},/tmp,${MemUseTmp},正常>>xunjian.csv
fi
###################核查文件系统dbchk################
MemUseDbchk=`/bin/df
-kP | grep /dbchk | awk -F ‘ ‘ ‘{print $5}‘ | awk -F ‘%‘ ‘ {print
$1}‘ `
if [ $MemUseDbchk -gt
$num ]
then
echo
${BACKUP_TIMESTAMP},${HOSTNAME},/dbchk,${MemUseDbchk},超过阀值>>xunjian.csv
else
echo
${BACKUP_TIMESTAMP},${HOSTNAME},/dbchk,${MemUseDbchk},正常>>xunjian.csv
fi
###################核查文件系统informix################
MemUseInformix=`/bin/df
-kP | grep /informix | awk -F ‘ ‘ ‘{print $5}‘ | awk -F ‘%‘ ‘ {print
$1}‘ `
if [ $MemUseInformix
-gt $num ]
then
echo
${BACKUP_TIMESTAMP},${HOSTNAME},/informix,${MemUseInformix},超过阀值>>xunjian.csv
else
echo
${BACKUP_TIMESTAMP},${HOSTNAME},/informix,${MemUseInformix},正常>>xunjian.csv
fi
###################核查NMCC进程################
CheckNMCC=`ps -efw|grep
nmcc1.0.sh|awk -F ‘ ‘ ‘NR==2 {print $9}‘`
nmccSH=‘nmcc1.0.sh‘
if [ $CheckNMCC ==
$nmccSH ]
then
echo
${BACKUP_TIMESTAMP},${HOSTNAME},NMCC状态,OK,正常>>xunjian.csv
else
echo
${BACKUP_TIMESTAMP},${HOSTNAME},NMCC状态,
,需要重启>>xunjian.csv
fi
###################核查webtop进程################
CheckWebtop=`ps
-efw|grep webtop|awk -F ‘/‘ ‘NR==1 {print $11}‘`
webtopSH=‘webtop‘
if [ $CheckWebtop ==
$webtopSH ]
then
echo
${BACKUP_TIMESTAMP},${HOSTNAME},webtop状态,OK,正常>>xunjian.csv
else
echo
${BACKUP_TIMESTAMP},${HOSTNAME},webtop状态,
,需要重启>>xunjian.csv
fi
###################核查网管系统时间################
SysDate=`date|awk -F ‘
‘ ‘{print $4}‘`
echo
${BACKUP_TIMESTAMP},${HOSTNAME},系统时间,${SysDate}
>>xunjian.csv