Skip to content

Commit 0da38bd

Browse files
author
Konstantin Wolff
committed
Added support for internal QA
1 parent d4011dc commit 0da38bd

File tree

5 files changed

+26
-37
lines changed

5 files changed

+26
-37
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ This will enable detailed logging to folder "logs" which is as sub folder of the
5353

5454
Changelog
5555
=========
56+
10-03-2015
57+
----------
58+
- Added support for internal QA
59+
5660
24-02-2015
5761
----------
5862
- Added support for multiprocessing, now sensors are spawned as subprocesses (merged branch experimental with master)

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
15.1.3
1+
15.1.5

miniprobe.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
import requests
4242
except Exception as e:
4343
print e
44-
#sys.exit()
44+
# sys.exit()
4545

4646

4747
class MiniProbe(object):
@@ -53,7 +53,7 @@ def __init__(self):
5353
logging.basicConfig(
5454
filename="./logs/probe.log",
5555
filemode="a",
56-
# level=logging.DEBUG,
56+
# level=logging.DEBUG,
5757
level=logging.INFO,
5858
format="%(asctime)s - %(levelname)s - %(message)s",
5959
datefmt='%m/%d/%Y %H:%M:%S'
@@ -116,17 +116,21 @@ def create_parameters(self, config, jsondata, i=None):
116116
else:
117117
return {'gid': config['gid'], 'key': self.hash_access_key(config['key']), 'protocol': config['protocol']}
118118

119-
def create_url(self, config, i=None):
119+
def create_url(self, config, i=None, http=False):
120120
"""
121121
creating the actual URL
122122
"""
123+
prefix = "https"
124+
if http:
125+
prefix = "http"
126+
123127
if not (i is None) and (i != "data"):
124-
return "https://%s:%s/probe/%s" % (
125-
config['server'], config['port'], i)
128+
return "%s://%s:%s/probe/%s" % (
129+
prefix, config['server'], config['port'], i)
126130
elif i == "data":
127-
return "https://%s:%s/probe/%s?gid=%s&protocol=%s&key=%s" % (config['server'], config['port'], i,
128-
config['gid'], config['protocol'],
129-
self.hash_access_key(config['key']))
131+
return "%s://%s:%s/probe/%s?gid=%s&protocol=%s&key=%s" % (prefix, config['server'], config['port'], i,
132+
config['gid'], config['protocol'],
133+
self.hash_access_key(config['key']))
130134
pass
131135
else:
132136
return "No method given"

probe.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@
4646
print e
4747
#sys.exit()
4848

49+
# Implemented for internal testing only. Not for public usage!
50+
http = False
51+
if sys.argv[1:] and sys.argv[1] == "http":
52+
http = True
53+
54+
4955
def main():
5056
"""
5157
Main routine for MiniProbe (Python)
@@ -75,7 +81,7 @@ def main():
7581
sensor_list = mini_probe.get_import_sensors()
7682
sensor_announce = mini_probe.build_announce(sensor_list)
7783
announce_json = json.dumps(sensor_announce)
78-
url_announce = mini_probe.create_url(config, 'announce')
84+
url_announce = mini_probe.create_url(config, 'announce', http)
7985
data_announce = mini_probe.create_parameters(config, announce_json, 'announce')
8086

8187
while not announce:
@@ -99,7 +105,7 @@ def main():
99105

100106
while not probe_stop:
101107
# creating some objects only needed in loop
102-
url_task = mini_probe.create_url(config, 'tasks')
108+
url_task = mini_probe.create_url(config, 'tasks', http)
103109
task_data = {
104110
'gid': config['gid'],
105111
'protocol': config['protocol'],
@@ -157,7 +163,7 @@ def main():
157163
logging.error(e)
158164
pass
159165

160-
url_data = mini_probe.create_url(config, 'data')
166+
url_data = mini_probe.create_url(config, 'data', http)
161167
try:
162168
request_data = requests.post(url_data, data=json.dumps(json_payload_data), verify=False)
163169
logging.info("DATA request successfully sent to PRTG Core Server at %s:%s."

scheduler.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)