#!/bin/sh
backup_timestamp= ' Date +%y%m%d '
Hostname= ' HOSTNAME '
num=89
################### Verification File system opt################
Memuseopt= '/bin/df-kp| grep/opt | Awk-f ' {print $} ' | Awk-f '% ' {print '} '
If [$MemUseOpt-gt$num]
Then
Echo${backup_timestamp},${hostname},/opt,${memuseopt}, exceeding threshold >>xunjian.csv
Else
Echo${backup_timestamp},${hostname},/opt,${memuseopt}, normal >>xunjian.csv
Fi
################### Verification File system var################
Memusevar= '/bin/df-kp| Grep/var | Awk-f ' {print $} ' | Awk-f '% ' {print '} '
If [$MemUseVar-gt$num]
Then
Echo${backup_timestamp},${hostname},/var,${memusevar}, exceeding threshold >>xunjian.csv
Else
Echo${backup_timestamp},${hostname},/var,${memusevar}, normal >>xunjian.csv
Fi
################### Verification File system tmp################
Memusetmp= '/bin/df-kp| grep/tmp | Awk-f ' {print $} ' | Awk-f '% ' {print '} '
If [$MemUseTmp-gt$num]
Then
Echo${backup_timestamp},${hostname},/tmp,${memusetmp}, exceeding threshold >>xunjian.csv
Else
ECHO${BACKUP_TIMESTAMP},${HOSTNAME},/TMP,${MEMUSETMP}, normal >>xunjian.csv
Fi
################### Verification ismweb process ################
Checkmonitor= ' Ps-efw|grep java | Awk-f '/' nr==1 {print $} '
monitorsh= ' usr '
if [$CheckMonitor = = $MonitorSH]
Then
Echo${backup_timestamp},${hostname},ism Web status , OK, normal >>xunjian.csv
Else
Echo${backup_timestamp},${hostname},ism Web status , need to restart >>xunjian.csv
Fi
################### Verifying ICMP process ################
checkicmp= ' ps-efw|grepicmp | Awk-f '/' nr==1 {print $7} '
Icmpsh= ' nco_m_icmp '
if [$CheckICMP = = $ICMPSH]
Then
echo${backup_timestamp},${hostname},icmp status , OK, normal >>xunjian.csv
Else
echo${backup_timestamp},${hostname},icmp status , need to restart >>xunjian.csv
Fi
################### Verifying the SNMP process ################
checksnmp= ' Ps-efw|grepsnmp | Awk-f '/' nr==1 {print $7} '
Snmpsh= ' Nco_m_snmp '
if [$CheckSNMP = = $SNMPSH]
Then
Echo${backup_timestamp},${hostname},snmp status , OK, normal >>xunjian.csv
Else
Echo${backup_timestamp},${hostname},snmp status , need to restart >>xunjian.csv
Fi
################### Verifying BRIDGE process ################
Checkbridge= ' Ps-efw|grep Bridge | Awk-f '/' nr==1 {print $7} '
Bridgesh= ' Nco_m_bridge '
if [$CheckBridge = = $BridgeSH]
Then
Echo${backup_timestamp},${hostname},bridge status , OK, normal >>xunjian.csv
Else
Echo${backup_timestamp},${hostname},bridge status , need to restart >>xunjian.csv
Fi
################### Number of audit events ################
Alertcount= '/opt/netcool/maintenance/select.sh| Awk-f ' nr==3 {print '} '
alertsum=10000
If [$AlertCount-gt$alertsum]
Then
Echo${backup_timestamp},${hostname}, number of events , ${alertcount}, number of super threshold >>xunjian.csv
Else
Echo${backup_timestamp},${hostname}, number of events , ${alertcount}, normal >>xunjian.csv
Fi
################### Check ncolog update Time ################
Checklog= ' Ls-l/var/log/ncolog | Awk-f ' {print $6 "" $7 "" $8} "
Echo${backup_timestamp},${hostname},ncolog Update Time , ${checklog}>>xunjian.csv
################### Check the network management system time ################
Sysdate= ' date|awk-f ' {print $4} '
Echo${backup_timestamp},${hostname}, system time , ${sysdate}>>xunjian.csv
Network Management System II
#!/bin/sh
backup_timestamp= ' date+%y%m%d '
Hostname= ' HOSTNAME '
num=89
################### Verification File system opt################
Memuseopt= '/bin/df-kp| grep/opt | Awk-f ' {print $} ' | Awk-f '% ' {print '} '
If [$MemUseOpt-gt$num]
Then
Echo${backup_timestamp},${hostname},/opt,${memuseopt}, exceeding threshold >>xunjian.csv
Else
Echo${backup_timestamp},${hostname},/opt,${memuseopt}, normal >>xunjian.csv
Fi
################### Verification File system var################
Memusevar= '/bin/df-kp| Grep/var | Awk-f ' {print $} ' | Awk-f '% ' {print '} '
If [$MemUseVar-gt$num]
Then
Echo${backup_timestamp},${hostname},/var,${memusevar}, exceeding threshold >>xunjian.csv
Else
Echo${backup_timestamp},${hostname},/var,${memusevar}, normal >>xunjian.csv
Fi
################### Verification File system tmp################
Memusetmp= '/bin/df-kp| grep/tmp | Awk-f ' {print $} ' | Awk-f '% ' {print '} '
If [$MemUseTmp-gt$num]
Then
Echo${backup_timestamp},${hostname},/tmp,${memusetmp}, exceeding threshold >>xunjian.csv
Else
ECHO${BACKUP_TIMESTAMP},${HOSTNAME},/TMP,${MEMUSETMP}, normal >>xunjian.csv
Fi
################### Verification File system dbchk################
memusedbchk= '/BIN/DF-KP | Grep/dbchk | Awk-f ' {print $} ' | Awk-f '% ' ' {print$1} '
If [$MemUseDbchk-gt$num]
Then
Echo${backup_timestamp},${hostname},/dbchk,${memusedbchk}, exceeding threshold >>xunjian.csv
Else
ECHO${BACKUP_TIMESTAMP},${HOSTNAME},/DBCHK,${MEMUSEDBCHK}, normal >>xunjian.csv
Fi
################### Verification File system informix################
memuseinformix= '/BIN/DF-KP | Grep/informix | Awk-f ' {print $} ' | Awk-f '% ' ' {print$1} '
If [$MemUseInformix-gt $num]
Then
Echo${backup_timestamp},${hostname},/informix,${memuseinformix}, exceeding threshold >>xunjian.csv
Else
Echo${backup_timestamp},${hostname},/informix,${memuseinformix}, normal >>xunjian.csv
Fi
################### Verification nmcc process ################
Checknmcc= ' ps-efw|grepnmcc1.0.sh|awk-f ' nr==2 {print $9} '
Nmccsh= ' nmcc1.0.sh '
if [$CheckNMCC = = $nmccSH]
Then
ECHO${BACKUP_TIMESTAMP},${HOSTNAME},NMCC status , OK, normal >>xunjian.csv
Else
ECHO${BACKUP_TIMESTAMP},${HOSTNAME},NMCC status , need to restart >>xunjian.csv
Fi
################### Verifying the webtop process ################
checkwebtop= ' Ps-efw|grep webtop|awk-f '/' nr==1 {print $11} '
Webtopsh= ' Webtop '
if [$CheckWebtop = = $webtopSH]
Then
Echo${backup_timestamp},${hostname},webtop status , OK, normal >>xunjian.csv
Else
Echo${backup_timestamp},${hostname},webtop status , need to restart >>xunjian.csv
Fi
################### Check the network management system time ################
Sysdate= ' date|awk-f ' {print $4} '
Echo${backup_timestamp},${hostname}, system time , ${sysdate}>>xunjian.csv
Linux system patrol Script shell instance