Skip to content

Commit 5865fca

Browse files
Configure InfluxDB bank and measurement through Grafana import
Merged in #3
1 parent d9ce408 commit 5865fca

File tree

2 files changed

+58
-28
lines changed

2 files changed

+58
-28
lines changed

tarantool/dashboard.libsonnet

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,49 +16,76 @@ local dashboard = grafana.dashboard.new(
1616
tags=['tag1', 'tag2'],
1717
);
1818

19-
local measurement = 'example_project_http';
20-
local t = {
21-
"current": {
22-
"selected": false,
23-
"text": measurement,
24-
"value": measurement
25-
},
26-
"hide": 2,
27-
"label": null,
28-
"name": "measurement",
29-
"options": [
30-
{
31-
"selected": true,
32-
"text": measurement,
33-
"value": measurement
34-
}
35-
],
36-
"query": measurement,
37-
"skipUrlSync": false,
38-
"type": "constant"
39-
};
19+
local datasource = '${DS_INFLUXDB}';
20+
local measurement = '${TARANTOOL_MEASUREMENT}';
4021

4122
dashboard
42-
.addTemplate(t)
43-
.addPanel(grafana.row.new(title='memory'), {x: 0, y: 0})
23+
.addInput(
24+
name='DS_INFLUXDB',
25+
label='InfluxDB bank',
26+
type='datasource',
27+
pluginId='influxdb',
28+
pluginName='InfluxDB',
29+
description='InfluxDB Tarantool metrics bank'
30+
)
31+
.addInput(
32+
name='TARANTOOL_MEASUREMENT',
33+
label='Measurement',
34+
type='constant',
35+
pluginId=null,
36+
pluginName=null,
37+
description='InfluxDB Tarantool metrics measurement'
38+
)
39+
.addRequired(
40+
type='grafana',
41+
id='grafana',
42+
name='Grafana',
43+
version='6.6.0'
44+
)
45+
.addRequired(
46+
type='datasource',
47+
id='influxdb',
48+
name='InfluxDB',
49+
version='1.0.0'
50+
)
51+
.addRequired(
52+
type='panel',
53+
id='graph',
54+
name='Graph',
55+
version=''
56+
)
57+
.addRequired(
58+
type='panel',
59+
id='text',
60+
name='Text',
61+
version=''
62+
)
63+
.addPanel(
64+
grafana.row.new(title='memory'),
65+
{x: 0, y: 0}
66+
)
4467
.addPanel(
4568
slab.monitor_info(),
46-
{w: 24, h: 3, x: 0, y: 0})
69+
{w: 24, h: 3, x: 0, y: 0}
70+
)
4771
.addPanel(
4872
slab.quota_used_ratio(
4973
datasource=datasource,
74+
measurement=measurement,
5075
),
5176
{w: 8, h: 8, x: 0, y: 3}
5277
)
5378
.addPanel(
5479
slab.arena_used_ratio(
5580
datasource=datasource,
81+
measurement=measurement,
5682
),
5783
{w: 8, h: 8, x: 8, y: 3},
5884
)
5985
.addPanel(
6086
slab.items_used_ratio(
6187
datasource=datasource,
88+
measurement=measurement,
6289
),
6390
{w: 8, h: 8, x: 16, y: 3},
6491
)

tarantool/slab.libsonnet

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,15 @@ local influxdb = grafana.influxdb;
4646
так и для индексов (равно значению параметра *memtx_memory*).
4747
|||,
4848

49-
datasource=null
49+
datasource=null,
50+
measurement=null,
5051
):: used_ratio(
5152
title=title,
5253
description=description,
5354
datasource=datasource,
5455
).addTarget(
5556
influxdb.target(
56-
measurement='$measurement'
57+
measurement=measurement
5758
).where('metric_name', '=', 'tnt_slab_quota_used_ratio').selectField('value').addConverter('mean')
5859
),
5960

@@ -70,13 +71,14 @@ local influxdb = grafana.influxdb;
7071
|||,
7172

7273
datasource=null,
74+
measurement=null,
7375
):: used_ratio(
7476
title=title,
7577
description=description,
7678
datasource=datasource,
7779
).addTarget(
7880
influxdb.target(
79-
measurement='$measurement'
81+
measurement=measurement
8082
).where('metric_name', '=', 'tnt_slab_arena_used_ratio').selectField('value').addConverter('mean')
8183
),
8284

@@ -93,13 +95,14 @@ local influxdb = grafana.influxdb;
9395
|||,
9496

9597
datasource=null,
98+
measurement=null,
9699
):: used_ratio(
97100
title=title,
98101
description=description,
99102
datasource=datasource,
100103
).addTarget(
101104
influxdb.target(
102-
measurement='$measurement'
105+
measurement=measurement
103106
).where('metric_name', '=', 'tnt_slab_items_used_ratio').selectField('value').addConverter('mean')
104107
),
105108
}

0 commit comments

Comments
 (0)