轉:AIX 系統巡檢指令碼_超好用,不用一條條輸入命令了
#!/usr/bin/ksh
syserrdate=`date +"%m/%d"`
errcount=0
STATUS=
HOSTS=`hostname`
SCRIPT=`basename $0`
REPORT="/tmp/report.txt"
#FS percent
FILESYSTEM_CHECK() {
FS=`df -k|sed '1d'|awk 'sub("%","",$4) {if ($4 > 80) print $7}'|xargs`
for i in $FS
do
echo "The $i filesystem percent more than %80 \n"
done
}
#Active VG
VG_CHECK() {
echo "****************************ACTIVE VG****************************\n"
ACVG=`lsvg -o|xargs`
echo "Active VG is: $ACVG\n"
#LV_CHECK
echo "***************************PROBLEM LV****************************\n"
BLV=`lsvg -l rootvg|grep -E "jfs|jfs2|raw"|grep -v 'N/A'|awk '{if ($6~/closed/ || $6~/stale/) print $1}'|xargs`
for i in $BLV
do
echo "The $i filesystem has a problem!!!\n"
done
}
#Problem disk
DISK_CHECK() {
echo "***************************Problem disk***************************\n"
disk=`lsvg -o|lsvg -ip|awk '$1~/hdisk/ && $2!~/active/ {print $1}'|xargs`
if [ "$disk" != "" ]
then
for i in $disk
do
echo "The $disk in $i has a problem!!!\n"
done
fi
}
#error report
ERROR_CHECK() {
echo "***************************error report***************************\n"
errdate=`errpt |grep -v IDENTIFIER |awk '{print $2}' |cut -c 1-4 |xargs`
for syserrFor1 in $errdate
do
if [ "$syserrFor1" = "$syserrdate" ]
then
newerrcount=`expr $errcount + 1`
errcount=$newerrcount
fi
done
if [ "$errcount" -eq 0 ]
then
echo "Today error is add $errcount yesterday\n"
else
echo "Today errors is add $errcount than yesterday\n"
fi
#error detail
errors=`errpt -dH -TPERM`
if [ -z "$errors" ]
then
echo "The Hardware is ${STATUS:-NORMAL}.\n"
else
echo "The permanent error of Hardware as fllow:\n`errpt -dH -TPERM`"
fi
}
#Check Database
DB_CHECK() {
su - oracle -c "lsnrctl status"|grep -i "no listener"
if [ $? = 1 ]
then
echo "The listener status is ${STATUS:-NORMAL}\n"
else
echo "The listener has a problem!!!\n"
fi
#echo "The listener status is :`su - oracle -c \"lsnrctl status\"\`\n"
#echo "Database status is:"
#su - oracle -c "sqlplus -s /nolog"<
#conn /as sysdba
#select log_mode,name,open_mode from v\$database;
#quit
#EOF
su - oracle -c "sqlplus -s /nolog"</dev/null|grep -i "ORACLE not avail
able"
conn /as sysdba
select log_mode,name,open_mode from v\$database;
quit
EOF
if [ $? = 0 ]
then
echo "The database not available!!!\n"
else
echo "The database is NORMAL\n"
fi
}
#HBA card link
HARDWARE_CHECK() {
fget_config -Av|grep -i dacnone>>/dev/null
if [ $? -eq 0 ]
then
echo "The storage link has problem!!!"
else
echo "The storage link NORMAL!"
fi
}
#HACMP CHECK
HA_CHECK() {
echo "The HACMP status is: `lssrc -g cluster|sed '1d'`"
}
#CHECK SNA
SNA_CHECK() {
echo "The SNA LINK STATUS is:`sna -d l`"
echo "The SNA SESSION has problem as fllows:\n"
sna -d sl|tail +4|awk 'BEGIN { FS="\t"; print "name","\tactsess","actconw"}{if ($7 == 0 && $8 == 0) print $1, $7,$8}'
}
#CHECK CICS
CICS_CHECK() {
echo "The not active CICS is as fllows:\n"
lssrc -a|grep cics|awk '$3!~/active/ {print $1}'
}
echo $SCRIPT. >$REPORT
echo $HOSTS >> $REPORT
echo "IP ADDRESS:`ifconfig -a|grep -w inet|grep -v 127.0.0.1|awk '{print $2}'`" >> $REPORT
netstat -v|grep -E "STAT|Link" >>$REPORT
oslevel >> $REPORT
FILESYSTEM_CHECK >>$REPORT 2>&1
VG_CHECK >>$REPORT 2>&1
DISK_CHECK >>$REPORT 2>&1
ERROR_CHECK >>$REPORT 2>&1
DB_CHECK >>$REPORT 2>&1
HARDWARE_CHECK >>$REPORT 2>&1
lslpp -L|grep cluster >/dev/null
if [ $? -eq 0 ]
then
HA_CHECK >>$REPORT 2>&1
else
echo "This machine not install HACMP" >> $REPORT
fi
lslpp -L|grep "sna.rte" >/dev/null
if [ $? -eq 0 ]
then
SNA_CHECK >>$REPORT 2>&1
else
echo "This machine not install sna" >> $REPORT
fi
lslpp -L|grep -i cics >/dev/null
if [ $? -eq 0 ]
then
CICS_CHECK >>$REPORT 2>&1
else
echo "This machine not install cics" >> $REPORT
fi
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/11134849/viewspace-614191/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用Linux expect批次巡檢Linux Aix Solaris磁碟使用率指令碼LinuxAI指令碼
- 【資訊採集】IBM AIX系統硬體資訊檢視命令(shell指令碼)IBMAI指令碼
- dba巡檢指令碼指令碼
- mysql巡檢指令碼MySql指令碼
- SQL SERVER巡檢指令碼SQLServer指令碼
- shell指令碼企業巡檢指令碼
- 一條命令永久啟用windows系統、officeWindows
- 簡單一條命令去掉麒麟系統的賬號密碼密碼
- mysql 伺服器巡檢指令碼MySql伺服器指令碼
- 【AIX-PS】AIX系統ps命令詳解AI
- Oracle運維指令碼-巡檢(RAC版)Oracle運維指令碼
- Oracle 資料庫巡檢指令碼 單例項 RAC 輸出HTML格式Oracle資料庫指令碼單例HTML
- Python 輸出命令列進度條Python命令列
- Oracle運維指令碼-巡檢(單機版)Oracle運維指令碼
- 【SCRIPT】Oracle日常巡檢指令碼通用版Oracle指令碼
- Linux基礎服務巡檢指令碼模板Linux指令碼
- Linux系統檢查指令碼Linux指令碼
- 【效率工具】史上最好用的SSH一鍵登入指令碼,超強更新!指令碼
- 巡檢昨天到現在asm 、系統、資料庫等錯誤日誌 shell指令碼ASM資料庫指令碼
- 在命令列上輸出進度條的原理命令列
- Oracle運維指令碼-巡檢(RAC版本)-V1.1Oracle運維指令碼
- SharePlex 基於Solaris 10 Linux自動巡檢指令碼Linux指令碼
- CSS 美化滑動輸入條 input rangeCSS
- 高手過招不用滑鼠,一款超好用的跨平臺命令列介面庫命令列
- 分享一條history命令小技巧
- What! 一條命令搞定監控?
- 一條命令解決介面MockMock
- 【SCRIPT】Oracle12C日常巡檢指令碼通用版Oracle指令碼
- 透過 Prometheus 編寫 TiDB 巡檢指令碼(指令碼已開源,內附連結)PrometheusTiDB指令碼
- app直播系統原始碼,點選生成條形碼APP原始碼
- 每天一條Linux命令(24) ssh (遠端安全登入)Linux
- DBA知道這17條Linux命令,就夠了!Linux
- win10帳號不用密碼登入的方法_win10怎麼設定不用輸密碼登陸系統Win10密碼
- 一條命令開啟監控之旅!
- 一條命令安裝Windows Subsystem for LinuxWindowsLinux
- 直播系統原始碼,Vue 禁止輸入框輸入空格原始碼Vue
- 系統巡檢Python生成word報告🧫Python
- 史上最全近百條Oracle DBA日常維護SQL指令碼指令OracleSQL指令碼
- Ubuntu進修條記-SCIM奇怪符號輸入Ubuntu符號