Last active
June 1, 2016 22:53
-
-
Save countbuggula/99ffcaa2d15af740ef9ffdbfa571aa84 to your computer and use it in GitHub Desktop.
hardware info
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Syntax: while read server; do ./hardware <user> $server && echo "" ; done < serverlist.txt > hardware.txt | |
ssh_user=$1 | |
ssh_host=$2 | |
command_string="hostname && cat /proc/cpuinfo | grep 'model name' | sort -u && echo -e 'Cores:' && cat /proc/cpuinfo | grep 'core id' | sort -u | wc -l && cat /proc/meminfo | grep MemTotal && df -hl -x tmpfs | gawk -v hostname=$line '$1 ~ /^[0-9]+$/{sum += $1;} END{print hostname \" Total: \" (sum/1024/1024) \"G\";}'"" | |
ssh -n -o BatchMode=yes -o StrictHostKeyChecking=no $ssh_user@$ssh_host $command_string 2>&1| grep -v "tput" | sed 's/^/ /g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Creates a text file listing CPU model, number of cores, total memory, and disk space for a group of servers. To use, create serverlist.txt with each IP address or URL on a new line. Requires login with ssh key.