From 4cafe56c97800bbcaa6ca53215d4028ad90c8354 Mon Sep 17 00:00:00 2001 From: askiiart Date: Mon, 29 Jan 2024 11:34:31 -0600 Subject: [PATCH] Initial commit --- checker_template.py | 18 ++++++++++++++++++ readme.md | 3 +++ 2 files changed, 21 insertions(+) create mode 100644 checker_template.py create mode 100644 readme.md diff --git a/checker_template.py b/checker_template.py new file mode 100644 index 0000000..b43c5d3 --- /dev/null +++ b/checker_template.py @@ -0,0 +1,18 @@ +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"} diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..337d516 --- /dev/null +++ b/readme.md @@ -0,0 +1,3 @@ +# Updog checker template + +An example checker for [Updog](https://git.askiiart.net/askiiart/updog)