DOYENSYS Knowledge Portal




We Welcome you to visit our DOYENSYS KNOWLEDGE PORTAL : Doyensys Knowledge Portal




Thursday, March 31, 2016

Script to check Disk space in all remonte servers in network

#!/bin/bash
# ssh password less login is required

# mention below remote server seperated by space

remote_srv=(192.168.1.1 192.168.1.2  )

do_ssh() {
    ssh $s "$@"
    echo -e
}

header() {
    echo "#==================={$@}==========================#"
}

n=${#remote_srv[@]} # number of ip's in array

for (( i=0;i<$n;i++)); do
            echo -e
            echo "$(tput bold)$(tput setaf 2)* Connected Server: ${remote_srv[$i]}  @@ $(date) @@"
            echo "* Fetching info...$(tput sgr 0)"
            s=${remote_srv[$i]}

            header "Disk Usage"
            do_ssh df -h
done

## EOF

1 comment:

Sridevi K said...


Regards
Sridevi Koduru (Senior Oracle Apps Trainer Oracleappstechnical.com)
LinkedIn profile - https://in.linkedin.com/in/sridevi-koduru-9b876a8b
Please Contact for One to One Online Training on Oracle Apps Technical, Financials, SCM, SQL, PL/SQL, D2K at training@oracleappstechnical.com | +91 - 9581017828.