arachnys / cabot

Self-hosted, easily-deployable monitoring and alerts service - like a lightweight PagerDuty
MIT License
5.59k stars 593 forks source link

http-check frequency < 1 #641

Closed philipp-winterle closed 3 years ago

philipp-winterle commented 5 years ago

I tried to find the code line for the specific part but wasn't successful. Is there any possiblity to have a http-check frequency below 1 minute? Something like 0.5 would be nice. But the form won't allow it.

I would change the code on my own and make a pr if needed but I can't find any point to start at.

hazzadous commented 5 years ago

The issue here is that the frequency is stored as an integer representing the number of minutes between checks, see https://github.com/arachnys/cabot/blob/master/cabot/cabotapp/models/base.py#L428

I'd suggest starting from there, you'd probably want to change this to represent seconds instead of minutes or using https://docs.djangoproject.com/en/1.11/ref/models/fields/#django.db.models.DurationField instead.

JeanFred commented 5 years ago

The relevant code for the scheduling should work just fine with minutes=0.5: https://github.com/arachnys/cabot/blob/4e4ca0a8b6d08b40007e84a9e61160873000f6f5/cabot/cabotapp/tasks.py#L31

The form won’t allow 0.5 though because it is defined as an IntegerField https://github.com/arachnys/cabot/blob/4e4ca0a8b6d08b40007e84a9e61160873000f6f5/cabot/cabotapp/models/base.py#L428-L431

I assume that changing that to eg a DecimalField would require a database migration?

(In general, I’m not sure this would actually have the desired effect − the way tasks are scheduled (using Celery), I’m not sure it can be guaranteed to run that often reliably.)

philipp-winterle commented 5 years ago

Thank you for your input. Will try to get this problem solved and provide pr - or will fail hardly

vijaytejak commented 3 years ago

hey hummel, did you try changing the frequency?

I am also looking for this solution, I wanted it to be in seconds.

philipp-winterle commented 3 years ago

@vijaytejak sorry. Yes I did solve the problem but we moved away from cabot due to no maintenance anymore. I don't have anything to provide left. sry