Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Configuration Information 1

Status
Not open for further replies.

dcomit

Technical User
Jun 20, 2001
115
GB
I have aix v4.3 running on RS6000 hardware. How can I get hardware configuration information from the system. I can't power down or reboot as it is a 7/24 operation.

I particularly need to know the number of CPUs.
 
Thanks for the speedy response. The lscfg command gives me all the information I need.
 
#!/bin/ksh
I realise that you've already got what you need, but for anyone else, here's a script that I use to get configuration data of AIX.

It lists VG, PV and LV information as well as OS and hardware stuff, and puts it all in a file /tmp/lvl2_report.txt.

Hope it helps.
Dave V.


#############################################################
# File: RS_MOT
# Author: dave v.
# Date: 08/01/01
# Version: draft
#############################################################
# Description:
# Builds report on disk storage configuration that can be
# used for RS service schedule report (Level 2).
#############################################################
# Modifications:
#
#############################################################
# Usage:
# RS_MOT
#
# Output:
# Formatted report in text file - /tmp/lvl2_report.txt
#############################################################

#############################################################
# Set constants
#############################################################
typeset -r OUTPUT_FILE="/tmp/lvl2_report.txt"
typeset -r HOSTNAME=`uname -n`
typeset -r OS_LEVEL=`oslevel`
typeset -r REPORT_DATE=`date +"%a %d %B %Y"`
typeset -r -i INITIAL_COUNT=10

#############################################################
# Set variables
#############################################################
bold=`tput smso`
norm=`tput rmso`
vg_list=`lsvg`
t_getdata="Gathering data on..."
name_technician=""
typeset -i count=$INITIAL_COUNT

#############################################################
# Start of functions
#############################################################
usage () {
read cont?"ERROR: Command does note require any arguments. Continue (y|n): "
typeset -u read
case $read in
Y ) get_volume_group_info ;;
N ) exit 1 ;;
* ) exit 1 ;;
esac
}

get_technician_name() {
tput cup 3 5
read name_technician?"Please enter name of system analyst: "
tput cup 5 5
echo "Thank you. Name supplied was ${name_technician}."
tput cup 6 5
echo "Report file: ${OUTPUT_FILE}"
sleep 2
}

print_report_header() {
echo "RS SERVICE REPORT - Level 2" >> $OUTPUT_FILE
echo "===========================" >> $OUTPUT_FILE
echo "\nHost name: ${HOSTNAME}" >> $OUTPUT_FILE
}

show_counter() {
if [ $1 -eq 0 ]
then
tput cup 12 $INITIAL_COUNT
echo " "
else
tput cup 12 $1
echo "#"
fi
}

reset_counter() {
show_counter 0
count=$INITIAL_COUNT
}

get_volume_group_info () {
typeset vg_name
tput cup 5 10
echo "${bold}RS SERVICE REPORTING${norm}"
tput cup 10 10
echo $t_getdata
tput cup 10 31
echo "Volume Groups"
echo "\nVOLUME GROUP INFORMATION:\n" >> $OUTPUT_FILE
for vg_name in $vg_list
do
show_counter $count
echo "\nVolume Group: ${vg_name}\n" >> $OUTPUT_FILE
echo "${vg_name} configuration:" >> $OUTPUT_FILE
lsvg ${vg_name} >> $OUTPUT_FILE
echo "\n${vg_name} consists of the following LVs:" >> $OUTPUT_FILE
lsvg -l $vg_name >> $OUTPUT_FILE
count=$(( $count + 1 ))
done
reset_counter
end_function
}

get_logical_volume_info() {
typeset vg_name
typeset lv_name
tput cup 10 31
echo "Logical Volumes"
echo "\n\nLOGICAL VOLUME INFORMATION\n" >> $OUTPUT_FILE
for vg_name in $vg_list
do
echo "\nLogical volume information for ${vg_name}\n" >> $OUTPUT_FILE
lv_list=`lsvg -l $vg_name | awk 'BEGIN{getline;getline}$2 !~ /paging/ {print $1}'`
for lv_name in $lv_list
do
show_counter $count
echo "\nLogical Volume: ${lv_name}\n" >> $OUTPUT_FILE
lslv ${lv_name}|egrep "COPIES|POLICY"|tr -s " "|cut -d" " -f1-2 >> $OUTPUT_FILE
lslv ${lv_name}|egrep "STALE"|tr -s " "|cut -d" " -f1-3 >> $OUTPUT_FILE
lslv -l ${lv_name} >> $OUTPUT_FILE
count=$(( $count + 1 ))
done
done
reset_counter
end_function
}

get_physical_volume_info() {
typeset pv_list
tput cup 10 31
echo "Physical Volumes"
echo "\n\nPHYSICAL VOLUME INFORMATION" >> $OUTPUT_FILE
for vg_name in ${vg_list}
do
echo "\nPhysical volumes in ${vg_name}:\n" >> $OUTPUT_FILE
lspv|grep -i ${vg_name} >> $OUTPUT_FILE
pv_list=`lspv|grep -i ${vg_name}|tr -s " "|cut -d" " -f1`
for pv_name in ${pv_list}
do
show_counter $count
echo "\nPhysical volume information for ${pv_name}\n" >> $OUTPUT_FILE
lspv ${pv_name}|grep "STALE"|awk '{print $1,$2,$3}' >> $OUTPUT_FILE
lspv ${pv_name}|grep "PPs:"|awk '{print $1,$2,$3,$4,$5}' >> $OUTPUT_FILE
lspv ${pv_name}|grep "LOGICAL"|awk '{print $5,$6,$7}' >> $OUTPUT_FILE
lspv -l ${pv_name} >> $OUTPUT_FILE
count=$(( $count + 1 ))
done
done
reset_counter
end_function
}

