system 정보보기 스크립트

Posted by 주원이^^
2017.01.31 16:21 리눅스/스크립트

###########################################################

# Name of the script : syscheck-v1.2.sh

# Date              : 07/26/98

# Modified        : 11/15/04       By Jae. Hwa, Kim

# Version : 1.2

# This script collects System Configuration information.

# tar : sysinfo, error log , hacmp snap, x25backup, sna

###########################################################

DATE=`date +%m%d%y`

SRV=`uname -n`

RPT=./sys.$SRV.$DATE.txt

X25BACK=./x25.$SRV.$DATE.txt

HASNAP=/usr/es/sbin/cluster/snapshots/snap.$SRV.$DATE.*

ERRLOG=./err.$SRV.$DATE.txt

SYSTAR=./`uname -n`.`date +%m%d%y`.check.tar

mkdir ./x25backup

echo "System information will be saved on $RPT"

#TMP="/tmp"

#> ${PRT}

exec >> ${RPT} 2>&1

# Put the server and the date in the report

banner `uname -n`

echo " "

echo "                     %%%%%%%%%%%%%%%%%%%%%%%%%%%"

echo "                     System Configuration Report"

echo "                     %%%%%%%%%%%%%%%%%%%%%%%%%%%"

echo " "

echo `date `

echo " "

# General Information.

echo "######################"

echo "General Information"

echo "######################"

echo " "

prtconf

echo " "

echo " "

echo " "

# CPU_CLOCK.

echo "######################"

echo "CPU_CLOCK"

echo "######################"

echo " "

CPU_CLOCK.exe

echo " "

echo " "

echo " "

# General OS Information.

echo "######################"

echo "General OS Information"

echo "######################"

echo " "

# Check the Operating System Level in the report

echo "=============================================="

echo "<< `uname -n` -- AIX Operating System Level >>"

echo "=============================================="

echo " "

echo "---------------------------------------"

echo "Lists names of known maintenance levels"

echo "---------------------------------------"

echo " "

/usr/bin/oslevel -q

echo " "

echo "-----------------------------------------------------------------"

echo "Lists fileset at levels later than the current maintenance levels"

echo "-----------------------------------------------------------------"

echo " "

/usr/bin/oslevel -r

echo " "

echo " "

echo "===================================="

echo "<< `uname -n` -- Boot Information >>"

echo "===================================="

echo " "

echo "--------------------"

echo "The last boot Device"

echo "--------------------"

echo " "

/usr/sbin/bootinfo -b

echo " "

echo "------------------------------------"

echo "The Booting Kernel Mode(32bit/64bit)"

echo "------------------------------------"

echo "H/W    Mode : "`/usr/sbin/bootinfo -y`" bit"

echo "Kernel Mode : "`/usr/sbin/bootinfo -K`" bit"

echo " "

echo "-----------------"

echo "The System uptime"

echo "-----------------"

uptime

echo " "

echo " "


# Put the system attributes in the report

echo "======================================================================="

echo "<< `uname -n` -- System Attribute information (lsattr -E -H -l sys0) >>"

echo "======================================================================="

echo " "

lsattr -E -H -l sys0

echo " "

# Put the machinetype info in the report

echo "=============================================="

echo "<< `uname -n` -- System Information (lscfg) >>"

echo "=============================================="

echo " "

lscfg -vp

echo " "

# Print the Processor on this server

echo "========================================="

echo "<< `uname -n` -- Processor information >>"

echo "========================================="

echo " "

/usr/sbin/bindprocessor -q

echo " "

# Print the amount of memory on this server

echo "======================================"

echo "<< `uname -n` -- Memory information >>"

echo "======================================"

echo " "

echo "-----------------------"

echo "The Size of real memory"

echo "-----------------------"

echo " "

/usr/sbin/bootinfo -r

echo " "

# Put the OS-dump info in the report

echo "===================================="

echo "<< `uname -n` -- DUMP information >>"

