diff --git a/extensions/checkers/checker_template/checker_template.py b/extensions/checkers/checker_template/checker_template.py deleted file mode 100644 index 82f9069..0000000 --- a/extensions/checkers/checker_template/checker_template.py +++ /dev/null @@ -1,15 +0,0 @@ -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 \ No newline at end of file diff --git a/readme.md b/readme.md index 706ed51..70742a9 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# askiiart/updog +# Updog ## What's updog? @@ -14,11 +14,16 @@ Not much, you? -Updog doesn't do any monitoring by itself. Instead, extensions are used to check the status of whatever thing, and are used +Updog doesn't do any monitoring by itself. Instead, extensions are used to check the status of whatever thing, send alerts, and log stuff. Updog just chains them together. -### Metadata +Some examples extensions: -Extensions need to be put in the `./extensions/checkers` folder and the name of the file must match the name of the folder. In the future, `alerts` and `logging` folders will be added for those extensions. For now, there is only support for checkers, and Updog itself will have very basic logging. +- [askiiart/updog-checker_template](https://git.askiiart.net/askiiart/updog-checker_template) +- Others will be added later + +### Folder layout + +Extensions need to be put in the `./extensions/checkers` folder and the name of the file must match the name of the folder. In the future, `alerts` and `logging` folders will be added for those extensions. For now, there is only support for checkers. ### Methods @@ -28,7 +33,16 @@ Extensions need to be put in the `./extensions/checkers` folder and the name of **Arguments**: -- a list of strings from `checker-args` in `services.json` - for no arguments an empty list will be used +- A dict of arguments from `checker-args` in `services.json` - For no arguments, an empty dict will be used + +Example: + +```py +{ + "url": "https://example.net", + "port": 443 +} +``` **Return**: None @@ -36,17 +50,17 @@ Extensions need to be put in the `./extensions/checkers` folder and the name of **Arguments**: None -**Return**: An integer from 0 to 100 indicating status; defaults listed in [`get_return_codes()`](#get_return_codes) +**Return**: An integer indicating status; the codes; what the code means is provided by [`get_return_codes()`](#get_return_codes) These values can be overriden by providing [`get_return_codes()`](#get_return_codes) -#### `get_return_codes()` +#### `get_return_codes()`* **Arguments**: None **Return**: A `dict` containing integers and their associated statuses. -Default: +Example: ```py { @@ -63,17 +77,21 @@ Default: ```json { - "site" { + "site": { "name": "A Website", - "uptime-checker": "CheckerTemplate", + "checker": "CheckerTemplate", "checker-args": { "url": "https://example.net", - "port: "443", + "port": 443 }, "rate": 60, "alerts": "AlertsTemplate", - "alerts-args" { + "alerts-args": { "url": "https://example.com/webhook-url-or-whatever-goes-here" + }, + "logging": "LoggingTemplate", + "logging-args": { + "format": "irrelevant, LoggingTemplate has no options lol" } } }