You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: monitor.py
+28-16
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,16 @@
1
-
importsocket, time, json, datetime, platform, psutil, requests, pprint, uuid
1
+
importargparse, socket, time, json, datetime, platform, psutil, requests, pprint, uuid
2
+
3
+
# parse args
4
+
parser=argparse.ArgumentParser(description='Monitoring script to send system info to a tracking server')
5
+
parser.add_argument('-d', '--dest', default='http://localhost:8080/', help='API Endpoint for Monitoring Data (Defaults to http://localhost:8080/)')
6
+
parser.add_argument('-i', '--interval', default=5, type=int, help='Interval between checks (Seconds. Defaults to 5 seconds)')
7
+
parser.add_argument('-a', '--attempts', default=30, type=int, help='Attempts to send data when sending failes (Defaults to 30)')
8
+
parser.add_argument('-t', '--timeout', default=60, type=int, help='Timeout between resend attempts (Seconds. Defaults to 60. If attempts is reached script will die)')
9
+
args=parser.parse_args()
10
+
11
+
# Factor in sleep for bandwidth checking
12
+
ifargs.interval>=2:
13
+
args.interval-=2
2
14
3
15
defmain():
4
16
# Hostname Info
@@ -25,11 +37,11 @@ def main():
25
37
# Try fixes issues with connected 'disk' such as CD-ROMS, Phones, etc.
0 commit comments