|
@ -307,7 +307,7 @@ class Check(models.Model): |
|
|
ping.exitstatus = exitstatus |
|
|
ping.exitstatus = exitstatus |
|
|
ping.save() |
|
|
ping.save() |
|
|
|
|
|
|
|
|
def downtimes(self, months=2): |
|
|
|
|
|
|
|
|
def downtimes(self, months): |
|
|
""" Calculate the number of downtimes and downtime minutes per month. |
|
|
""" Calculate the number of downtimes and downtime minutes per month. |
|
|
|
|
|
|
|
|
Returns a list of (datetime, downtime_in_secs, number_of_outages) tuples. |
|
|
Returns a list of (datetime, downtime_in_secs, number_of_outages) tuples. |
|
@ -351,6 +351,11 @@ class Check(models.Model): |
|
|
|
|
|
|
|
|
return sorted(totals.values()) |
|
|
return sorted(totals.values()) |
|
|
|
|
|
|
|
|
|
|
|
def past_downtimes(self): |
|
|
|
|
|
""" Return downtime summary for two previous months. """ |
|
|
|
|
|
|
|
|
|
|
|
return self.downtimes(3)[:-1] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Ping(models.Model): |
|
|
class Ping(models.Model): |
|
|
id = models.BigAutoField(primary_key=True) |
|
|
id = models.BigAutoField(primary_key=True) |
|
|