System Check before shift begins

Here is an oldie but goodie, right before my shift would begin here is a set of items to check for.

#!/bin/bash
#
# Script to quickly review the system status
# prior to beginning a shift
# 11/24/2014 F.Gonzalez
# 
# set environment
dt=`date +%d%b%Y-%X`
host=`hostname`
aprocs=`/bin/ps -ef | wc -l`

# Placing the server logs here:
    tmpfile="/tmp/system_load.tmp"
    

echo $host $dt

# Check the server uptime
echo "***** Uptime *****"
	/usr/bin/uptime

# Check the current runtime level
echo  "**** Runtime ****"
	/usr/bin/who -r

# Verify the system time and ntp
echo  "**** Current Time ****"
	/usr/bin/ntpstat 

# Check the CPU load over 30 second sample
echo  "**** SAR CPU Load ****"
	nohup sar 1 30 

# Inspect the disk usage
echo  "**** Disk Usage ****"
	/bin/df -h

# Review the 25 most recent log messages, there may be more
echo  "**** Recent System Messages ****"
	/usr/bin/tail -25 /var/log/messages

# Look for Warnings and Error notifications in the system log 
echo  "**** DMesg Warnings & Errors ****"
	/bin/dmesg | grep -i 'warn\|error'
	/bin/grep -i 'warn\|error' /var/log/messages

# Inspect multipath is paired
echo  "**** Multipath Listing ****"
	/sbin/multipath -ll

# Two part equallogic status check;
# Part 1: Output the summary of equallogic
# Part 2: Extended view of equallogic 
echo  "**** Equallogic Status ****"
	/usr/sbin/ehcmcli status | grep -i 'Adapters\|Managed\|\iSCSI\|Errors\|Warnings\|Suggestions'
	/usr/sbin/ehcmcli status

# Disk i/o and memory statistics review
echo  "**** Disk & Memory Stats ****"
	/usr/bin/iostat
	echo ""
	 /usr/bin/free -m
	echo ""
	 /usr/bin/vmstat
	echo ""
	 /usr/bin/mpstat

# Check network cards for errors
echo "**** Network Interfaces Errors ****"
	/sbin/ifconfig | grep error
	 echo ""
	 	/sbin/ifconfig | grep -i 'rx\|tx'
	 echo ""	
		/bin/netstat -rn

# Check server cache status
echo "**** Cache Usage ****"
	/usr/bin/slabtop -o | grep -i active

# Report number of processes running and the completion of the script
echo "**** Processes running ****"
echo "Currently running $aprocs processes"
echo "End of report ** $host, $dt **"

That would get my day started

RELATED POST

VirtualBox: Create vm from script

Edit a few variables prior to kicking off the script, for instance the host name in the variable VM='RHEL_6_5_5' to…

Working with date command

Quick reminder on how to use date command: %a – Displays the locale’s abbreviated weekday name. %A – Displays the…

Install Apache using Puppet Master

In this vast world of orchestration & automation tools and techniques, here is a quick one on how to get…

Using nmon & nmon visualizer

A great way to visualize nmon data is using Nigel Griffiths nmon visualizer java tool #java -DfontSize=16 -jar NMONVisualizer_.jar