45 lines
1.1 KiB
Markdown
45 lines
1.1 KiB
Markdown
# am
|
|
|
|
Simple alerts and monitoring server.
|
|
|
|
## Server Installation
|
|
|
|
The server (`cmd/amserver`) compiles to a dependency-free binary. Associated
|
|
files will be created or read from the working directory.
|
|
|
|
### Log and Alert Scripts
|
|
|
|
The server will call two scripts for log or alert events. These scripts need to
|
|
be executable and exist in the working directory. They need to be called
|
|
`log-action` and `alert-action`. They are called with two arguments:
|
|
|
|
1. The name of the source reporting the log or alert.
|
|
1. The associated text.
|
|
|
|
### Running
|
|
|
|
Run the server with a listen address:
|
|
|
|
```amserver -listen example.com:443```
|
|
|
|
If the port is 443, then the server will serve over https and automatically
|
|
acquire a certificate from letsencrypt.
|
|
|
|
### Default User Account
|
|
|
|
By default, an account is created with username `root` and password `root1234`.
|
|
|
|
## Source Usage
|
|
|
|
Sources can perform three actions: `ping`, `log`, or `alert`. Actions are sent
|
|
as standard HTTP POST requests to the URL
|
|
`https://example.com/report/<APIKey>`.
|
|
|
|
For example:
|
|
|
|
```bash
|
|
curl \
|
|
--data-urlencode "action=alert" \
|
|
--data-urlencode "text=An alert!" \
|
|
https://example.com/report/$API_KEY
|
|
``` |