Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a04cff4

Browse files
author
MF Softworks
committed
[script] added uuid for duplicate hostnames
1 parent 80847b2 commit a04cff4

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

‎.vscode/settings.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"python.pythonPath": "C:\\Users\\arranf\\AppData\\Local\\Programs\\Python\\Python37-32\\python.exe"
2+
"python.pythonPath": "C:\\Users\\arranf\\AppData\\Local\\Programs\\Python\\Python37-32\\python.exe",
3+
"python.linting.pylintEnabled": true
34
}

‎monitor.py‎

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import socket, time, json, datetime, platform, psutil, requests, pprint
1+
import socket, time, json, datetime, platform, psutil, requests, pprint, uuid
22

33
def main():
44
# Hostname Info
@@ -8,16 +8,14 @@ def main():
88
# CPU Info
99
cpu_count = psutil.cpu_count()
1010
cpu_usage = psutil.cpu_percent(interval=1)
11-
print("CPU:")
12-
print("Count:", cpu_count, "Usage:", cpu_usage)
11+
print("CPU:\n\tCount:", cpu_count, "\n\tUsage:", cpu_usage)
1312

1413
# Memory Info
1514
memory_stats = psutil.virtual_memory()
1615
memory_total = memory_stats.total
1716
memory_used = memory_stats.used
1817
memory_used_percent = memory_stats.percent
19-
print("Memory:")
20-
print("Percent:", memory_used_percent, "\tTotal:", memory_total / 1e+6, "MB", "\tUsed:", memory_used / 1e+6, "MB")
18+
print("Memory:\n\tPercent:", memory_used_percent, "\n\tTotal:", memory_total / 1e+6, "MB", "\n\tUsed:", memory_used / 1e+6, "MB")
2119

2220
# Disk Info
2321
disk_info = psutil.disk_partitions()
@@ -35,30 +33,31 @@ def main():
3533

3634
disks.append(disk)
3735

38-
print("Disk name",disk["name"], "\tMount Point:", disk["mount_point"], "\tType",disk["type"], "\tSize:", disk["total_size"] / 1e+9,"\tUsage:", disk["used_size"] / 1e+9, "\tPercent Used:", disk["percent_used"])
36+
print("\tDisk name",disk["name"], "\tMount Point:", disk["mount_point"], "\tType",disk["type"], "\tSize:", disk["total_size"] / 1e+9,"\tUsage:", disk["used_size"] / 1e+9, "\tPercent Used:", disk["percent_used"])
3937

4038
# Network Info
41-
print("Network:")
4239
network_stats = get_bandwidth()
43-
print("Traffic in:",network_stats["traffic_in"] / 1e+6,"\tTraffic out:",network_stats["traffic_out"] / 1e+6)
40+
print("Network:\n\tTraffic in:",network_stats["traffic_in"] / 1e+6,"\n\tTraffic out:",network_stats["traffic_out"] / 1e+6)
4441

4542
# Platform Info
46-
print("OS:")
4743
system = {
4844
"name" : platform.system(),
4945
"version" : platform.release()
5046
}
51-
print(system["name"],system["version"])
47+
print("OS:\n\t",system["name"],system["version"])
5248

5349
# Time Info
5450
timestamp = datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S")
5551
uptime = int(time.time() - psutil.boot_time())
56-
print("System Uptime:")
57-
print(uptime)
52+
print("System Uptime:\n\t",uptime)
5853

54+
# System UUID
55+
sys_uuid = uuid.getnode()
56+
5957
# Set Machine Info
6058
machine = {
6159
"hostname" : hostname,
60+
"uuid" : sys_uuid,
6261
"system" : system,
6362
"uptime" : uptime,
6463
"cpu_count" : cpu_count,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /