Quantcast
Channel: Doyensys Allappsdba Blog..
Viewing all articles
Browse latest Browse all 1640

Script to check Disk space in all remonte servers in network

$
0
0
#!/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

Viewing all articles
Browse latest Browse all 1640

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>