2024-01-29 11:39:27 -06:00
# Updog
2024-01-29 10:45:39 -06:00
## 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 -->
2024-01-29 11:39:27 -06:00
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.
2024-01-29 10:45:39 -06:00
2024-01-29 11:39:27 -06:00
Some examples extensions:
2024-01-29 10:45:39 -06:00
2024-01-29 11:39:27 -06:00
- [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.
2024-01-29 10:45:39 -06:00
### Methods
`*` : indicates a method is required
#### `__init__()`*
**Arguments**:
2024-01-29 11:39:27 -06:00
- 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
}
```
2024-01-29 10:45:39 -06:00
**Return**: None
#### `get_status()`*
**Arguments**: None
2024-01-29 11:39:27 -06:00
**Return**: An integer indicating status; the codes; what the code means is provided by [`get_return_codes()` ](#get_return_codes )
2024-01-29 10:45:39 -06:00
These values can be overriden by providing [`get_return_codes()` ](#get_return_codes )
2024-01-29 11:39:27 -06:00
#### `get_return_codes()`*
2024-01-29 10:45:39 -06:00
**Arguments**: None
**Return**: A `dict` containing integers and their associated statuses.
2024-01-29 11:39:27 -06:00
Example:
2024-01-29 10:45:39 -06:00
```py
{
0: "Down",
50: "Partial outage",
100: "Up"
}
```
## To-do
- Add basic functionality
- Read `services.json` file:
```json
{
2024-01-29 11:39:27 -06:00
"site": {
2024-01-29 10:45:39 -06:00
"name": "A Website",
2024-01-29 11:39:27 -06:00
"checker": "CheckerTemplate",
2024-01-29 10:45:39 -06:00
"checker-args": {
"url": "https://example.net",
2024-01-29 11:39:27 -06:00
"port": 443
2024-01-29 10:45:39 -06:00
},
"rate": 60,
"alerts": "AlertsTemplate",
2024-01-29 11:39:27 -06:00
"alerts-args": {
2024-01-29 10:45:39 -06:00
"url": "https://example.com/webhook-url-or-whatever-goes-here"
2024-01-29 11:39:27 -06:00
},
"logging": "LoggingTemplate",
"logging-args": {
"format": "irrelevant, LoggingTemplate has no options lol"
2024-01-29 10:45:39 -06:00
}
}
}
```
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!***