alertboard

command module
v0.0.0-...-940b672 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2017 License: MIT Imports: 17 Imported by: 0

README

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=

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL