0% found this document useful (0 votes)
307 views

Solaris Health Check Script

This script performs a health check of a system by running various system monitoring commands and writing the output to a log file. It checks network connectivity, disk usage, processes, memory, I/O, CPU usage and logs any errors. The script provides detailed system information and diagnostics to identify potential hardware or software issues.

Uploaded by

imranpathan22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
307 views

Solaris Health Check Script

This script performs a health check of a system by running various system monitoring commands and writing the output to a log file. It checks network connectivity, disk usage, processes, memory, I/O, CPU usage and logs any errors. The script provides detailed system information and diagnostics to identify potential hardware or software issues.

Uploaded by

imranpathan22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

#!

/bin/sh
#this script is to perform health check to the system.
#########################
# Name:
Health Check Script
#
# Call:
Excecuting the script or cronjob Or By Run it Manually
#
# Purpose:
Perform Hardware Audit & Health check on the system to scan and
exam
#
# Created:
2011-03-20/, Samer Odeh
#
# Revised:
0
#
##########################
#/usr/bin/clear
/usr/bin/echo starting
# The Time and Date
TIME=`date +20%y%m%d `
HOST=`hostname`
OUTPUT_DIR=/tmp/
OUTPUT=$OUTPUT_DIR$HOST.$TIME.out
# Create Output File
/usr/bin/echo Creating output file
/usr/bin/touch $OUTPUT
/usr/bin/echo output file created
/usr/bin/echo
# >> $OUTPUT

############################Health Check###########################

/usr/bin/hostname >> $OUTPUT


/usr/bin/echo Uptime: >> $OUTPUT
/usr/bin/uptime >> $OUTPUT
##checking Network:
/usr/bin/echo Checking Network
/usr/bin/echo ############################################################## >> $O
UTPUT
/usr/bin/echo Checking Network: >> $OUTPUT
/usr/sbin/ifconfig -a >> $OUTPUT
##checking Disk space:
/usr/bin/echo Checking Disk space
/usr/bin/echo ############################################################## >> $O
UTPUT
/usr/bin/echo Checking Disks Capacity: >> $OUTPUT
/usr/bin/df -kh >> $OUTPUT
/usr/bin/echo | format >> $OUTPUT
/usr/bin/echo
/usr/bin/echo
UTPUT

checking Processes status


############################################################## >> $O

/usr/bin/echo Checking Processes: >> $OUTPUT


/usr/bin/prstat -aR 1 2 >> $OUTPUT
/usr/bin/echo ############################################################## >> $O
UTPUT

/usr/bin/echo Checking System messages


/usr/bin/echo Checking System messages:
/usr/bin/dmesg | tail -20 >> $OUTPUT

>> $OUTPUT

/usr/bin/echo ############################################################## >> $O


UTPUT
/usr/bin/echo Reporting report virtual memory statistics
/usr/bin/echo Reporting report virtual memory statistics: >> $OUTPUT
/usr/bin/vmstat 3 4 >> $OUTPUT
/usr/bin/echo ############################################################## >> $O
UTPUT
echo Reporting report I/O statistics
/usr/bin/echo Reporting report I/O statistics: >> $OUTPUT
#/usr/bin/echo Reporting I/O
/usr/bin/echo Reporting I/O: >> $OUTPUT
/usr/bin/iostat 4 3 >> $OUTPUT
/usr/bin/iostat -xPnce >> $OUTPUT
/usr/bin/echo iostat -En: >> $OUTPUT
/usr/bin/iostat -En| grep -i soft >> $OUTPUT
/usr/bin/echo ############################################################## >> $O
UTPUT
/usr/bin/echo Reporting System Activities: >> $OUTPUT
/usr/bin/sar 5 3 >> $OUTPUT
#/usr/bin/echo sar -d 3 5 Report activity for each block device >> $OUTPUT
#/usr/bin/echo
device
%busy avque r+w/s blks/s avwait av
serv >> $OUTPUT
#/usr/bin/sar -d 3 5 >> $OUTPUT
/usr/bin/echo kstat -m cpu_stat | egrep user |idle |kernel |wait
for Solaris 9 and
earlier versions %wio won t reported as 0 >> $OUTPUT
/usr/bin/date >> $OUTPUT
/usr/bin/kstat -m cpu_stat | egrep user |idle |kernel |wait
>> $OUTPUT
/usr/bin/sleep 10
/usr/bin/date >> $OUTPUT
/usr/bin/kstat -m cpu_stat | egrep user |idle |kernel |wait
>> $OUTPUT
/usr/bin/echo ############################################################## >> $O
UTPUT
/usr/bin/echo report inter-process communication facilities status
/usr/bin/echo report inter-process communication facilities status ACTIVE Semapho
res >> $OUTPUT
/usr/bin/ipcs -s >> $OUTPUT
#/usr/bin/ipcs -mb>> $OUTPUT

/usr/bin/echo ############################################################## >> $O


UTPUT
/usr/bin/echo Checking Swap Space
/usr/bin/echo Checking Swap Space: >> $OUTPUT
/usr/bin/echo swap -l: >> $OUTPUT
/usr/sbin/swap -l >> $OUTPUT
/usr/bin/echo _______________________________________________ >> $OUTPUT
/usr/bin/echo swap -s: >> $OUTPUT
/usr/sbin/swap -s | nawk -F
{print used $9
available
$11
Free Memory: substr(sub
11,1,8)/(substr($11,1,8)+substr($9,1,8))*100,1,5) % } >> $OUTPUT
/usr/bin/echo ############################################################## >> $O
UTPUT
/usr/bin/echo Reporting display status for metadevice or hot spare pool: >> $OUTP
UT
/usr/sbin/metadb >> $OUTPUT

/usr/bin/echo Reporting display status for metadevice or hot spare pool


/usr/sbin/metastat >> $OUTPUT
/usr/bin/echo ###################################################################
############## >> $OUTPUT
/usr/bin/echo
>> $OUTPUT
/usr/bin/echo ############################################################## >> $O
UTPUT
/usr/bin/echo CPU / MEM Log and Overall Log Records: >> $OUTPUT
/usr/bin/grep -i afsr /var/adm/me* >> $OUTPUT
/usr/bin/grep -i afar /var/adm/me* >> $OUTPUT
/usr/bin/grep -i error /var/adm/me*>> $OUTPUT
/usr/bin/grep -i fail /var/adm/me*>> $OUTPUT
/usr/bin/grep -i panic /var/adm/me*>> $OUTPUT
/usr/bin/grep -i scsi /var/adm/me*>> $OUTPUT
/usr/bin/echo ############################################################## >> $O
UTPUT
/usr/bin/echo FCAL Disk and Loop Connection Checkup: >> $OUTPUT
/usr/sbin/luxadm probe >> $OUTPUT
/usr/sbin/luxadm -e port >> $OUTPUT
/usr/bin/echo ############################################################## >> $O
UTPUT
/usr/bin/echo Reporting Crash Files: >> $OUTPUT
/usr/bin/ls -lh /var/crash/`hostname`/ >> $OUTPUT
/usr/bin/echo ############################################################## >> $O
UTPUT
/usr/bin/echo Reporting Hardware issues: >> $OUTPUT
/usr/platform/`uname -i`/sbin/prtdiag -v >> $OUTPUT
/usr/bin/echo ###################################################################
############## >> $OUTPUT
/usr/bin/echo script has been finished successfully

You might also like