Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #4 from ph-ash/bulk-push
Browse files Browse the repository at this point in the history
bulk push documentation + some other changes
  • Loading branch information
cawolf authored Feb 26, 2019
2 parents b7be56e + 9ffc292 commit e7f73bc
Showing 1 changed file with 58 additions and 2 deletions.
60 changes: 58 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ You can and should configure several application variables by adding `environmen

## Usage

### Push data to the board
### Push single data to the board

#### Method, endpoint and headers

Expand Down Expand Up @@ -131,6 +131,62 @@ A complete example request with [curl](https://curl.haxx.se/) looks like:
If you receive an empty Response with a HTTP code of `201`, your monitoring data was successfully accepted by the server and should be displayed on the board.
Every time you reload the board, all stored monitorings will be resent from the server to the board, so you do not have to push them again.

### Push bulk data to the board

#### Method, endpoint and headers

Data collectors can `POST` data in JSON format to the board's endpoint `http://<PUBLIC_HOSTNAME>/api/monitoring/data/bulk`.

They need to authenticate themselves with a `Bearer` token sent in the `Authorization` header.

The `Content-Type` and `Accept` headers should be set to `application/json`.

#### Payload format

The payload needs to be a JSON object with an array called `monitoringData` of objects with given keys:

See [Payload format](#payload-format)

Example payload:
```
{
"monitoringData": [
{
"id": "My first Monitoringdata",
"status": "ok",
"payload": "This is my payload",
"idleTimeoutInSeconds": 60,
"priority": 1,
"date": "2019-02-26T20:16:30.641Z",
"path": "monitoring.team_phash.database"
},
{
"id": "My second Monitoringdata",
"status": "error",
"payload": "This is an Errormessage",
"idleTimeoutInSeconds": 60,
"priority": 5,
"date": "2019-02-26T20:16:30.641Z",
"path": "monitoring.team_phash.database"
}
]
}
```
A complete example request with [curl](https://curl.haxx.se/) looks like:

curl -sS -D - -X POST "http://localhost/api/monitoring/data" \
-H "Accept: application/json" \
-H "Authorization: Bearer pleaseChooseASecretTokenForThePublicAPI" \
-H "Content-Type: application/json" \
-d "{ \"monitoringData\": [ { \"id\": \"My first Monitoringdata\", \"status\": \"ok\", \"payload\": \"This is my payload\", \"idleTimeoutInSeconds\": 60, \"priority\": 1, \"date\": \"2019-02-26T20:16:30.641Z\", \"path\": \"monitoring.team_phash.database\" }, { \"id\": \"My second Monitoringdata\", \"status\": \"error\", \"payload\": \"This is an Errormessage\", \"idleTimeoutInSeconds\": 60, \"priority\": 5, \"date\": \"2019-02-26T20:16:30.641Z\", \"path\": \"monitoring.team_phash.database\" } ] }"

If you receive an empty Response with a HTTP code of `201`, your monitoring data was successfully accepted by the server and should be displayed on the board.
Every time you reload the board, all stored monitorings will be resent from the server to the board, so you do not have to push them again.

If you receive a Response with a HTTP code of `400` you will get a list of validation errors in the Response-Content. All
data without errors will be processed successfully, while the ones with validation errors will not be processed until you resend
them and they pass validation.

### Tree layout

Your monitoring data can be displayed as a tree map. To enable this feature, you need to push the optional `path` property and fill it with a valid tree path.
Expand All @@ -155,7 +211,7 @@ The tree map display allows you to easily navigate this tree by simply clicking

Additionally, you will notice the URL changing when you navigate the tree. You can use these URLs to directly jump into that subtree when initially opening the dashboard, which can be useful for screeners.

Please keep in mind, that you should *not* declare a tree path both as branch node and leaf node. This will mess up the tree aggregation and yields unpredictable results.
Please keep in mind, that you should *not* declare a tree path both as branch node and leaf node. Pushing data into a branch node will result in validation errors and will not be processed.

## Issues

Expand Down

0 comments on commit e7f73bc

Please sign in to comment.