echo "===================================="

echo " "

echo "-------------------"

echo "Current Dump Device"

echo "-------------------"

echo " "

sysdumpdev -l

echo " "

echo "--------------------"

echo " Estimated Dump Size"

echo "--------------------"

echo " "

sysdumpdev -e

echo " "

# Put the OS-page space info in the report

echo "========================================="

echo "<< `uname -n` -- Paging space information"

echo "========================================="

echo " "

lsps -a

echo " "

echo "======================================="

echo "<< `uname -n` -- Disk Usage Information"

echo "======================================="

echo " "

df -tk

echo " "

echo "======================================="

echo "<< `uname -n` -- Slot Information"

echo "======================================="

echo " "

lsslot -c pci

echo " "

# Print physical scsi adapter and disk info

echo "======================================================="

echo "<< `uname -n` -- SCSI adapter and physical disk info >>"

echo "======================================================="

echo " "

lscfg | grep -i scsi | grep -i -E "adapter|controller"

echo " "

lsdev -Cc disk

echo " "

echo "======================================="

echo "<< `uname -n` -- Crontab Information >>"

echo "======================================="

echo " "

crontab -l

echo " "

echo "==============================================="

echo "<< `uname -n` -- File System export Information"

echo "==============================================="

echo " "

exportfs

echo " "

echo "========================================="

echo "<< `uname -n` -- Alog Boot Information >>"

echo "========================================="

echo " "

echo " "

alog -o -f /var/adm/ras/bootlog

echo " "

echo " "

echo " "

echo " "

echo "========================================="

echo "<< `uname -n` -- User License Information"

echo "========================================="

echo " "

echo " "

lslicense

echo " "

echo " "

echo " "

echo " "

# LVM Information

echo "#################"

echo " LVM Information "

echo "#################"

echo " "

echo " "

echo " "

# List all VG

# Find all the disks in the machine then print info

echo "======================================"

echo "<< `uname -n` -- List all volume group"

echo "======================================"

echo " "

echo "-------------"

echo "Volume Groups"

echo "-------------"

echo " "

echo "List Volume Group"

lsvg

echo " "

echo "List On-line Volume Group"

echo " "

lsvg -o

echo " "

echo "----------------"

echo "Physical Volumes"

echo "----------------"

lspv

echo " "

echo " "

echo " "

lsvg | while read VG

do

 echo " "

 echo "The following physical volumes are in Volume Group -- $VG --"

 lsvg -p $VG

 echo " "

 echo "<< Volume group info for $VG"

 lsvg $VG

 echo " "

 echo " "

 echo " "

done

echo " "

# List physical disk info

echo "=========================================================="

echo "<< `uname -n` -- List all physical volumes by volume group"

echo "=========================================================="

echo " "

getlvodm -C | while read VOL

do

 echo " "

 echo "<< Physical volume info for $VOL by PVID >>"

 lspv $VOL

 echo " "

 echo "<< Physical volume info for $VOL by logical volume >>"

 lspv -l $VOL

 echo " "

 echo "<< Physical volume info for $VOL by PP Range >>"

 lspv -p $VOL

 echo " "

 echo " "

 echo " "

done

echo " "

# List all logical volumes by volume group

echo "========================================================="

echo "<< `uname -n` -- List all logical volumes by volume group"

echo "========================================================="

echo " "

lsvg -o | while read VG

do

 echo "<< List of logical volumes defined in volume group $VG >>"

 lsvg -l $VG

 echo " "

 echo "<< List of physical volumes defined in volume group $VG >>"

 lsvg -p $VG

 echo " "

 echo " "

 echo " "

done

echo " "

# Save the mount information in the report

echo "====================================="

echo "<< `uname -n` -- Mount information >>"

echo "====================================="

echo " "

mount

echo " "

# Print the file system information

echo "========================================="

echo "<< `uname -n` -- List all file systems >>"

echo "========================================="

echo " "

