Last active
January 25, 2016 16:20
-
-
Save richardsonlima/12e0f5b812e5cc9ca368 to your computer and use it in GitHub Desktop.
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/env bash | |
# Created by Richardson Lima - contatorichardsonlima at gmail dot com | |
# set -x | |
Timeout='15' | |
VlanHosts="/home/user/SrvList/VlanID01" # File that contains Servers ipaddr | |
User='' # SSH User | |
Port='' # SSH port | |
function CreateCollect(){ | |
cat << EOF > ./Collector.sh | |
echo | |
echo -e "\033[1;34m [*] Checando informações gerais do sistema \033[m"; | |
echo -e "\033[1;32m [+] Sistema Operacional: \033[m" $(python -c 'import platform; print platform.system()' ) | |
echo -e "\033[1;32m [+] Nome do host: \033[m" $(python -c 'import socket; print socket.gethostname()' ) | |
echo -e "\033[1;32m [+] Distribuição: \033[m" $(python -c 'import platform; print platform.dist()' ) | |
echo -e "\033[1;32m [+] Versão/Kernel: \033[m" $(python -c 'import platform; print platform.release()' ) | |
echo -e "\033[1;32m [+] Arquitetura: \033[m" $(python -c 'import platform; print platform.machine()' ) | |
echo -e "\033[1;32m [+] Identificador do servidor: \033[m" $(python -c 'import os; os.system("sudo dmidecode -s system-uuid")') | |
echo | |
EOF | |
chmod +x ./Collector.sh | |
} | |
function main(){ | |
cat $VlanHots | while read servers; # Homage to my Bro "AlêniUs" | |
#for servers in $(cat $VlanHots); | |
do \ | |
echo -e '\033[1;32m [+] Server: \033[0m'$servers && \ | |
echo -e '\033[1;32m [+] Port: \033[0m'$Port && \ | |
echo -e '\033[1;32m [+] TimeOut [seconds]: \033[0m'$Timeout && echo '' && \ | |
ssh -T -o ConnectTimeout=$Timeout -p $Port $User@$servers < ./Collector.sh; | |
echo ''; | |
done | |
} | |
### | |
CreateCollect | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment