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 015baec

Browse files
author
mfsoftworks
committed
[script] added monitor.py initial script
1 parent a30c9bd commit 015baec

File tree

3 files changed

+103
-0
lines changed

3 files changed

+103
-0
lines changed

‎.vscode/launch.json‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python: Current File (Integrated Terminal)",
9+
"type": "python",
10+
"request": "launch",
11+
"program": "${file}",
12+
"console": "integratedTerminal"
13+
},
14+
{
15+
"name": "Python: Attach",
16+
"type": "python",
17+
"request": "attach",
18+
"port": 5678,
19+
"host": "localhost"
20+
},
21+
{
22+
"name": "Python: Django",
23+
"type": "python",
24+
"request": "launch",
25+
"program": "${workspaceFolder}/manage.py",
26+
"console": "integratedTerminal",
27+
"args": [
28+
"runserver",
29+
"--noreload",
30+
"--nothreading"
31+
],
32+
"django": true
33+
},
34+
{
35+
"name": "Python: Flask",
36+
"type": "python",
37+
"request": "launch",
38+
"module": "flask",
39+
"env": {
40+
"FLASK_APP": "app.py"
41+
},
42+
"args": [
43+
"run",
44+
"--no-debugger",
45+
"--no-reload"
46+
],
47+
"jinja": true
48+
},
49+
{
50+
"name": "Python: Current File (External Terminal)",
51+
"type": "python",
52+
"request": "launch",
53+
"program": "${file}",
54+
"console": "externalTerminal"
55+
}
56+
]
57+
}

‎format.json‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"hostname" : "name",
3+
"drives" : [
4+
"drive1" : {
5+
"name" : "name",
6+
"total_space" : "size",
7+
"used_space" : "size"
8+
},
9+
"drive2" : {
10+
"name" : "name",
11+
"total_space" : "size",
12+
"used_space" : "size"
13+
}
14+
],
15+
"cpu_count" : "cpu_count",
16+
"cpu_usage" : "cpu",
17+
"memory_total" : "size",
18+
"memory_free" : "size",
19+
"network_up" : "transfer_rate",
20+
"network_down" : "transfer_rate"
21+
}

‎monitor.py‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import socket, psutil
2+
3+
# Hostname Info
4+
hostname = socket.gethostname()
5+
print("Hostname", hostname)
6+
7+
# CPU Info
8+
cpu_count = psutil.cpu_count()
9+
cpu_usage = psutil.cpu_percent(interval=1)
10+
print("CPU:")
11+
print("Count", cpu_count, "Usage", cpu_usage)
12+
memory_stats = psutil.virtual_memory()
13+
14+
# Memory Info
15+
memory_total = memory_stats.total/1e+6
16+
memory_used = memory_stats.used/1e+6
17+
memory_used_percent = memory_stats.percent
18+
print("Memory:")
19+
print("Percent:", memory_used_percent, "\tTotal:", "%.2f" % memory_total, "MB", "\tUsed:", "%.2f" % memory_used, "MB")
20+
21+
# Disk Info
22+
disk_info = psutil.disk_partitions()
23+
print("Disks:")
24+
for disk in disk_info:
25+
print("Disk name",disk.device,"\tMount Point:",disk.mountpoint,"\tType",disk.fstype,"\tSize:",psutil.disk_usage(disk.mountpoint).total,"\tUsage:",psutil.disk_usage(disk.mountpoint))

0 commit comments

Comments
(0)

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