openwisp-monitoring icon indicating copy to clipboard operation
openwisp-monitoring copied to clipboard

[change] Configure celery beat for Iperf check

Open Aryamanz29 opened this issue 3 years ago • 5 comments
trafficstars

  • 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'))

Aryamanz29 avatar Jun 02 '22 09:06 Aryamanz29

  • 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

pandafy avatar Jun 03 '22 18:06 pandafy

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.

People who don't use ansible-openwisp2 or docker-openwisp can still configure celery-beat in their settings.py, right?

okraits avatar Jun 03 '22 21:06 okraits

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. 😄

pandafy avatar Jun 04 '22 09:06 pandafy

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.

nemesifier avatar Jun 08 '22 16:06 nemesifier

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.

nemesifier avatar Jul 07 '22 14:07 nemesifier