Skip to content

Commit

Permalink
[chores] Log non-zero exit code warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Aryamanz29 committed Jun 24, 2022
1 parent 07aa783 commit 1d94482
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion openwisp_monitoring/check/classes/iperf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def check(self, store=True):
f'DeviceConnection is not properly set for "{device}", iperf check skipped!'
)
return
device_connection.connect()
# The DeviceConnection could fail if the management tunnel is down.
if not device_connection.connect():
logger.warning(
Expand All @@ -40,6 +39,9 @@ def check(self, store=True):
command, raise_unexpected_exit=False
)
if store and exit_code != 0:
logger.warning(
f'Iperf check failed for "{device}", {json.loads(res)["error"]}'
)
self.store_result_fail()
device_connection.disconnect()
return
Expand All @@ -51,6 +53,9 @@ def check(self, store=True):
command, raise_unexpected_exit=False
)
if store and exit_code != 0:
logger.warning(
f'Iperf check failed for "{device}", {json.loads(res)["error"]}'
)
self.store_result_fail()
device_connection.disconnect()
return
Expand Down
4 changes: 2 additions & 2 deletions openwisp_monitoring/monitoring/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,11 +582,11 @@ def _get_access_tech():
'total': 'lines',
},
'trace_order': ['total', 'received', 'sent'],
'description': _('Total transfer during Iperf3 test in TCP mode.'),
'description': _('Transfer during Iperf3 test in TCP mode.'),
'summary_labels': [
_('Total bytes'),
_('Received bytes'),
_('Sent bytes'),
_('Total upload traffic'),
],
'unit': _(' GB'),
'order': 290,
Expand Down

0 comments on commit 1d94482

Please sign in to comment.