No description
- Go 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| go.mod | ||
| go.sum | ||
| README.md | ||
| uptimekuma-matrix.go | ||
uptimekuma-matrix
Very simple UptimeKuma webhook receiver for Matrix written in Go. Has more features than plain UptimeKuma:
- Custom templates
- Markdown support
- Can switch
m.text/m.notice
Very easy to configure.
Running
Get a binary, go build or whatever, figure it out, you seem like a smart guy.
Usage:
uptimekuma-matrix [-help] [-addr string] [-port int]
-addr string
the address to bind to (default "0.0.0.0")
-help
shows this help
-port int
the port to listen on (default 1234)
Using
- Create a "notification" of type "Webhook", give it a cute name, and set the URL to wherever the webhook receiver can be reached
- Set "Request Body" to the
application/json"preset" - Enable "Additional Headers" and add the following structure:
{
"X-Matrix-Room": "!room-id-here",
"X-Matrix-CSAPI": "https://matrix.homeserver.tld",
"X-Matrix-Token": "token-here",
"X-Matrix-ID": "@uptimekuma:homeserver.tld",
}
replacing each with appropriate values.
Headers
X-Matrix-Room(required): the Matrix room ID. Needs to be known in the database of the homeserver that will be usedX-Matrix-CSAPI(required): the URL where the Client-Server Matrix API can be reached. The most reliable way to find this URL, is to use an external federation tester, to have it resolve the C-S endpoint for you. I recommend mtrnord'sX-Matrix-Token(required): the access token that was generated by authenticating against the homeserver that will be used. Tools likembccan be useful, but stripping a cookie from your favorite Matrix client will work tooX-Matrix-ID(required): the MXID of the user in canonical form (@localpart:homeserver.tld) that belongs to the token.X-Matrix-Type(optional): the message type, should be eitherm.textorm.notice(defaultm.notice)X-Matrix-Template(optional): a Go template for the message to send on Matrix, you have the following pieces of data available (top level is aHeartbeatEvent):
type Heartbeat struct {
MonitorID int
Status int
Time string
Msg string
Ping int
Important bool
Retries int
Timezone string
TimezoneOffset string
LocalDateTime string
LastDownTime string
}
type Monitor struct {
ID int
Name string
Description string
PathName string
URL string
}
type HeartbeatEvent struct {
Message string
Monitor Monitor
Heartbeat Heartbeat
}
Default is {{.Message}}, so just whatever UptimeKuma gives you by default.