get_paging_space_info() {
tput cup 10 31
echo "Paging Space Info"
echo "\n\nPAGING SPACE INFORMATION\n" >> $OUTPUT_FILE
lsps -a >> $OUTPUT_FILE
end_function
}

get_os_info() {
tput cup 10 31
echo "Operating System"
echo "\n\nOPERATING SYSTEM INFORMATION\n" >> $OUTPUT_FILE
echo "Operating System: AIX v${OS_LEVEL}" >> $OUTPUT_FILE
tput cup 10 31
echo "OS Patch Level "
echo "\nOS Patch Level:\n" >> $OUTPUT_FILE
lslpp -h bos.mp >> $OUTPUT_FILE
end_function
}

get_VPD_info() {
tput cup 10 31
echo "Vital Product Data"
echo "\n\nVITAL PRODUCT DATA\n" >> $OUTPUT_FILE
lscfg -v >> $OUTPUT_FILE
end_function
}

end_function() {
tput cup 10 31
echo "Completed. "
}

end_report() {
tput cup 15 10
echo "\nReport compiled ${REPORT_DATE}" >> $OUTPUT_FILE
echo "Support Analyst: ${name_technician}" >> $OUTPUT_FILE
echo "\n\nEND OF REPORT FOR ${HOSTNAME}" >> $OUTPUT_FILE
echo "${bold}REPORT COMPLETED${norm}"
}

#############################################################
# End of functions
# Start of main program
#############################################################
clear
if [ $# -ne 0 ]
then
usage
fi

get_technician_name
clear

if [ -f $OUTPUT_FILE ]
then
> $OUTPUT_FILE
fi

print_report_header
get_volume_group_info
get_logical_volume_info
get_physical_volume_info
get_paging_space_info
get_os_info
get_VPD_info
end_report
tput cup 20 1
 
Here is one I use when I'm interested more in just disk and fileystem layout. I got this from the AIX Survival Guide by Andreas Siegert. He states it is from a collection not necessarily invented by him, but it grew out of self-made and copied functions.

Dave's gives much more information. This one is helpful when all you really want to know is where you have room to put a filesystem.

========================================

#!/usr/bin/ksh
# diskinfo

export LANG=C
export LC_MESSAGES=en_US

DoPV=0
DoFS=0
DoLV=0
DoNA=0

if [[ $# -ge 1 ]] ; then
for opt
do
case $opt in
-d) DoPV=1
;;
-f) DoFS=1
;;
-l) DoLV=1
;;
-n) DoNA=1
;;
*) echo "Unknown parameter $opt"
echo "Usage:\n$(basename $0) [-d][-f][-l][-n]"
echo " -d: disks and volume groups"
echo " -f: file systems"
echo " -l: logical volumes without file systems"
echo " -n: unallocated disks"
exit 1
;;
esac
done
else
DoPV=1
DoFS=1
DoLV=1
DoNA=1
fi

echo "Disk report for $(hostname -s) (machine id $(uname -m))\n"

disks=$(lspv | egrep -v None | cut -f1 -d\ )

[[ $DoPV -eq 1 ]] && {
echo "Disks and Volume groups"
echo " Physical partitions"
echo "VG PV size used free Location Description"
for d in $disks
do
(lsdev -Cl $d | sort -k 1; lspv $d ) |
awk '/Available/ {d=$1;loc=$3;
desc=substr($0,index($0,$4));
next}
/VOLUME GROUP/ {vg=$6;next}
/PP SIZE/ {sz=$3;next}
/FREE PP/ {free=$3;next}
/USED PP/ {used=$3;next}
END {printf("%-12s %-8s %4d %5d %5d %-12s %s\n",
vg,d, sz,used,free,loc,desc)}
'
done
echo ""
}

[[ $DoNA -eq 1 ]] && {
lspv | egrep None > /dev/null
if [[ $? -eq 0 ]] ; then
echo "Unallocated physical volumes:"
for d in $(lspv | egrep None | cut -f1 -d\ )
do
lsdev -Cl $d
done
else
echo "No unallocated physical volumes"
fi
echo ""
}

(( ($DoLV+$DoFS) >= 1 )) && {
echo "VG Disk LV LPs Distribution Mount Point"
for d in $disks
do
vg=$(lspv|awk "/$d/ {print \$3}")
(echo "$d $vg"
[[ DoFS -eq 1 ]] && lspv -l $d | tail +3 | egrep " /"
[[ DoLV -eq 1 ]] && lspv -l $d | tail +3 | egrep -v " /"
) | awk '{ if (NR==1) {
disk=$1
vg=$2
} else {
printf("%-12s %-8s %-12s %-5s %-15s %s\n",
vg,disk,$1,$2,$4,$5)
}
} '
done
echo ""
}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top