Flesh out basic structure of the program, finish initial extension docs

This commit is contained in:
askiiart 2024-01-31 17:58:26 -06:00
parent ed220154d8
commit ed8593e41d
Signed by untrusted user who does not match committer: askiiart
GPG key ID: BC3800E55FB54D67
6 changed files with 113 additions and 28 deletions

39
docs/extensions/alerts.md Normal file
View file

@ -0,0 +1,39 @@
# Alerts Extensions
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.
Example extension: [askiiart/updog-alerts_template](https://git.askiiart.net/askiiart/updog-alerts_template)
## Folder layout
Extensions need to be put in the `./extensions/alerts` folder, and the name of the file must match the name of the folder.
```txt
.
├── extensions
│ ├── alerts
│ └── alerts_template
│ └── alerts_template.py
```
## Methods
`*`: indicates a method is required
### `__init__()`*
**Arguments**:
- (dict) Arguments from `alerts-args` in `services.json` - For no arguments, an empty dict will be used
**Return**: None
### `alert()`*
**Arguments**:
- (str) The name of the service the alert is for
- (int) The status code returned by the checker
- (str) The status message for that status code
**Return**: Nothing

View file

@ -11,9 +11,9 @@ Extensions need to be put in the `./extensions/checkers` folder, and the name of
```txt
.
├── extensions
│ ├── alerts
│ └── alerts_template
│ └── alerts_template.py
│ ├── checkers
│ └── checker_template
│ └── checker_template.py
```
## Methods
@ -24,7 +24,7 @@ Extensions need to be put in the `./extensions/checkers` folder, and the name of
**Arguments**:
- A dict of arguments from `checker-args` in `services.json` - For no arguments, an empty dict will be used
- (dict) Arguments from `checker-args` in `services.json` - For no arguments, an empty dict will be used
Example:

View file

@ -0,0 +1,39 @@
# Alerts Extensions
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.
Example extension: [askiiart/updog-logging_template](https://git.askiiart.net/askiiart/updog-logging_template)
## Folder layout
Extensions need to be put in the `./extensions/logging` folder, and the name of the file must match the name of the folder.
```txt
.
├── extensions
│ ├── logging
│ └── logging_template
│ └── logging_template.py
```
## Methods
`*`: indicates a method is required
### `__init__()`*
**Arguments**:
- A dict of arguments from `logging-args` in `services.json` - For no arguments, an empty dict will be used
**Return**: None
### `log()`*
**Arguments**: `service_name`, `code`, `status`
- `service_name`: The name of the service the logger is logging - currently it's always the same value for a single instance, but this is required for compatibility when support for logging multiple things with one instance of the logger is supported.
- `code`: The status code returned by the checker
- `status`: The status message for that status code
**Return**: Nothing