Skip to content

Commit 2b75830

Browse files
author
mfsoftworks
committed
[script] added system uptime
1 parent 6c62e29 commit 2b75830

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Example:
2525
"name": "Windows",
2626
"version": "10"
2727
},
28+
"uptime" : 231199,
2829
"cpu_count": 4,
2930
"cpu_usage": 17.9,
3031
"memory_total": 8440942592,

monitor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,15 @@ def main():
5252

5353
# Time Info
5454
timestamp = datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S")
55+
uptime = int(time.time() - psutil.boot_time())
56+
print("System Uptime:")
57+
print(uptime)
5558

5659
## Set Machine Info
5760
machine = {
5861
"hostname" : hostname,
5962
"system" : system,
63+
"uptime" : uptime,
6064
"cpu_count" : cpu_count,
6165
"cpu_usage" : cpu_usage,
6266
"memory_total" : memory_total,

0 commit comments

Comments
 (0)