@@ -11,6 +11,192 @@ local prometheus = grafana.prometheus;
1111
1212{
1313 row:: common.row('Cluster overview' ),
14+ failover_coordinator_row:: common.row('Failover coordinator' ),
15+
16+ coordinators_status(
17+ cfg,
18+ title='Coordinators status' ,
19+ ):: tablePanel.new(
20+ title=title,
21+ datasource=cfg.datasource,
22+ transform='table' ,
23+ ).addTarget(
24+ if cfg.type == variable.datasource_type.prometheus then
25+ local filters_obj = common.remove_field(cfg.filters, 'alias' );
26+ local filters = common.prometheus_query_filters(filters_obj);
27+ local metric = std.format ('%starantool_coordinator_active' , [cfg.metrics_prefix]);
28+ prometheus.target(
29+ expr=if filters == '' then metric else std.format ('%s{%s}' , [metric, filters]),
30+ format='table' ,
31+ instant=true ,
32+ )
33+ else
34+ error 'InfluxDB target is not supported yet'
35+ ) {
36+ options: { cellHeight: 'sm' , showHeader: true },
37+ fieldConfig: {
38+ defaults: {
39+ custom: {
40+ align: 'auto' ,
41+ cellOptions: { type: 'auto' },
42+ footer: { reducers: [] },
43+ inspect: false ,
44+ },
45+ mappings: [],
46+ thresholds: {
47+ mode: 'absolute' ,
48+ steps: [
49+ { color: 'green' , value: 0 },
50+ { color: 'red' , value: 80 },
51+ ],
52+ },
53+ },
54+ overrides: [
55+ {
56+ matcher: { id: 'byName' , options: 'status' },
57+ properties: [
58+ { id: 'custom.cellOptions' , value: { type: 'color-text' } },
59+ {
60+ id: 'mappings' ,
61+ value: [
62+ {
63+ type: 'value' ,
64+ options: {
65+ '0' : { color: 'yellow' , text: 'passive' },
66+ '1' : { color: 'green' , text: 'active' },
67+ },
68+ },
69+ {
70+ type: 'special' ,
71+ options: {
72+ match: 'null' ,
73+ result: { color: 'red' , text: 'disconnected' },
74+ },
75+ },
76+ ],
77+ },
78+ ],
79+ },
80+ ],
81+ },
82+ transformations: [
83+ {
84+ id: 'organize' ,
85+ options: {
86+ excludeByName: {
87+ Time: true ,
88+ __name__: true ,
89+ instance: true ,
90+ job: true ,
91+ },
92+ indexByName: { Value: 1 , alias: 0 },
93+ renameByName: { Value: 'status' , alias: 'uuid' },
94+ },
95+ },
96+ ],
97+ },
98+
99+ instances_seen_by_coordinators(
100+ cfg,
101+ title='Instances seen by coordinators' ,
102+ ):: tablePanel.new(
103+ title=title,
104+ datasource=cfg.datasource,
105+ transform='table' ,
106+ ).addTarget(
107+ if cfg.type == variable.datasource_type.prometheus then
108+ local filters_obj = common.remove_field(cfg.filters, 'alias' );
109+ local filters = common.prometheus_query_filters(filters_obj);
110+ local metric = std.format ('%starantool_instance_status' , [cfg.metrics_prefix]);
111+ prometheus.target(
112+ expr=if filters == '' then metric else std.format ('%s{%s}' , [metric, filters]),
113+ format='table' ,
114+ instant=true ,
115+ )
116+ else
117+ error 'InfluxDB target is not supported yet'
118+ ) {
119+ options: { cellHeight: 'sm' , showHeader: true },
120+ fieldConfig: {
121+ defaults: {
122+ custom: {
123+ align: 'auto' ,
124+ cellOptions: { type: 'auto' },
125+ footer: { reducers: [] },
126+ inspect: false ,
127+ },
128+ mappings: [],
129+ thresholds: {
130+ mode: 'absolute' ,
131+ steps: [
132+ { color: 'red' , value: null },
133+ { color: 'green' , value: 1 },
134+ ],
135+ },
136+ },
137+ overrides: [
138+ {
139+ matcher: { id: 'byName' , options: 'status' },
140+ properties: [
141+ { id: 'custom.cellOptions' , value: { type: 'color-text' } },
142+ {
143+ id: 'mappings' ,
144+ value: [
145+ {
146+ type: 'value' ,
147+ options: {
148+ '0' : { color: 'red' , text: 'down' },
149+ '1' : { color: 'green' , text: 'alive' },
150+ },
151+ },
152+ {
153+ type: 'special' ,
154+ options: {
155+ match: 'nan' ,
156+ result: { color: 'red' , text: 'unknown' },
157+ },
158+ },
159+ ],
160+ },
161+ ],
162+ },
163+ ],
164+ },
165+ transformations: [
166+ {
167+ "id" : "organize" ,
168+ "options" : {
169+ "excludeByName" : {
170+ "Time" : true ,
171+ "__name__" : true ,
172+ "job" : true ,
173+ "exported_job" : true ,
174+ "endpoint" : true ,
175+ "namespace" : true ,
176+ "pod" : true ,
177+ "service" : true ,
178+ "instance" : true
179+ },
180+ "renameByName" : {
181+ "alias" : "coordinator uuid" ,
182+ "exported_instance" : "instance" ,
183+ "Value" : "status"
184+ }
185+ }
186+ },
187+ {
188+ "id" : "organize" ,
189+ "options" : {
190+ "indexByName" : {
191+ "coordinator uuid" : 0 ,
192+ "replicaset" : 1 ,
193+ "instance" : 2 ,
194+ "status" : 3
195+ }
196+ }
197+ }
198+ ],
199+ },
14200
15201 health_overview_table(
16202 cfg,
0 commit comments