1
- import socket , time , json , datetime , platform , psutil , requests , pprint
1
+ import socket , time , json , datetime , platform , psutil , requests , pprint , uuid
2
2
3
3
def main ():
4
4
# Hostname Info
@@ -8,16 +8,14 @@ def main():
8
8
# CPU Info
9
9
cpu_count = psutil .cpu_count ()
10
10
cpu_usage = psutil .cpu_percent (interval = 1 )
11
- print ("CPU:" )
12
- print ("Count:" , cpu_count , "Usage:" , cpu_usage )
11
+ print ("CPU:\n \t Count:" , cpu_count , "\n \t Usage:" , cpu_usage )
13
12
14
13
# Memory Info
15
14
memory_stats = psutil .virtual_memory ()
16
15
memory_total = memory_stats .total
17
16
memory_used = memory_stats .used
18
17
memory_used_percent = memory_stats .percent
19
- print ("Memory:" )
20
- print ("Percent:" , memory_used_percent , "\t Total:" , memory_total / 1e+6 , "MB" , "\t Used:" , memory_used / 1e+6 , "MB" )
18
+ print ("Memory:\n \t Percent:" , memory_used_percent , "\n \t Total:" , memory_total / 1e+6 , "MB" , "\n \t Used:" , memory_used / 1e+6 , "MB" )
21
19
22
20
# Disk Info
23
21
disk_info = psutil .disk_partitions ()
@@ -35,30 +33,31 @@ def main():
35
33
36
34
disks .append (disk )
37
35
38
- print ("Disk name" ,disk ["name" ], "\t Mount Point:" , disk ["mount_point" ], "\t Type" ,disk ["type" ], "\t Size:" , disk ["total_size" ] / 1e+9 ,"\t Usage:" , disk ["used_size" ] / 1e+9 , "\t Percent Used:" , disk ["percent_used" ])
36
+ print ("\t Disk name" ,disk ["name" ], "\t Mount Point:" , disk ["mount_point" ], "\t Type" ,disk ["type" ], "\t Size:" , disk ["total_size" ] / 1e+9 ,"\t Usage:" , disk ["used_size" ] / 1e+9 , "\t Percent Used:" , disk ["percent_used" ])
39
37
40
38
# Network Info
41
- print ("Network:" )
42
39
network_stats = get_bandwidth ()
43
- print ("Traffic in:" ,network_stats ["traffic_in" ] / 1e+6 ,"\t Traffic out:" ,network_stats ["traffic_out" ] / 1e+6 )
40
+ print ("Network: \n \t Traffic in:" ,network_stats ["traffic_in" ] / 1e+6 ,"\n \t Traffic out:" ,network_stats ["traffic_out" ] / 1e+6 )
44
41
45
42
# Platform Info
46
- print ("OS:" )
47
43
system = {
48
44
"name" : platform .system (),
49
45
"version" : platform .release ()
50
46
}
51
- print (system ["name" ],system ["version" ])
47
+ print ("OS: \n \t " , system ["name" ],system ["version" ])
52
48
53
49
# Time Info
54
50
timestamp = datetime .datetime .utcnow ().strftime ("%Y-%m-%d %H:%M:%S" )
55
51
uptime = int (time .time () - psutil .boot_time ())
56
- print ("System Uptime:" )
57
- print (uptime )
52
+ print ("System Uptime:\n \t " ,uptime )
58
53
54
+ # System UUID
55
+ sys_uuid = uuid .getnode ()
56
+
59
57
# Set Machine Info
60
58
machine = {
61
59
"hostname" : hostname ,
60
+ "uuid" : sys_uuid ,
62
61
"system" : system ,
63
62
"uptime" : uptime ,
64
63
"cpu_count" : cpu_count ,
0 commit comments