博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
AIX巡检脚本
阅读量:2184 次
发布时间:2019-05-02

本文共 3866 字,大约阅读时间需要 12 分钟。

---------------------------------------------------------------------------------

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: $ACVGn"
#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 yesterdayn"
else
echo "Today errors is add $errcount than yesterdayn"
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"<<EOF|sed '/^$/d'
#conn /as sysdba
#select log_mode,name,open_mode from v$database;
#quit
#EOF
su - oracle -c "sqlplus -s /nolog"<<EOF|sed '/^$/d' 2>/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 NORMALn"
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 { OFS="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

转载地址:http://sqmkb.baihongyu.com/

你可能感兴趣的文章
LightGBM 如何调参
查看>>
用 TensorFlow.js 在浏览器中训练神经网络
查看>>
cs230 深度学习 Lecture 2 编程作业: Logistic Regression with a Neural Network mindset
查看>>
梯度消失问题与如何选择激活函数
查看>>
为什么需要 Mini-batch 梯度下降,及 TensorFlow 应用举例
查看>>
为什么在优化算法中使用指数加权平均
查看>>
什么是 Q-learning
查看>>
用一个小游戏入门深度强化学习
查看>>
如何应用 BERT :Bidirectional Encoder Representations from Transformers
查看>>
5 分钟入门 Google 最强NLP模型:BERT
查看>>
强化学习第1课:像学自行车一样的强化学习
查看>>
强化学习第2课:强化学习,监督式学习,非监督式学习的区别
查看>>
强化学习第3课:有些问题就像个赌局
查看>>
强化学习第4课:这些都可以抽象为一个决策过程
查看>>
强化学习第5课:什么是马尔科夫决策过程
查看>>
强化学习第6课:什么是 Crossentropy 方法
查看>>
强化学习第7课:交叉熵方法的一些局限性
查看>>
强化学习 8: approximate reinforcement learning
查看>>
图解什么是 Transformer
查看>>
代码实例:如何使用 TensorFlow 2.0 Preview
查看>>