#!/usr/bin/ksh #Chris Rutherford 140100 #============================================================================== EXT=".report.txt" # this is the file extention for the report that is saved PS3="Please choose the number of the report you wish to generate >" #export PS4='$0.$LINENO+ ';set -xv # debug info function Title { print "********************************************************************************" print $1 |awk '{spaces = "" for (i = 1; i < (80 - length($0)) / 2; i ++) spaces = spaces " " print spaces $0 }' print "********************************************************************************" } #============================================================================== Stamp() { print "$report Configuration Report for: $(uname -n)" print "Made on: $(date) $(who -b | cut -d "." -f2)" print "$(uname -M) AIX VER $(oslevel)" } #============================================================================== Storage() { Title "Physical Disk Data";lsvg|lsvg -i Title "Storage Definitions" for vg in $(lsvg); do print "$vg - Is located on the following drives.";lsvg -p $vg print "-----------------------------------------------------------------------" print "$vg - Contains the following Filesystems.";lsvg -l $vg done Title "Mounted Filesystem Space";df -k Title "Paging Definitions";lsps -s;lsps -a } #============================================================================== Setup_files() { Title "/etc/filesystems";grep -v "*" /etc/filesystems Title "/etc/passwd";grep -v "*" /etc/passwd Title "/etc/group";cat /etc/group Title "/etc/qconfig";grep -v "*" /etc/qconfig Title "/etc/hosts" ;grep -v "^#" /etc/hosts Title "Cron Job Entries" for i in $(ls /usr/spool/cron/crontabs);do print "Entry for $i" print "-----------------------------------------------------------------------" grep -v "^#" /usr/spool/cron/crontabs/$i done Title "Installed Software" ;lslpp -h all } #============================================================================== Net() { Title "Network Gateway and Routing Data";netstat -r Title "/etc/hosts" ;grep -v "^#" /etc/hosts } #============================================================================== Installed_Hard() { Title "Installed Hardware";lsdev -C print "Installed Hardware Part / FRU Data (if avalable)" for i in $(lsdev -CSa |grep -v tty |grep -v sys0|awk '/[0-9,A-Z]\-[0-9,A-Z]/{print $1}') do print "Part and FRU Data For $i" print "--------------------------------------------------------" if [ $(print "$i" |cut -c1-3) = "mem" ];then lsattr -El $i else lscfg -vl $i fi done } #============================================================================== # Main Menu #============================================================================== clear; Title "This collects data about a system and creates configuration reports." select report in Storage Setup_files Hardware Network Full Quit do case $report in Storage)Stamp|tee $report$EXT;Storage|tee -a $report$EXT;break;; Setup_files)Stamp|tee $report$EXT;Setup_files|tee -a $report$EXT;break;; Hardware)Stamp|tee $report$EXT;Installed_Hard|tee -a $report$EXT;break;; Network)Stamp|tee $report$EXT;Net|tee -a $report$EXT;break;; Full)Stamp|tee $report$EXT;Storage|tee -a $report$EXT;Installed_Hard|tee -a $report$EXT;Net|tee -a $report$EXT;Setup_files|tee -a $report$EXT;break;; *)print "\nQuiting...";report="(NO REPORT SAVED!)";break;; esac done Title "Report saved in $(pwd) as $report$EXT"