Skip to content

very simple alert dashboard with no external dependencies.

License

Notifications You must be signed in to change notification settings

HeavyHorst/alertboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Go Report Card MIT licensed

alertboard

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

API

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"
}

API-Endpoints

Routes

`/alert`
  • /alert
    • /
      • POST
        • [create a new alert]
`/alert/:alertID`
  • /alert
    • /:alertID
      • main.alertCtx
      • /
        • DELETE
          • [delete the alert with the id alertID]
        • GET
          • [get the alert with the id alertID]
`/alerts`
  • /alerts
    • /
      • GET
        • [get a list of all alerts]
`/alerts/:prefix`
  • /alerts
    • /:prefix
      • GET
        • [get a list of all alerts with prefix prefix]
`/backup`
  • /backup
    • /
      • GET
        • [get a database backup]

Example:

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=