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 1fb6978

Browse files
author
MF Softworks
committed
[script] updated script post to server
1 parent 62ede15 commit 1fb6978

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

‎README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
The Python script is designed to be run as a cronjob on every boot to run in the background.
99
The script will gather information:
1010

11+
- UUID (Unique for each system to avoid overlapping hostname for multi-network monitoring)
12+
- Hostname
1113
- CPU
1214
- Memory
1315
- Network
@@ -52,11 +54,12 @@ Example:
5254
],
5355
"network_up": 54,
5456
"network_down": 4150,
55-
"timestamp" : "2018年10月10日 01:41:21"
57+
"timestamp" : "2018年10月10日T01:41:21+00:00",
58+
"uuid" : 180331603484325
5659
}
5760
```
5861

59-
The script includes a function to send JSON to a remote server.
62+
The script includes a function to POST JSON to a remote server.
6063

6164
This script can be installed on several machines that report to a central monitoring server.
6265

‎monitor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ def send_data(data):
108108
try:
109109
# endpoint = monitoring server
110110
endpoint = "http://monitor.localhost.local/api/"
111-
response = requests.get(url = endpoint, params = {"data" : data})
112-
print("\nGET:")
111+
response = requests.post(url = endpoint, params = {"data" : data})
112+
print("\nPOST:")
113113
print("Response:", response.status_code)
114114
print("Headers:")
115115
pprint.pprint(response.headers)
@@ -122,7 +122,7 @@ def send_data(data):
122122
print("No JSON content")
123123
break
124124
except requests.exceptions.RequestException as e:
125-
print("\nGET Error:\n",e)
125+
print("\POST Error:\n",e)
126126
# Sleep 1 minute before retrying
127127
time.sleep(60)
128128
else:

0 commit comments

Comments
(0)

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