Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Closes #385
Closes #390
Closes #398
Closes #399
Closes #405
Closes #412
Closes #406
Closes #414
Closes #417
Closes #418
Closes #422

Co-authored-by: Federico Capoano <[email protected]>
  • Loading branch information
Aryamanz29 and nemesifier committed Aug 9, 2022
1 parent e563520 commit dc0316a
Show file tree
Hide file tree
Showing 20 changed files with 2,633 additions and 43 deletions.
361 changes: 356 additions & 5 deletions README.rst

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions openwisp_monitoring/check/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,11 @@ def _connect_signals(self):
sender=load_model('config', 'Device'),
dispatch_uid='auto_config_check',
)
if app_settings.AUTO_IPERF:
from .base.models import auto_iperf_check_receiver

post_save.connect(
auto_iperf_check_receiver,
sender=load_model('config', 'Device'),
dispatch_uid='auto_iperf_check',
)
24 changes: 23 additions & 1 deletion openwisp_monitoring/check/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
from jsonfield import JSONField

from openwisp_monitoring.check import settings as app_settings
from openwisp_monitoring.check.tasks import auto_create_config_check, auto_create_ping
from openwisp_monitoring.check.tasks import (
auto_create_config_check,
auto_create_iperf_check,
auto_create_ping,
)
from openwisp_utils.base import TimeStampedEditableModel

from ...utils import transaction_on_commit
Expand Down Expand Up @@ -116,3 +120,21 @@ def auto_config_check_receiver(sender, instance, created, **kwargs):
object_id=str(instance.pk),
)
)


def auto_iperf_check_receiver(sender, instance, created, **kwargs):
"""
Implements OPENWISP_MONITORING_AUTO_IPERF
The creation step is executed in the background
"""
# we need to skip this otherwise this task will be executed
# every time the configuration is requested via checksum
if not created:
return
transaction_on_commit(
lambda: auto_create_iperf_check.delay(
model=sender.__name__.lower(),
app_label=sender._meta.app_label,
object_id=str(instance.pk),
)
)
1 change: 1 addition & 0 deletions openwisp_monitoring/check/classes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from .config_applied import ConfigApplied # noqa
from .iperf import Iperf # noqa
from .ping import Ping # noqa
Loading

0 comments on commit dc0316a

Please sign in to comment.