Skip to content

Instantly share code, notes, and snippets.

@acsrujan
Last active September 2, 2016 06:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acsrujan/8c4f59fcad1620ae8a16 to your computer and use it in GitHub Desktop.
Save acsrujan/8c4f59fcad1620ae8a16 to your computer and use it in GitHub Desktop.
import platform
import os
import multiprocessing
os_name = platform.system()
print ("os_name:"+os_name)
os_version = platform.version()
print ("os_version:"+os_version)
cpu_architecture = platform.architecture()[0]
print ("cpu_arch:"+cpu_architecture)
cpu_number_of_cores = multiprocessing.cpu_count()
print ("num_of_cores:"+str(cpu_number_of_cores))
cpu_name = os.popen('wmic cpu get name').read()
print ("cpu_name:"+str(cpu_name))
cpu_load = os.popen('wmic cpu get loadpercentage').read()
print ("cpu_load:"+str(cpu_load))
total_memory = os.popen('wmic ComputerSystem get TotalPhysicalMemory').read()
free_physical_memory = os.popen('wmic os get freephysicalmemory').read()
free_virtual_memory = os.popen('wmic os get freevirtualmemory').read()
print ("free phy mem:"+str(free_physical_memory))
print ("free vir mem:"+str(free_virtual_memory))
print ("total mem:"+str(total_memory))
number_of_processes_running = os.popen('wmic process get caption|wc -l').read()
print ("num of processes:"+str("number_of_processes_running"))
import socket
network_address_ipv4 = socket.gethostbyname(socket.getfqdn())
print ("ipv4:"+str(network_address_ipv4))
from uuid import getnode
network_address_physical = getnode()
print ("phy network add:"+str(network_address_physical))
number_of_bytes = os.popen('netstat -s').read()
#parse number of bytes
#number_of_bytes_in = number_of_bytes['Received']
#number_of_bytes_out = number_of_bytes['Sent']
#in and number of bytes (per second) out for the same network interface
# number of bytes in and number of bytes (per second) out for the same network interface is pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment