Pages

Showing posts with label System configuration. Show all posts
Showing posts with label System configuration. Show all posts

Saturday, 7 January 2012

system configuration and diagnostic information on Linux systems

prtdiag displays system configuration and diagnostic information on Linux systems.




 Especially on x86 platforms many information is aquired by reading the appropriate values from BIOS using dmidecode(8) and biosdecode(8) from the dmidecode package, which require super user privileges. Therefore this script should be run as super user (aka root).
Furthermore this script utilizes the sysfs of Linux 2.6.x or better kernels, especially for retrieving SCSI and hardware sensor information. It expects the sysfs to be mounted on the /sys directory. NOTE: This script does not try to setup or load any hardware monitoring kernel modules - so the lm_sensors utilities are not used. However you may use its sensors-detect(8) as well as the i2c-detect(8) utilities to find out, which modules are appropriate for your hardware and how to load them automatically at startup.







Options

-f         display all temperatures values in Fahrenheit instead of Celsius.
 

-h       display a short usage summary and exit.
-H      Do not display the report header (which usually consists of the hostname and time of    execution of the script).

-V     display version and copryright information and exit.
-t       types

A simple string, which indicates, what system information should be displayed. The following letters are honored:


g    general platform
c    CPUs
p    PCI (especially IO) devices
i     IDE devices
s    SCSI devices
m   memory devices
e    environment (i.e. fan speeds, temperatures, voltages)
b    BIOS/PROM version
a    all (default)


Download it from below link
wget http://people.redhat.com/tcallawa/prtdiag/prtdiag-1.2.tar.bz2
tar jxf prtdiag-1.2.tar.bz2 
cd prtdiag-1.2
sh install.sh
prtdiag

[root@server2124 prtdiag-1.2]# prtdiag
*** lm_sensors was NOT found. ***
*** Get lm_sensors from http://www2.lm-sensors.nu/~lm78/ or your Linux vendor. ***
*** System information will be limited. ***

System Hostname: server2124.localdomain.com
Time of Report: Sat Jan  7 02:18:32 PST 2012
System Configuration: [x86_64] Unknown Vendor Unknown Model (4 X Intel(R) Xeon(R) CPU           E5506  @ 2.13GHz 2133.338 MHz)
System clock frequency: UNKNOWN (no APIC in kernel?)
Memory size (approximate): 7168 Megabytes

========================= CPUs ========================

 CPU #      CPU MHz     CACHE (KB)     Bogomips
-------    ---------   ------------   ----------
   0        2133.338      4096 KB
   1        2133.338      4096 KB
   2        2133.338      4096 KB
   3        2133.338      4096 KB

====================== IO Devices =====================

***** No PCI or ISA buses found! *****

====================== IDE Devices ======================

*** No IDE channels present, hence no devices! ***

===================== SCSI Devices ======================

Host/Channel/ID/LUN      Vendor           Model           Type
-------------------     --------        ---------       --------
scsi1 / 0 / 00 / 00     MITSUMI         CD-ROM          CD-ROM
scsi3 / 0 / 00 / 00     ATA             WDC             Direct-Access

================== Environmental Status =================

*** Unable to provide Environmental Status Data. ***



Friday, 6 January 2012

Hardware Configuration for Linux


Hardware Configuration for Linux Shell Script


#!/bin/bash

#
# System configuration
# (All most complete information)
# @uther : linuxeverywhere@gmail.com
#

#This script path and name---------------[
if [ `dirname $0` == "." ] ; then
thisScript=`pwd`"/$0"
else
thisScript=$0
fi
#This script path and name---------------[

#-----------check root or any local user-----#
userId=`id -g`
if [ $userId == 0 ]; then

clear
echo ""
echo " System configuration"
echo " ===================="

#System-Info---------------------[
host_name=`hostname`
date_n_time=`date '+%m/%d/%y %H:%M:%S'`
#System-Info---------------------]

#os-details----------------------[
os_installed=`cat /etc/issue | head -1`
os_name=`uname -a`
hw_platform=`uname -i`
if [ $hw_platform == "i386" ]; then
hw_platform="32bit"
fi
if [ $hw_platform == "x86_64" ]; then
hw_platform="64bit"
fi
#os-details----------------------]

#users---------------------------[
no_of_users=`who | wc -l`
users=`users | awk '{ while(++i<=NF) printf (!a[$i]++) ? $i FS : ""; i=split("",a); print "" }'`
#users---------------------------]

#ip-address(s)----------------------[
ip_address=`echo \`ifconfig | grep "inet addr"| grep -v "127.0.0.1" | awk '{print $2}' |cut -d: -f2 \` |tr " " ","`
#ip-address(s)----------------------]

#cpu-info------------------------[
cpu=`grep "model name" /proc/cpuinfo | cut -d: -f2 | head -1`
no_of_cpu=`grep "model name" /proc/cpuinfo | cut -d: -f2 | wc -l`
#cpu-info------------------------]

