Tuesday, February 9, 2016

Script - Checking filesystem info of remote server

Checking filesystem info of remote server

#!/bin/bash
# Tue Aug 4 09:14:09 EDT 2015
# File
# Copy authorized key to remove host
# Sam Bhusalsystem check on remote server
# OS: Solaris 10
#

LOGFILE="logs/DISK_SPACE_`date "+%m%d%y_time.%H-%M-%S.log`"

# using for to loop through, you may find better option
for i in `cat ../etc/hosts.ip | grep -v "#" | awk '{print $1}'`
do
echo "Checking $i"
echo "Checking $i" >> $LOGFILE
#ssh -q $ uname -a >> $LOGFILE
ssh -q $i w >> $LOGFILE
ssh -q $i df -h | egrep -v "objfs|sharefs|ctfs|proc|platform|fs|mnttab" >> $LOGFILE
echo "" >> $LOGFILE
echo "-------------------------------------" >> $LOGFILE

done
more $LOGFILE
# EOF

--------------------------------
$ cd etc
$ cat hosts.ip

192.168.10.200 dnsserv1
192.168.10.130 appserv1
# 192.168.10.20 dnsserv1
192.168.10.210 dnsserv2
192.168.10.140 appserv2


No comments:

Post a Comment