Skip to content

Instantly share code, notes, and snippets.

@jerius
Created October 17, 2011 19:22
Show Gist options
  • Select an option

  • Save jerius/1293507 to your computer and use it in GitHub Desktop.

Select an option

Save jerius/1293507 to your computer and use it in GitHub Desktop.
1 from fabric.api import run, env, get
2
3 def target_server():
4 ip = raw_input("IP Address: ")
5 port = raw_input("Port: ")
6 password = raw_input("Password: ")
7 env.host_string = ("root@%s:%s") % (ip, port)
8 env.password = password
9
10 def server_info_download():
11 file = "/root/server_info.txt"
12 run("uname -a >> %s" % file)
13 run("free -mt|grep Mem|awk '{print $2}' >> %s" % file)
14 run("cat /proc/cpuinfo|grep 'model name'|head -1|cut -d ':' -f2|sed -e 's/.//' >> %s" % file)
15 run("dmidecode -t memory|grep Maximum|head -1 >> %s" % file)
16 get("%s" % file)
17 run("rm -f %s" % file)
18
19 def get_target_server_info():
20 target_server()
21 server_info_download()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment