Alertboard is a very simple Alert-Dashboard with no external dependencies.
It provides a simple RESTful-API to write and read alerts to/from the system.
It's compatiple with kapacitor.
Alertboard has a simple json-RESTful API. A sample alert would look like:
{
"id": "cpu/rechner1",
"message": "hallo",
"details": "",
"time": "2016-10-16T20:02:34.79046677+02:00",
"duration": 0,
"level": "OK",
"data": {
"Series": null,
"Messages": null,
"Err": null
},
"status": "Open"
}
`/alert`
- /alert
- /
- POST
- [create a new alert]
- POST
- /
`/alert/:alertID`
- /alert
- /:alertID
- main.alertCtx
- /
- DELETE
- [delete the alert with the id
alertID
]
- [delete the alert with the id
- GET
- [get the alert with the id
alertID
]
- [get the alert with the id
- DELETE
- /:alertID
`/alerts`
- /alerts
- /
- GET
- [get a list of all alerts]
- GET
- /
`/alerts/:prefix`
- /alerts
- /:prefix
- GET
- [get a list of all alerts with prefix
prefix
]
- [get a list of all alerts with prefix
- GET
- /:prefix
`/backup`
- /backup
- /
- GET
- [get a database backup]
- GET
- /
Create alert:
curl -v -H "Content-Type: application/json" -X POST -d '{"id":"abc123!?$*&()-=@~","message":"hallo", "level":"OK"}' http://localhost:8080/api/alert
...
...
...
* upload completely sent off: 78 out of 78 bytes
< HTTP/1.1 201 Created
< Content-Type: application/json; charset=utf-8
< Location: /api/alert/YWJjMTIzIT8kKiYoKS09QH4=
< Date: Sun, 16 Oct 2016 18:02:34 GMT
< Content-Length: 198
<
* Curl_http_done: called premature == 0
* Connection #0 to host localhost left intact
{"id":"abc123!?$*\u0026()-=@~","message":"hallo","details":"","time":"2016-10-16T20:02:34.79046677+02:00","duration":0,"level":"OK","data":{"Series":null,"Messages":null,"Err":null},"status":"Open"}%
You can see the new location of the alert:
The id is simply base64url encoded.
- Location: /api/alert/YWJjMTIzIT8kKiYoKS09QH4=
We can now get and delete this alert:
curl http://localhost:8080/api/alert/YWJjMTIzIT8kKiYoKS09QH4=
curl -X DELETE http://localhost:8080/api/alert/YWJjMTIzIT8kKiYoKS09QH4=