Move checker template to separate repo , fix various errors

This commit is contained in:
askiiart 2024-01-29 11:39:27 -06:00
parent 701cf839e7
commit 4501484c3f
Signed by untrusted user who does not match committer: askiiart
GPG key ID: BC3800E55FB54D67
2 changed files with 30 additions and 27 deletions

View file

@ -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

View file

@ -1,4 +1,4 @@
# askiiart/updog
# Updog
## What's updog?
@ -14,11 +14,16 @@ Not much, you?
<!-- move to docs folder later -->
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"
}
}
}