#RAM and Swap Info------------------------[
Javaversion=`java -version  2>&1 | awk '{print $2$3$4}' |tail -1`
RamInSystem=`echo \`dmidecode --type 17 | grep "Size" | grep "MB" |awk '{print $2}'\``
RAM_total_available=`free -m 2>&1 | awk '{print $4}' | head -2 | tail -1`
RAM_total_cut=`echo $RamInSystem | awk '{print $1+$2+$3+$4+$5}'| awk '{print $1 / 1000}' | bc | cut -d. -f1`
swapInstalled=`cat /proc/swaps | tail -1 | awk '{print $3 / 1000000}' | bc`
swapInstalled_cut=`echo "$swapInstalled"  | cut -d. -f1`
RamMulByTwo=`echo "$RAM_total_cut * 2" | bc`
if [ $RamMulByTwo -le $swapInstalled_cut ]; then
swapOkOrNot=`echo "Yes"`
else
swapOkOrNot=`echo "No. Atleast $RamMulByTwo GB should be there"`
fi
RAM_total_used=`free -m 2>&1 | awk '{print $3}' | head -2 | tail -1`" MB"
countRams=`echo $RamInSystem | wc -w`
RamSize=`echo $RamInSystem | tr " " ","`" MB [$countRams RAM(s)]"
#RAM and Swap Info------------------------]

#HDD Info------------------------[
if [ $userId == 0 ]; then
No_of_HDDs=`fdisk -l 2>&1 | grep Disk | grep -v "identifier" | grep -v "valid partition" | awk '{print $3}' | wc -l`
countHDD=`fdisk -l 2>&1 | grep Disk | grep -v "identifier" | grep -v "valid partition" | awk '{print $3}' | wc -m`
countHDD=`echo $[ $countHDD - 1 ]`
HDD=`fdisk -l 2>&1 | grep "Disk" | grep -v "identifier" | grep -v "valid partition" | awk '{print $3 ""}' | tr "\n" ","| cut -c1-$countHDD`" GB [$No_of_HDDs HDD(s)]"
else
HDD="not configured -deepak"
fi
#HDD Info------------------------]

#Tomcat-Status-----------can be used in tomcatservice file /etc/init.d/tomcat...--------[
tomcat_count=`ps -ef | grep catalina | grep -v "grep catalina" | grep -v "catalina.out"| wc -l`
psid=`ps -ef | grep catalina | grep -v "grep catalina" | grep -v "catalina.out" | awk '{print $2}' | head -1`
if [ $tomcat_count = 1 ]
then
tomcat_status="Running. ( pid "`ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap start" | awk '{printf $1 " "}'`")"
KBusedbyTomcat=`pmap $psid 2>&1 | tail -1 | awk '{print $2}' | cut -dK -f1`
elif [ $tomcat_count -gt 1 ]
then
tomcat_status="Not Running (There may be an error. Pid "`ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap start" |awk '{printf $1 " "}'`")"
else
tomcat_status="Not Running"
KBusedbyTomcat="0"
fi
#Tomcat-Status-------------------]

#Postgres-Status-------------------[
postgres_count=`ps -ef | grep postgres | grep -v "grep postgres" | wc -l`
if [ $postgres_count -gt 0 ]; then
postgres_status="Running. ( pid "`ps ax --width=1000 | grep "postgres" | grep -v "grep postgres" | awk '{printf $1 " "}'`")"
else
postgres_status="Not Running"
fi
#Postgres-Status-------------------]

#-----------------------------------------IMPORTANT-------------------------------[
if [ $RAM_total_available -lt 50 ]; then
echo -e "\t\t\t\t\t:X: DANGER :X:\n\t\t\t\t\tSystem Running in very low memory : $RAM_total_available MB only"
fi
#-----------------------------------------IMPORTANT-------------------------------]

echo ""
echo " Computer Name                  : $host_name"
echo " Operating System (Name)        : $os_installed"
echo " Operating System (Description) : $os_name"
echo " OS Hardware platform           : $hw_platform"
echo " System Date & Time             : $date_n_time"
echo " IP address(es) given           : $ip_address"
echo " CPU                            :$cpu [$no_of_cpu cpu(s)]"
echo " RAM installed                  : $RamSize"
echo " RAM available                  : $RAM_total_available MB"
echo " Java version                   : $Javaversion"
echo " Swap memory : $swapInstalled"
echo " Swap memory is enough ? : $swapOkOrNot"
echo " RAM used                       : $RAM_total_used"
echo " Hard disk(s)                   : $HDD"
echo " Users logged in                : $users (in $no_of_users places)"

echo ""
echo " Tomcat status                  : $tomcat_status"
echo " Memory used by Tomcat          : $KBusedbyTomcat KB"
echo " Postgres status                : $postgres_status"
echo ""

else
echo ""
echo "!!! Please Login as root OR enter root password!!!"
su root -c "$thisScript"
fi

Twitter Bird Gadget