updog-checker_template/checker_template.py
2024-01-29 11:34:31 -06:00

18 lines
456 B
Python

import random
class CheckerTemplate:
def __init__(arguments):
pass
def get_status():
latency = int(random.random() * 3000)
if latency > 2500: # "simulate" a timeout
return 0
elif latency > 1000: # "simulate" a very slow application - a partial outage
return 50
else:
return 100
def get_return_codes():
return {0: "Down", 50: "Partial outage", 100: "Up"}