Skip to content

Instantly share code, notes, and snippets.

@vaughany
Created January 31, 2018 13:48
Show Gist options
  • Select an option

  • Save vaughany/e4c724571bcbddf71c62253d4e264266 to your computer and use it in GitHub Desktop.

Select an option

Save vaughany/e4c724571bcbddf71c62253d4e264266 to your computer and use it in GitHub Desktop.
Pulls memory stats from servers at IP addresses of your choice.
#!/bin/bash
IPS="10.10.10.10 10.10.10.11 10.10.10.12"
for s in $IPS; do
echo -en "\n\e[7;49m $s - " && echo -n $(ssh -q -F /dev/null $s "hostname") && echo -e ": \e[0m"
RESULT=$(ssh -q -F /dev/null $s "lsb_release -r")
if [[ $RESULT = *"14.04"* ]]
then
ssh -q -F /dev/null $s "free -h"
else
ssh -q -F /dev/null $s "free -w -h"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment