umputun / rlb-stats

Stats collector and reporter for RLB
MIT License
7 stars 2 forks source link
load-balancer rlb stats

rlb-stats Build Status Coverage Status Go Report Card Docker Automated build

Stats collector for RLB with REST interface and WEB UI.

Run instructions

Run docker-compose up in order to start rlb-stats and rlb (for data generation).

Generate data

Run following command in the terminal in order to generate traffic for rlb-stats:

while true; do
  curl "http://127.0.0.1:7070/api/v1/jump/test1?url=/mp3files/test_file_$(((RANDOM % 10) + 1)).mp3" >/dev/null 2>&1
  sleep $(((RANDOM % 10) + 1))
done

API

Open http://127.0.0.1:8080/api/candle endpoint from to see all aggregated logs since the start of the container.

Dashboard

Open http://127.0.0.1:8080/ to see dashboard with statistics

Application parameters

Command line Environment Default Description
port PORT 80 Web server port
bolt BOLT_FILE /tmp/rlb-stats.bd boltdb file path
dbg DEBUG false debug mode
TIME_ZONE America/Chicago container timezone

API

Load candles

GET /api/candle, parameters - ?from=<RFC3339_date>&to=<RFC3339_date>&aggregate=<duration>

Retrieve candles from storage.

POST /api/insert

Insert LogRecord to storage. Expects LogRecord as a body:

{
    "from_ip": "172.21.0.1",
    "ts": "2021-03-24T08:20:00Z",
    "file_name": "rtfiles/rt_podcast659.mp3",
    "dest": "n3.radio-t.com"
}