lsfs -l

echo " "

# Network Information

echo "###################"

echo "Network Information"

echo "###################"

echo " "

echo " "

# Check Network Option

echo "================================================="

echo "<< `uname -n` -- Network Option Tunable Values >>"

echo "================================================="

echo " "

echo "-------------------------------"

echo "Important Network Option Values"

echo "-------------------------------"

echo " "

no -a | grep thewall

no -a | grep sb_max

no -a | grep tcp_sendspace

no -a | grep tcp_recvspace

no -a | grep udp_sendspace

no -a | grep udp_recvspace

no -a | grep rfc1323

no -a | grep tcp_mssdflt

no -a | grep ipforwarding

no -a | grep tcp_pmtu_discover

no -a | grep udp_pmtu_discover

echo " "

echo " "

# Put the network information in the report

echo "================================================="

echo "<< `uname -n` -- Network information (netstat) >>"

echo "================================================="

echo " "

echo "-----------"

echo "netstat -nr"

echo "-----------"

netstat -nr

echo " "

echo "----------"

echo "netstat -i"

echo "----------"

netstat -i

echo " "

echo "----------"

echo "netstat -m"

echo "----------"

netstat -m

echo " "

echo "----------"

echo "netstat -v"

echo "----------"

netstat -v

echo " "


# Improtant Files

echo "###########################"

echo "Important Files Information"

echo "###########################"

echo " "

echo " "

echo " "

echo "========================================"

echo "<< `uname -n` -- some Important files >>"

echo "========================================"

echo " "

echo "------------"

echo "/etc/inittab"

echo "------------"

cat /etc/inittab

echo " "

#echo " "

echo "----------"

echo "/etc/hosts"

echo "----------"

cat /etc/hosts

echo " "

#echo " "

echo "----------------"

echo "/etc/resolv.conf"

echo "----------------"

cat /etc/resolv.conf

echo " "

#echo " "

echo "---------"

echo "/etc/motd"

echo "---------"

cat /etc/motd

echo " "

#echo " "

echo "-----------"

echo "/etc/passwd"

echo "-----------"

cat /etc/passwd

echo " "

#echo " "

echo "----------"

echo "/etc/group"

echo "----------"

cat /etc/group

echo " "

3echo " "

echo "------------"

echo "/etc/profile"

echo "------------"

cat /etc/profile

echo " "

#echo " "

echo "------------------"

echo "/etc/security/user"

echo "------------------"

cat /etc/security/user

echo " "

#echo " "

echo "--------------------"

echo "/etc/security/limits"

echo "--------------------"

cat /etc/security/limits

echo " "

#echo " "

echo "-----------------------"

echo "/etc/security/login.cfg"

echo "-----------------------"

cat /etc/security/login.cfg

echo " "

#echo " "

echo "---------------------"

echo "/etc/security/environ"

echo "---------------------"

cat /etc/security/environ

echo " "

#echo " "

echo "-------------"

echo "/etc/services"

echo "-------------"

cat /etc/services

echo " "

#echo " "

echo "----------------"

echo "/etc/filesystems"

echo "----------------"

cat /etc/filesystems

echo " "

#echo " "

echo "-----------"

echo "/etc/rc.net"

echo "-----------"

cat /etc/rc.net

echo " "

echo " "

echo " "

echo " "

echo "-----------"

echo "    aio    "

echo "-----------"

lsattr -El aio0

echo " "

echo " "

echo " "

echo " "

# List Software Installed.

echo "####################"

echo "Software Information"

echo "####################"

echo " "

# Get the LPP information

echo "==========================================================="

echo "<< `uname -n` -- List all LPPs installed on this machine >>"

echo "==========================================================="

echo " "

lslpp -L all

echo " "

echo " "

echo " "

echo " "

# SNA config & status & backup

echo "####################"

echo "SNA config & status"

echo "####################"

echo " "

echo "========================="

echo "<< `uname -n` -- SNA >>"

