diff --git a/openwisp_monitoring/check/classes/iperf.py b/openwisp_monitoring/check/classes/iperf.py index b9797e905..5c10a45c4 100644 --- a/openwisp_monitoring/check/classes/iperf.py +++ b/openwisp_monitoring/check/classes/iperf.py @@ -26,6 +26,12 @@ def check(self, store=True): logger.warning(f'{device}: connection not properly set, Iperf skipped!') return device_connection.connect() + # We need to check device_connection is_working just right after connect(). + # because it may be possible that authentication (publickey) failed. + # or any other failure happened during connect(). + if not device_connection.is_working: + logger.warning(f'{device}: SSH connection is not working, Iperf skipped!') + return servers = self._get_iperf_servers(device.organization.id) command = f'iperf3 -c {servers[0]} -J' res, exit_code = device_connection.connector_instance.exec_command( diff --git a/tests/openwisp2/settings.py b/tests/openwisp2/settings.py index 636e9f7e1..d9d1c0941 100644 --- a/tests/openwisp2/settings.py +++ b/tests/openwisp2/settings.py @@ -170,7 +170,7 @@ CELERY_BEAT_SCHEDULE = { 'run_checks': { 'task': 'openwisp_monitoring.check.tasks.run_checks', - 'schedule': timedelta(minutes=5), + 'schedule': timedelta(minutes=1), 'args': None, 'relative': True, } @@ -274,7 +274,8 @@ # Running on my local # Some Public Iperf Servers : https://iperf.fr/iperf-servers.php#public-servers # 'be63c4e5-a68a-4650-bfe8-733837edb8be': ['iperf.biznetnetworks.com'], - 'a9734710-db30-46b0-a2fc-01f01046fe4f': ['speedtest.uztelecom.uz'], + # 'a9734710-db30-46b0-a2fc-01f01046fe4f': ['speedtest.uztelecom.uz'], + 'a9734710-db30-46b0-a2fc-01f01046fe4f': ['192.168.5.109'], # '': [''] }