Thursday, June 2, 2016

Script - Filesystem, load average vmstat check on remote host


#!/bin/bash
# Kamal Bhusal
# Tue Aug  4 09:14:09 EDT 2015
# Daily server status check
# Solaris 10
# @expanor LLC
LOGFILE="logs/FS_CHK/DISK_SPACE_`date "+%m%d%y_time.%H-%M-%S.log"`"
for i in 10.222.102.47 10.222.102.48
#for i in `cat ../etc/hosts.ip | grep -v "#" | awk '{print $1}'`
do
    echo "           " >>$LOGFILE
    echo "Please wait ... checking server $i"
    echo "=============== Checking $i server ===============" >>$LOGFILE
    echo "           " >>$LOGFILE
    echo "--------------------- Checking Load Average" >> $LOGFILE
    #ssh -q $i "bash -s" << EOF
    ssh -q $i 'w; \
        echo; echo "-------------------- Filesystem information"; \
        echo; df -h | egrep -v "objfs|sharefs|ctfs|proc|platform|fd|mnttab"; \
        echo; echo "-------------------- Cheking Virtual Memory stat"; \
        vmstat 2 3; \
        echo;'    >> $LOGFILE
    echo "____________________________End______________________" >> $LOGFILE
    echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" >> $LOGFILE
done
more $LOGFILE

No comments:

Post a Comment