echo "========================="

echo "-----------------------------"

echo "<< `uname -n` -- SNA status >>"

echo "-----------------------------"

mpcinfo

echo " "

ListRAS

echo " "

sna -d l

echo " "

sna -d s

echo " "

echo "==================="

echo "SNA config Backup "

echo "==================="

cat /etc/sna/sna_node.cfg

echo " "

echo " "

# X.25 config & status & backup

echo "####################"

echo "X.25 config & status"

echo "####################"

echo " "

echo "========================="

echo "<< `uname -n` -- x.25  >>"

echo "========================="

echo "-----------------------------"

echo "<< `uname -n` -- x25status >>"

echo "-----------------------------"

x25status

echo " "

echo "-------------------------"

echo "<< `uname -n` -- lsx25 >>"

echo "-------------------------"

lsx25

echo " "

echo "==================="

echo "X.25 config Backup "

echo "==================="

backupx25 -d /x25backup -v

echo " "

echo " "

echo " "

# HACMP config & status & backup

echo "#####################"

echo "HACMP Config & status"

echo "#####################"

echo " "

echo "-----------------------------------"

echo "<< `uname -n` HACMP Daemon status >>"

echo "-----------------------------------"

echo "Cluster status"

lssrc -a |egrep 'svc|ES'

lssrc -ls snmpd

lssrc -ls topsvcs 

lssrc -ls emsvcs 

lssrc -ls emaixos

lssrc -ls grpsvcs

echo " "

echo " "

echo " "

echo "======================================"

echo "<< `uname -n` -- HACMP Information  >>"

echo "======================================"

echo "-------------------------------------"

echo "<< `uname -n` HACMP Cluster config >>"

echo "-------------------------------------"

echo "<< Cluster info >>"

/usr/es/sbin/cluster/utilities/cllsclstr

echo " "

echo "<< Cluster Node info >>"

/usr/es/sbin/cluster/utilities/cllsnode

echo " "

echo "<< Cluster Node interface info >>"

/usr/es/sbin/cluster/utilities/cllsif

echo " "

echo "<< Cluster resources group >>"

/usr/es/sbin/cluster/utilities/cllsgrp

echo " "

echo "<< Cluster resource group information >>"

/usr/es/sbin/cluster/utilities/cllsgrp  | while read REG

do

   echo "-----------------------"$REG" information-----------------------------"

   /usr/es/sbin/cluster/utilities/clshowres -g $REG

   echo " "

done

echo "------------------------------"

echo "<< `uname -n` -- HACMP SNAP >>"

echo "------------------------------"

/usr/es/sbin/cluster/utilities/clsnapshot -c -i -n snap.$SRV.$DATE  -d  'ha snap'

echo "###########################"

echo "`uname -n` system error log"

echo "###########################"

echo "--------------------------------------"

echo "<< `uname -n` -- errpt > $ERRLOG >>"

echo "--------------------------------------"

errpt >> $ERRLOG

echo "--------------------------------------"

echo "<< `uname -n` -- errpt -a >> $ERRLOG >>"

echo "--------------------------------------"

errpt -a >> $ERRLOG

echo " "

echo "==== tar compress ===="

tar cvf $SYSTAR $RPT $HASNAP ./x25backup $ERRLOG

echo "<< End of the Document for `uname -n` >>"

# End of the Script

# remove status file

rm $RPT $HASNAP $X25BACK $ERRLOG

rmdir x25backup

'리눅스 > 스크립트' 카테고리의 다른 글

mysql binlog -> sql 로 변환하기 스크립트  (0) 2017.03.24
실시간 트래픽 체크  (0) 2017.02.02
system 정보보기 스크립트  (0) 2017.01.31
ssh_bruteforce 자동차단  (0) 2016.11.04
웹 트래픽 로그 순위 추출  (0) 2016.11.03
apache 자동다운받기  (0) 2016.03.04
이 댓글을 비밀 댓글로