openwisp-monitoring
openwisp-monitoring copied to clipboard
[change] Configure celery beat for Iperf check
-
We need to configure celery beat for Iperf check so that it can be run at a scheduled time.
-
Using celery crontab schedules we can configure check task to run on specific time, It also covers most of the time variations for scheduling celery tasks.
# Ex.
# Task schedule for 5 AM and 12 PM
@periodic_task(run_every=crontab(minute=0, hour='5,12'))
- Using celery crontab schedules we can configure check task to run on specific time, It also covers most of the time variations for scheduling celery tasks.
The celery beat is configured at the project level in settings.py. We only need to configure the celery beat in the tests/openwisp2/settings.py for this issue. Later, we will port this change to ansible-openiwsp2 and docker-openwisp.
https://github.com/openwisp/openwisp-monitoring/blob/872f7db21f36325ed417307e0fec9446ed6d59d7/tests/openwisp2/settings.py#L170-L177
Don't hard code the time in the celery task
The celery beat is configured at the project level in settings.py. We only need to configure the celery beat in the
tests/openwisp2/settings.pyfor this issue. Later, we will port this change toansible-openiwsp2anddocker-openwisp.
People who don't use ansible-openwisp2 or docker-openwisp can still configure celery-beat in their settings.py, right?
People who don't use ansible-openwisp2 or docker-openwisp can still configure celery-beat in their settings.py, right?
Yes. It is just another Django settings. 😄
Let's keep in mind that by default we should recommend to run this at night or during non peak traffic times to not interfere with work or standard traffic.
Ok so we need to be able to pass a list of checks to exclude and include right? So we can have the 5 minutes check perform anything except iperf and we can configure another entry only for iperf which runs at other intervals.