]> git.proxmox.com Git - ceph.git/blob - ceph/monitoring/ceph-mixin/dashboards/utils.libsonnet
import quincy 17.2.0
[ceph.git] / ceph / monitoring / ceph-mixin / dashboards / utils.libsonnet
1 local g = import 'grafonnet/grafana.libsonnet';
2
3 {
4 dashboardSchema(title,
5 description,
6 uid,
7 time_from,
8 refresh,
9 schemaVersion,
10 tags,
11 timezone,
12 timepicker)::
13 g.dashboard.new(title=title,
14 description=description,
15 uid=uid,
16 time_from=time_from,
17 refresh=refresh,
18 schemaVersion=schemaVersion,
19 tags=tags,
20 timezone=timezone,
21 timepicker=timepicker),
22
23 graphPanelSchema(aliasColors,
24 title,
25 description,
26 nullPointMode,
27 stack,
28 formatY1,
29 formatY2,
30 labelY1,
31 labelY2,
32 min,
33 fill,
34 datasource,
35 legend_alignAsTable=false,
36 legend_avg=false,
37 legend_min=false,
38 legend_max=false,
39 legend_current=false,
40 legend_values=false)::
41 g.graphPanel.new(aliasColors=aliasColors,
42 title=title,
43 description=description,
44 nullPointMode=nullPointMode,
45 stack=stack,
46 formatY1=formatY1,
47 formatY2=formatY2,
48 labelY1=labelY1,
49 labelY2=labelY2,
50 min=min,
51 fill=fill,
52 datasource=datasource,
53 legend_alignAsTable=legend_alignAsTable,
54 legend_avg=legend_avg,
55 legend_min=legend_min,
56 legend_max=legend_max,
57 legend_current=legend_current,
58 legend_values=legend_values),
59
60
61 addTargetSchema(expr, legendFormat='', format='time_series', intervalFactor=1, instant=null)::
62 g.prometheus.target(expr=expr,
63 legendFormat=legendFormat,
64 format=format,
65 intervalFactor=intervalFactor,
66 instant=instant),
67
68 addTemplateSchema(name,
69 datasource,
70 query,
71 refresh,
72 includeAll,
73 sort,
74 label,
75 regex)::
76 g.template.new(name=name,
77 datasource=datasource,
78 query=query,
79 refresh=refresh,
80 includeAll=includeAll,
81 sort=sort,
82 label=label,
83 regex=regex),
84
85 addAnnotationSchema(builtIn,
86 datasource,
87 enable,
88 hide,
89 iconColor,
90 name,
91 type)::
92 g.annotation.datasource(builtIn=builtIn,
93 datasource=datasource,
94 enable=enable,
95 hide=hide,
96 iconColor=iconColor,
97 name=name,
98 type=type),
99
100 addRowSchema(collapse, showTitle, title)::
101 g.row.new(collapse=collapse, showTitle=showTitle, title=title),
102
103 addSingleStatSchema(colors,
104 datasource,
105 format,
106 title,
107 description,
108 valueName,
109 colorValue,
110 gaugeMaxValue,
111 gaugeShow,
112 sparklineShow,
113 thresholds)::
114 g.singlestat.new(colors=colors,
115 datasource=datasource,
116 format=format,
117 title=title,
118 description=description,
119 valueName=valueName,
120 colorValue=colorValue,
121 gaugeMaxValue=gaugeMaxValue,
122 gaugeShow=gaugeShow,
123 sparklineShow=sparklineShow,
124 thresholds=thresholds),
125
126 addPieChartSchema(aliasColors,
127 datasource,
128 description,
129 legendType,
130 pieType,
131 title,
132 valueName)::
133 g.pieChartPanel.new(aliasColors=aliasColors,
134 datasource=datasource,
135 description=description,
136 legendType=legendType,
137 pieType=pieType,
138 title=title,
139 valueName=valueName),
140
141 addTableSchema(datasource, description, sort, styles, title, transform)::
142 g.tablePanel.new(datasource=datasource,
143 description=description,
144 sort=sort,
145 styles=styles,
146 title=title,
147 transform=transform),
148
149 addStyle(alias,
150 colorMode,
151 colors,
152 dateFormat,
153 decimals,
154 mappingType,
155 pattern,
156 thresholds,
157 type,
158 unit,
159 valueMaps)::
160 {
161 alias: alias,
162 colorMode: colorMode,
163 colors: colors,
164 dateFormat: dateFormat,
165 decimals: decimals,
166 mappingType: mappingType,
167 pattern: pattern,
168 thresholds: thresholds,
169 type: type,
170 unit: unit,
171 valueMaps: valueMaps,
172 },
173 }