AIX inspection script

Source: Internet
Author: User
Tags sqlplus

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

AIX inspection script from http://bbs.chinaunix.net/thread-1269218-1-1.html

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



#! /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/& amp; $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
Snail _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 'in in {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
Snail _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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.