arachnys / cabot

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

the most_severe method of CheckGroupMixin, is there a problem? #593

Open forcemain opened 6 years ago

forcemain commented 6 years ago
class CheckGroupMixin(models.Model):
    .........................................................................
    def most_severe(self, check_list):
        failures = [c.importance for c in check_list]
        if self.CRITICAL_STATUS in failures:
            return self.CRITICAL_STATUS
        if self.ERROR_STATUS in failures:
            return self.ERROR_STATUS
        if self.WARNING_STATUS in failures:
            return self.WARNING_STATUS
        return self.PASSING_STATUS
    ...........................................................................

with the active and not passing status checks for update_services or update_instances may be like this in most_severe methid:

failures = [c.calculated_status for c in check_list]

you want the more serious status as the service or instance status, not it ?

dbuxton commented 6 years ago

Sorry I've tried reading this a few times and I'm not sure what you mean. Can you clarify?

forcemain commented 6 years ago

I mean to say, why not use failures = [c.importance for c in check_list] Instead of failures = [c.calculated_status for c in check_list]

the most_severe method should return the most serious calculated_status in service/instance ? not it?