updog/readme.md

89 lines
2 KiB
Markdown

# askiiart/updog
## What's updog?
Not much, you?
<small>(it's a simple, extensible uptime monitor)</small>
## Warning
**Extensions will be executed with no safety checks!** Make sure an extension isn't malicious before adding it.
## Uptime Checker Extensions
<!-- 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
### Metadata
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.
### Methods
`*`: indicates a method is required
#### `__init__()`*
**Arguments**:
- a list of strings from `checker-args` in `services.json` - for no arguments an empty list will be used
**Return**: None
#### `get_status()`*
**Arguments**: None
**Return**: An integer from 0 to 100 indicating status; defaults listed in [`get_return_codes()`](#get_return_codes)
These values can be overriden by providing [`get_return_codes()`](#get_return_codes)
#### `get_return_codes()`
**Arguments**: None
**Return**: A `dict` containing integers and their associated statuses.
Default:
```py
{
0: "Down",
50: "Partial outage",
100: "Up"
}
```
## To-do
- Add basic functionality
- Read `services.json` file:
```json
{
"site" {
"name": "A Website",
"uptime-checker": "CheckerTemplate",
"checker-args": {
"url": "https://example.net",
"port: "443",
},
"rate": 60,
"alerts": "AlertsTemplate",
"alerts-args" {
"url": "https://example.com/webhook-url-or-whatever-goes-here"
}
}
}
```
The args are just passed to the extension as a `dict`, the extension handles it from there.
- Add support for logging and alert extensions
---
***All specs are still a work-in-progress, breaking changes are likely!***