ET Pro Telemetry: exit 0 if data not of interest, extend readme a bit while here. closes https://github.com/opnsense/plugins/issues/1642

This commit is contained in:
Ad Schellevis 2019-12-29 11:50:44 +01:00
parent 45ecf26751
commit 60b2a8512b
2 changed files with 7 additions and 2 deletions

View file

@ -1,6 +1,6 @@
# ETPRO telemetry edition
Telemetry tools, depends on `rule-updater.config`, which contains the device registartion number provided by OPNsense.
Telemetry tools, depends on `rule-updater.config`, which contains the device registration number provided by OPNsense.
for example.
```
@ -48,6 +48,7 @@ optional arguments:
-s STATE, --state STATE
persistent state (and lock) filename
-d DAYS, --days DAYS Maximum number of days to look back on initial run
-D, --direct do not sleep before send (disable traffic spread)
```
to test using supplied configuration:
@ -74,6 +75,8 @@ optional arguments:
-i, --insecure Insecure, skip certificate validation
-c CONFIG, --config CONFIG
rule downloader configuration
-D, --direct do not sleep before send (disable traffic spread)
-t, --test test mode, output request/response to stdout
```

View file

@ -86,6 +86,9 @@ if not telemetry_state.is_running():
# spread traffic to remote host, usual cron interval is 1 minute
if not args.direct:
time.sleep(random.randint(0, 60))
# the eventcollector loop sets exit_code when issues ocure, no data processed doesn't mean
# anything is wrong (it's just not of interest to Proofpoint).
exit_code = 0
for push_data in event_collector:
params = {
'timeout': 5,
@ -106,7 +109,6 @@ if not telemetry_state.is_running():
else:
try:
ujson.loads(r.text)
exit_code = 0
except ValueError:
syslog.syslog(syslog.LOG_ERR, 'telemetry unexpected response %s' % r.text[:256])
exit_code = -1