Skip to content

Commit a376680

Browse files
Merge pull request #96 from tarantool/localapp-monitoring
Cluster for local Tarantool app monitoring
2 parents c6e6bba + 810040d commit a376680

File tree

5 files changed

+192
-14
lines changed

5 files changed

+192
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010
- Support adding custom panels before dashboard build
1111
- Add simple customization guide
12+
- Cluster for local Tarantool app monitoring
1213

1314
### Changed
1415
- Code rework: introduce grid generation, separate dashboards code

README.md

Lines changed: 59 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,17 @@ Refer to dashboard [documentation page](https://www.tarantool.io/en/doc/latest/b
5454

5555
For guide on setting up your monitoring stack refer to [documentation page](https://www.tarantool.io/en/doc/latest/book/monitoring/grafana_dashboard/).
5656

57-
This repository provides preconfigured monitoring cluster with example Tarantool app and load generatior for local development and tests. You can use them to build a monitoring cluster for your own app.
57+
### Example app
5858

59-
`docker-compose up -d` will start 6 containers: Tarantool App, Tarantool Load Generator, Telegraf, InfluxDB, Prometheus and Grafana, which build cluster with two fully operational metrics datasources (InfluxDB and Prometheus), extracting metrics from Tarantool App example project.
59+
This repository provides preconfigured monitoring cluster with example Tarantool app and load generatior for local dashboard development and tests.
60+
61+
```bash
62+
docker-compose up -d
63+
```
64+
will start 6 containers: Tarantool App, Tarantool Load Generator, Telegraf, InfluxDB, Prometheus and Grafana, which build cluster with two fully operational metrics datasources (InfluxDB and Prometheus), extracting metrics from Tarantool App example project.
6065
We recommend using the exact versions we use in experimental cluster (e.g. Grafana v6.6.0).
66+
After start, Grafana UI will be available at [localhost:3000](http://localhost:3000/).
67+
You can also interact with Prometheus at [localhost:9090](http://localhost:9090/) and InfluxDB at [localhost:8086](http://localhost:8086/).
6168

6269
To set up an InfluxDB dashboard for monitoring example app, use the following variables:
6370

@@ -69,12 +76,35 @@ To set up an Prometheus dashboard for monitoring example app, use the following
6976
- `Job`: `tarantool_app`;
7077
- `Rate time range`: `2m`.
7178

79+
### Monitoring local app
80+
81+
If you want to monitor Tarantool cluster deployed on your local host, you can use monitoring cluster similar to example app one.
82+
83+
Configure Telegraf/Prometheus to monitor your own app in `example/telegraf/telegraf.localapp.conf` and `example/prometheus/prometheus.localapp.yml`.
84+
Use `host.docker.internal` as your machine host in configuration and set cluster instances ports as targets and correct metrics HTTP path.
85+
See more setup tips in [documentation](https://www.tarantool.io/en/doc/latest/book/monitoring/grafana_dashboard/).
86+
87+
Start cluster with
88+
```bash
89+
docker-compose -f docker-compose.localapp.yml -p localapp-monitoring up -d
90+
```
91+
After start, Grafana UI will be available at [localhost:3000](http://localhost:3000/).
92+
You can also interact with Prometheus at [localhost:9090](http://localhost:9090/) and InfluxDB at [localhost:8086](http://localhost:8086/).
7293

7394
## Manual build
7495

7596
`go` v.1.14 or greater is required to install build and test dependencies.
76-
Run `make build-deps` to install dependencies that are required to build dashboards.
77-
Run `make test-deps` to install build dependencies and dependencies that are required to run tests locally.
97+
Run
98+
```bash
99+
make build-deps
100+
```
101+
to install dependencies that are required to build dashboards.
102+
103+
Run
104+
```bash
105+
make test-deps
106+
```
107+
to install build dependencies and dependencies that are required to run tests locally.
78108

79109
You can compile Prometheus dashboard template with
80110
```bash
@@ -94,8 +124,15 @@ and to save output into clipboard, use
94124
jsonnet -J ./vendor/ -e "local dashboard = import 'dashboard/prometheus_dashboard.libsonnet'; dashboard.build()" | xclip -selection clipboard
95125
```
96126

97-
You can run tests with `make run-tests` command.
98-
Compiled dashboard test files can be updated with `make update-tests` command.
127+
You can run tests with
128+
```bash
129+
make run-tests
130+
```
131+
132+
Compiled dashboard test files can be updated with
133+
```bash
134+
make update-tests
135+
```
99136
It also formats all source files with `jsonnetfmt`.
100137

101138

@@ -104,7 +141,11 @@ It also formats all source files with `jsonnetfmt`.
104141
You can add your own custom panels to the bottom of the template dashboard.
105142

106143
1. Add tarantool/grafana-dashboard as a dependency in your project with jsonnet-bundler.
107-
Run `jb init` to initialize `jsonnetfile.json` and add this repo as a dependency:
144+
Run
145+
```bash
146+
jb init
147+
```
148+
to initialize `jsonnetfile.json` and add this repo as a dependency:
108149
```json
109150
# jsonnetfile.json
110151
{
@@ -122,7 +163,11 @@ You can add your own custom panels to the bottom of the template dashboard.
122163
"legacyImports": true
123164
}
124165
```
125-
Run `jb install` to install dependencies. [`grafonnet`](https://github.com/grafana/grafonnet-lib) library will also be installed as a transitive dependency.
166+
Run
167+
```bash
168+
jb install
169+
```
170+
to install dependencies. [`grafonnet`](https://github.com/grafana/grafonnet-lib) library will also be installed as a transitive dependency.
126171

127172

128173
2. There are two main templates: `grafana-dashboard/dashboard/prometheus_dashboard.libsonnet` and `grafana-dashboard/dashboard/influxdb_dashboard.libsonnet`.
@@ -210,17 +255,17 @@ You can add your own custom panels to the bottom of the template dashboard.
210255

211256
If you want to build a Prometheus dashboard, use
212257
```jsonnet
213-
datasource=variable.datasource.prometheus,
214-
job=variable.prometheus.job,
215-
rate_time_range=variable.prometheus.rate_time_range
258+
datasource=variable.datasource.prometheus,
259+
job=variable.prometheus.job,
260+
rate_time_range=variable.prometheus.rate_time_range
216261
```
217262
in your targets.
218263

219264
If you want to build an InfluxDB dashboard, use
220265
```jsonnet
221-
datasource=variable.datasource.influxdb,
222-
policy=variable.influxdb.policy,
223-
measurement=variable.influxdb.measurement
266+
datasource=variable.datasource.influxdb,
267+
policy=variable.influxdb.policy,
268+
measurement=variable.influxdb.measurement
224269
```
225270
in your targets.
226271

docker-compose.localapp.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
version: '3'
2+
services:
3+
telegraf:
4+
image: telegraf:1.13-alpine
5+
networks:
6+
tarantool_dashboard_dev:
7+
extra_hosts:
8+
- "host.docker.internal:host-gateway"
9+
volumes:
10+
# configure telegraf to work out of the box
11+
- ./example/telegraf/telegraf.localapp.conf:/etc/telegraf/telegraf.conf:ro
12+
13+
influxdb:
14+
image: influxdb:1.7-alpine
15+
environment:
16+
INFLUXDB_REPORTING_DISABLED: "true"
17+
INFLUXDB_DB: "metrics"
18+
INFLUXDB_ADMIN_USER: "admin"
19+
INFLUXDB_ADMIN_PASSWORD: "admin"
20+
INFLUXDB_USER: "telegraf"
21+
INFLUXDB_USER_PASSWORD: "telegraf"
22+
INFLUXDB_HTTP_AUTH_ENABLED: "true"
23+
networks:
24+
tarantool_dashboard_dev:
25+
ports:
26+
- 8086:8086
27+
28+
prometheus:
29+
image: prom/prometheus:v2.17.2
30+
networks:
31+
tarantool_dashboard_dev:
32+
extra_hosts:
33+
- "host.docker.internal:host-gateway"
34+
ports:
35+
- 9090:9090
36+
volumes:
37+
- ./example/prometheus/prometheus.localapp.yml:/etc/prometheus/prometheus.yml
38+
- ./example/prometheus/alerts.yml:/etc/prometheus/alerts.yml
39+
40+
grafana:
41+
image: grafana/grafana:6.6.0
42+
environment:
43+
GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION: "true"
44+
GF_AUTH_ANONYMOUS_ENABLED: "true"
45+
GF_AUTH_ANONYMOUS_ORG_ROLE: "Admin"
46+
GF_AUTH_DISABLE_SIGNOUT_MENU: "true"
47+
GF_AUTH_DISABLE_LOGIN_FORM: "true"
48+
networks:
49+
tarantool_dashboard_dev:
50+
ports:
51+
- 3000:3000
52+
volumes:
53+
- ./example/grafana/provisioning:/etc/grafana/provisioning
54+
55+
networks:
56+
tarantool_dashboard_dev:
57+
driver: bridge
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# my global config
2+
global:
3+
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
4+
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
5+
# scrape_timeout is set to the global default (10s).
6+
7+
# Alertmanager configuration
8+
alerting:
9+
alertmanagers:
10+
- static_configs:
11+
- targets:
12+
# - alertmanager:9093
13+
14+
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
15+
rule_files:
16+
- "alerts.yml"
17+
18+
# A scrape configuration containing exactly one endpoint to scrape:
19+
# Here it's Prometheus itself.
20+
scrape_configs:
21+
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
22+
- job_name: "prometheus"
23+
24+
# metrics_path defaults to '/metrics'
25+
# scheme defaults to 'http'.
26+
27+
static_configs:
28+
- targets: ["localhost:9090"]
29+
30+
- job_name: "tarantool_app"
31+
static_configs:
32+
- targets:
33+
- "host.docker.internal:8081"
34+
- "host.docker.internal:8082"
35+
- "host.docker.internal:8083"
36+
- "host.docker.internal:8084"
37+
- "host.docker.internal:8085"
38+
metrics_path: "/metrics/prometheus"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[[inputs.http]]
2+
urls = [
3+
"http://host.docker.internal:8081/metrics/json",
4+
"http://host.docker.internal:8082/metrics/json",
5+
"http://host.docker.internal:8083/metrics/json",
6+
"http://host.docker.internal:8084/metrics/json",
7+
"http://host.docker.internal:8085/metrics/json"
8+
]
9+
timeout = "30s"
10+
tag_keys = [
11+
"metric_name",
12+
"label_pairs_alias",
13+
"label_pairs_quantile",
14+
"label_pairs_path",
15+
"label_pairs_method",
16+
"label_pairs_status",
17+
"label_pairs_operation",
18+
"label_pairs_level",
19+
"label_pairs_id",
20+
"label_pairs_engine",
21+
"label_pairs_name",
22+
"label_pairs_index_name"
23+
]
24+
insecure_skip_verify = true
25+
interval = "10s"
26+
data_format = "json"
27+
name_prefix = "tarantool_app_"
28+
fieldpass = ["value"]
29+
30+
[[inputs.internal]]
31+
32+
[[outputs.influxdb]]
33+
urls = ["http://influxdb:8086"]
34+
database = "metrics"
35+
skip_database_creation = true
36+
username = "telegraf"
37+
password = "telegraf"

0 commit comments

Comments
 (0)