ruby-grafana-reporter 0.2.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +126 -85
- data/bin/ruby-grafana-reporter +2 -2
- data/lib/VERSION.rb +3 -2
- data/lib/grafana/abstract_datasource.rb +146 -0
- data/lib/grafana/dashboard.rb +21 -23
- data/lib/grafana/errors.rb +18 -3
- data/lib/grafana/grafana.rb +64 -66
- data/lib/grafana/grafana_alerts_datasource.rb +57 -0
- data/lib/grafana/grafana_annotations_datasource.rb +56 -0
- data/lib/grafana/grafana_property_datasource.rb +30 -0
- data/lib/grafana/graphite_datasource.rb +72 -0
- data/lib/grafana/image_rendering_datasource.rb +44 -0
- data/lib/grafana/influxdb_datasource.rb +70 -0
- data/lib/grafana/panel.rb +9 -3
- data/lib/grafana/prometheus_datasource.rb +67 -0
- data/lib/grafana/sql_datasource.rb +78 -0
- data/lib/grafana/unsupported_datasource.rb +7 -0
- data/lib/grafana/variable.rb +1 -1
- data/lib/grafana/webrequest.rb +71 -0
- data/lib/grafana_reporter/abstract_query.rb +460 -0
- data/lib/grafana_reporter/abstract_report.rb +139 -18
- data/lib/grafana_reporter/alerts_table_query.rb +39 -0
- data/lib/grafana_reporter/annotations_table_query.rb +38 -0
- data/lib/grafana_reporter/application/application.rb +34 -286
- data/lib/grafana_reporter/application/webservice.rb +50 -15
- data/lib/grafana_reporter/asciidoctor/alerts_table_include_processor.rb +91 -0
- data/lib/grafana_reporter/asciidoctor/annotations_table_include_processor.rb +90 -0
- data/lib/grafana_reporter/asciidoctor/panel_image_block_macro.rb +74 -0
- data/lib/grafana_reporter/asciidoctor/panel_image_inline_macro.rb +76 -0
- data/lib/grafana_reporter/asciidoctor/panel_property_inline_macro.rb +70 -0
- data/lib/grafana_reporter/asciidoctor/panel_query_table_include_processor.rb +95 -0
- data/lib/grafana_reporter/asciidoctor/panel_query_value_inline_macro.rb +90 -0
- data/lib/grafana_reporter/asciidoctor/processor_mixin.rb +49 -0
- data/lib/grafana_reporter/asciidoctor/report.rb +40 -81
- data/lib/grafana_reporter/asciidoctor/show_environment_include_processor.rb +46 -0
- data/lib/grafana_reporter/asciidoctor/show_help_include_processor.rb +35 -0
- data/lib/grafana_reporter/asciidoctor/sql_table_include_processor.rb +90 -0
- data/lib/grafana_reporter/asciidoctor/sql_value_inline_macro.rb +86 -0
- data/lib/grafana_reporter/asciidoctor/value_as_variable_include_processor.rb +90 -0
- data/lib/grafana_reporter/configuration.rb +59 -52
- data/lib/grafana_reporter/console_configuration_wizard.rb +311 -0
- data/lib/grafana_reporter/demo_report_wizard.rb +105 -0
- data/lib/grafana_reporter/erb/report.rb +30 -0
- data/lib/grafana_reporter/erb/report_jail.rb +21 -0
- data/lib/grafana_reporter/errors.rb +55 -0
- data/lib/grafana_reporter/help.rb +443 -0
- data/lib/grafana_reporter/logger/{two_way_logger.rb → two_way_delegate_logger.rb} +1 -1
- data/lib/grafana_reporter/panel_image_query.rb +25 -0
- data/lib/grafana_reporter/panel_property_query.rb +22 -0
- data/lib/grafana_reporter/query_value_query.rb +61 -0
- data/lib/grafana_reporter/report_webhook.rb +35 -0
- data/lib/ruby_grafana_extension.rb +8 -0
- data/lib/{ruby-grafana-reporter.rb → ruby_grafana_reporter.rb} +1 -2
- metadata +47 -38
- data/lib/grafana/abstract_panel_query.rb +0 -22
- data/lib/grafana/abstract_query.rb +0 -132
- data/lib/grafana/abstract_sql_query.rb +0 -51
- data/lib/grafana/panel_image_query.rb +0 -52
- data/lib/grafana_reporter/asciidoctor/alerts_table_query.rb +0 -104
- data/lib/grafana_reporter/asciidoctor/annotations_table_query.rb +0 -99
- data/lib/grafana_reporter/asciidoctor/errors.rb +0 -40
- data/lib/grafana_reporter/asciidoctor/extensions/alerts_table_include_processor.rb +0 -92
- data/lib/grafana_reporter/asciidoctor/extensions/annotations_table_include_processor.rb +0 -91
- data/lib/grafana_reporter/asciidoctor/extensions/panel_image_block_macro.rb +0 -69
- data/lib/grafana_reporter/asciidoctor/extensions/panel_image_inline_macro.rb +0 -68
- data/lib/grafana_reporter/asciidoctor/extensions/panel_property_inline_macro.rb +0 -61
- data/lib/grafana_reporter/asciidoctor/extensions/panel_query_table_include_processor.rb +0 -78
- data/lib/grafana_reporter/asciidoctor/extensions/panel_query_value_inline_macro.rb +0 -73
- data/lib/grafana_reporter/asciidoctor/extensions/processor_mixin.rb +0 -20
- data/lib/grafana_reporter/asciidoctor/extensions/show_environment_include_processor.rb +0 -43
- data/lib/grafana_reporter/asciidoctor/extensions/show_help_include_processor.rb +0 -228
- data/lib/grafana_reporter/asciidoctor/extensions/sql_table_include_processor.rb +0 -70
- data/lib/grafana_reporter/asciidoctor/extensions/sql_value_inline_macro.rb +0 -66
- data/lib/grafana_reporter/asciidoctor/extensions/value_as_variable_include_processor.rb +0 -86
- data/lib/grafana_reporter/asciidoctor/panel_first_value_query.rb +0 -34
- data/lib/grafana_reporter/asciidoctor/panel_image_query.rb +0 -25
- data/lib/grafana_reporter/asciidoctor/panel_property_query.rb +0 -44
- data/lib/grafana_reporter/asciidoctor/panel_table_query.rb +0 -38
- data/lib/grafana_reporter/asciidoctor/query_mixin.rb +0 -294
- data/lib/grafana_reporter/asciidoctor/sql_first_value_query.rb +0 -32
- data/lib/grafana_reporter/asciidoctor/sql_table_query.rb +0 -34
@@ -8,6 +8,28 @@ module GrafanaReporter
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
+
# Raised if a datasource shall be queried, which is not (yet) supported by the reporter
|
12
|
+
class DatasourceNotSupportedError < GrafanaReporterError
|
13
|
+
def initialize(ds, query)
|
14
|
+
super("The datasource '#{ds.name}' is of type '#{ds.type}' which is currently not supported for "\
|
15
|
+
"the query type '#{query}'.")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# Raised if some unhandled exception is raised during a datasource request execution.
|
20
|
+
class DatasourceRequestInternalError < GrafanaReporterError
|
21
|
+
def initialize(ds, message)
|
22
|
+
super("The datasource request to '#{ds.name}' (#{ds.class}) failed with an internal error: #{message}")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Raised if the return value of a datasource request does not match the expected return hash.
|
27
|
+
class DatasourceRequestInvalidReturnValueError < GrafanaReporterError
|
28
|
+
def initialize(ds, message)
|
29
|
+
super("The datasource request to '#{ds.name}' (#{ds.class}) returned an invalid value: '#{message}'")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
11
33
|
# Thrown, if the requested grafana instance does not have the mandatory 'host'
|
12
34
|
# setting configured.
|
13
35
|
class GrafanaInstanceWithoutHostError < GrafanaReporterError
|
@@ -45,4 +67,37 @@ module GrafanaReporter
|
|
45
67
|
"but was '#{currently}'.")
|
46
68
|
end
|
47
69
|
end
|
70
|
+
|
71
|
+
# Thrown, if the value configuration in {AbstractQuery#replace_values} is
|
72
|
+
# invalid.
|
73
|
+
class MalformedReplaceValuesStatementError < GrafanaReporterError
|
74
|
+
def initialize(statement)
|
75
|
+
super("The specified replace_values statement '#{statement}' is invalid. Make sure it contains"\
|
76
|
+
" exactly one not escaped ':' symbol.")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# Thrown, if a configured parameter is malformed.
|
81
|
+
class MalformedAttributeContentError < GrafanaReporterError
|
82
|
+
def initialize(message, attribute, content)
|
83
|
+
super("The content '#{content}' in attribute '#{attribute}' is malformed: #{message}")
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# Thrown, if a configured time range is not supported by the reporter.
|
88
|
+
#
|
89
|
+
# If this happens, most likely the reporter has to implement the new
|
90
|
+
# time range definition.
|
91
|
+
class TimeRangeUnknownError < GrafanaReporterError
|
92
|
+
def initialize(time_range)
|
93
|
+
super("The specified time range '#{time_range}' is unknown.")
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# Thrown, if a mandatory attribute is not set.
|
98
|
+
class MissingMandatoryAttributeError < GrafanaReporterError
|
99
|
+
def initialize(attribute)
|
100
|
+
super("Missing mandatory attribute '#{attribute}'.")
|
101
|
+
end
|
102
|
+
end
|
48
103
|
end
|
@@ -0,0 +1,443 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
module GrafanaReporter
|
6
|
+
# This class generates the functional help documentation for the reporter.
|
7
|
+
# It can create the documentation for github markdown, as well as in asciidoctor.
|
8
|
+
# TODO: this help is limited to Asciidoctor - move it to that namespace
|
9
|
+
class Help
|
10
|
+
# @param headline_level [Integer] top level of headline
|
11
|
+
# @return [String] asciidoctor compatible documentation
|
12
|
+
def asciidoctor(headline_level = 2)
|
13
|
+
help_text(asciidoctor_options.merge(level: headline_level))
|
14
|
+
end
|
15
|
+
|
16
|
+
# @param headline_level [Integer] top level of headline
|
17
|
+
# @return [String] github markdown compatible documentation
|
18
|
+
def github(headline_level = 2)
|
19
|
+
"#{toc}\n\n#{help_text(github_options.merge(level: headline_level))}"
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def github_options
|
25
|
+
{ headline_separator: '#', code_begin: '`', code_end: '`', table_begin: "\n", head_postfix_col: '| -- ' }
|
26
|
+
end
|
27
|
+
|
28
|
+
def asciidoctor_options
|
29
|
+
{ headline_separator: '=', code_begin: '`+', code_end: '+`', table_begin: "\n[%autowidth.stretch, "\
|
30
|
+
"options=\"header\"]\n|===\n", table_end: "\n|===" }
|
31
|
+
end
|
32
|
+
|
33
|
+
def help_text(opts)
|
34
|
+
%(#{opts[:headline_separator] * opts[:level]} Global options
|
35
|
+
#{global_options_as_text(opts.merge(level: opts[:level] + 1))}
|
36
|
+
#{opts[:headline_separator] * opts[:level]} Functions
|
37
|
+
#{functions_as_text(opts.merge(level: opts[:level] + 1))})
|
38
|
+
end
|
39
|
+
|
40
|
+
def toc
|
41
|
+
result = []
|
42
|
+
|
43
|
+
result << 'Table of contents'
|
44
|
+
result << '* [Global options](#global-options)'
|
45
|
+
prepared_help[:global_options].sort.map do |k, _v|
|
46
|
+
result << " * [#{k}](##{k.downcase})"
|
47
|
+
end
|
48
|
+
|
49
|
+
result << '* [Functions](#functions)'
|
50
|
+
prepared_help[:functions].sort.map do |k, _v|
|
51
|
+
result << " * [#{k}](##{k.downcase})"
|
52
|
+
end
|
53
|
+
|
54
|
+
result.join("\n")
|
55
|
+
end
|
56
|
+
|
57
|
+
def global_options_as_text(opts = {})
|
58
|
+
opts = { level: 3 }.merge(opts)
|
59
|
+
result = []
|
60
|
+
|
61
|
+
prepared_help[:global_options].sort.map do |k, v|
|
62
|
+
result << %(
|
63
|
+
#{opts[:headline_separator] * opts[:level]} #{opts[:code_begin]}#{k}#{opts[:code_end]}
|
64
|
+
Usage: #{opts[:code_begin]}#{v['call']}#{opts[:code_end]}
|
65
|
+
|
66
|
+
#{v['description']}
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
result.join
|
71
|
+
end
|
72
|
+
|
73
|
+
def functions_as_text(opts = {})
|
74
|
+
opts = { level: 3, headline_separator: '=' }.merge(opts)
|
75
|
+
result = []
|
76
|
+
|
77
|
+
prepared_help[:functions].sort.map do |k, v|
|
78
|
+
result << %(
|
79
|
+
#{opts[:headline_separator] * opts[:level]} #{opts[:code_begin]}#{k}#{opts[:code_end]}
|
80
|
+
Usage: #{opts[:code_begin]}#{v[:call]}#{opts[:code_end]}
|
81
|
+
|
82
|
+
#{v[:description]}#{"\n\nSee also: #{v[:see]}" if v[:see]}#{unless v[:options].empty?
|
83
|
+
%(
|
84
|
+
#{opts[:table_begin]}| Option | Description#{"\n#{opts[:head_postfix_col] * 2}" if opts[:head_postfix_col]}
|
85
|
+
#{v[:options].sort.map { |_opt_k, opt_v| "| #{opts[:code_begin]}#{opt_v[:call]}#{opts[:code_end]} | #{opt_v[:description].gsub('|', '\|')}" }.join("\n") }#{opts[:table_end]})
|
86
|
+
end}
|
87
|
+
)
|
88
|
+
end
|
89
|
+
|
90
|
+
result.join
|
91
|
+
end
|
92
|
+
|
93
|
+
def prepared_help
|
94
|
+
yaml = YAML.safe_load(raw_help_yaml)
|
95
|
+
|
96
|
+
result = {}
|
97
|
+
result[:functions] = {}
|
98
|
+
result[:global_options] = yaml['global_options']
|
99
|
+
|
100
|
+
functions = result[:functions]
|
101
|
+
std_opts = yaml['standard_options']
|
102
|
+
yaml.reject { |k, _v| k =~ /.*_options$/ }.each_key do |key|
|
103
|
+
functions[key] = {}
|
104
|
+
res_item = functions[key]
|
105
|
+
res_item[:options] = {}
|
106
|
+
|
107
|
+
item = yaml[key]
|
108
|
+
res_item[:call] = item['call']
|
109
|
+
res_item[:description] = item['description']
|
110
|
+
res_item[:see] = item['see']
|
111
|
+
|
112
|
+
opts = ((item['options'] ? item['options'].keys : [])
|
113
|
+
(item['standard_options'] ? item['standard_options'].keys : [])).sort
|
114
|
+
opts.each do |opt_key|
|
115
|
+
res_item[:options][opt_key] = {}
|
116
|
+
|
117
|
+
if item['standard_options'].key?(opt_key)
|
118
|
+
res_item[:options][opt_key][:call] = std_opts[opt_key]['call']
|
119
|
+
res_item[:options][opt_key][:description] = "#{std_opts[opt_key]['description']} "\
|
120
|
+
"#{item['standard_options'][opt_key]}".chop
|
121
|
+
res_item[:options][opt_key][:see] = std_opts[opt_key]['see'] if std_opts[opt_key]['see']
|
122
|
+
else
|
123
|
+
res_item[:options][opt_key][:call] = item['options'][opt_key]['call']
|
124
|
+
res_item[:options][opt_key][:description] = item['options'][opt_key]['description']
|
125
|
+
res_item[:options][opt_key][:see] = item['options'][opt_key]['see'] if item['options'][opt_key]['see']
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
result
|
131
|
+
end
|
132
|
+
|
133
|
+
def raw_help_yaml
|
134
|
+
<<~YAML_HELP
|
135
|
+
global_options:
|
136
|
+
grafana_default_instance:
|
137
|
+
call: ":grafana_default_instance: <instance_name>"
|
138
|
+
description: >-
|
139
|
+
Specifies which grafana instance shall be used. If not set, the grafana instance names `default`
|
140
|
+
will be used.
|
141
|
+
|
142
|
+
grafana_default_dashboard:
|
143
|
+
call: ":grafana_default_dashboard: <dashboard_uid>"
|
144
|
+
description: >-
|
145
|
+
Specifies to which dashboard the queries shall be targeted by default.
|
146
|
+
|
147
|
+
grafana_default_from_timezone:
|
148
|
+
call: ":grafana_default_from_timezone: <timezone>"
|
149
|
+
description: Specifies which timezone shall be used for the `from` time, e.g. `CET` or `CEST`.
|
150
|
+
|
151
|
+
grafana_default_to_timezone:
|
152
|
+
call: ":grafana_default_to_timezone: <timezone>"
|
153
|
+
description: Specifies which timezone shall be used for the `to` time, e.g. `CET` or `CEST`.
|
154
|
+
|
155
|
+
from:
|
156
|
+
call: ":from: <from_timestamp>"
|
157
|
+
description: >-
|
158
|
+
Overrides the time setting from grafana. It may contain dates as `now-1M/M`, which will be translated
|
159
|
+
properly to timestamps relative to the called time.
|
160
|
+
|
161
|
+
to:
|
162
|
+
call: ":to: <to_timestamp>"
|
163
|
+
description: >-
|
164
|
+
Overrides the time setting from grafana. It may contain dates as `now-1M/M`, which will be translated
|
165
|
+
properly to timestamps relative to the called time.
|
166
|
+
|
167
|
+
standard_options:
|
168
|
+
instance:
|
169
|
+
call: instance="<instance_name>"
|
170
|
+
description: >-
|
171
|
+
can be used to override global grafana instance, set in the report with `grafana_default_instance`.
|
172
|
+
If nothing is set, the configured grafana instance with name `default` will be used.
|
173
|
+
|
174
|
+
dashboard:
|
175
|
+
call: dashboard="<dashboard_uid>"
|
176
|
+
description: >-
|
177
|
+
Specifies the dashboard to be used. If `grafana_default_dashboard` is specified in the report template,
|
178
|
+
this value can be overridden with this option.
|
179
|
+
|
180
|
+
from:
|
181
|
+
call: from="<timestamp>"
|
182
|
+
description: can be used to override default `from` time
|
183
|
+
|
184
|
+
from_timezone:
|
185
|
+
call: from_timezone="<timezone>"
|
186
|
+
description: can be used to override system timezone for `from` time and will also override `grafana_default_from_timezone` option
|
187
|
+
|
188
|
+
to_timezone:
|
189
|
+
call: to_timezone="<timezone>"
|
190
|
+
description: can be used to override system timezone for `to` time and will also override `grafana_default_to_timezone` option
|
191
|
+
|
192
|
+
to:
|
193
|
+
call: to="<timestamp>"
|
194
|
+
description: can be used to override default `to` time
|
195
|
+
|
196
|
+
format:
|
197
|
+
call: format="<format_col1>,<format_col2>,..."
|
198
|
+
description: >-
|
199
|
+
Specify format in which the results shall be returned, e.g. `%.2f` for only two digit decimals of a
|
200
|
+
float. Several columns are separated by `,`. Execution is applied in the following order `format`,
|
201
|
+
`replace_values`, `filter_columns`, `transpose`.
|
202
|
+
see: 'https://ruby-doc.org/core-2.4.0/Kernel.html#method-i-sprintf'
|
203
|
+
|
204
|
+
replace_values:
|
205
|
+
call: replace_values="<replace_1>:<with_1>,<replace_2>:<with_2>,..."
|
206
|
+
description: >-
|
207
|
+
Specify result values which shall be replaced, e.g. `2:OK` will replace query values `2` with value `OK`.
|
208
|
+
Replacing several values is possible by separating by `,`. Matches with regular expressions are also
|
209
|
+
supported, but must be full matches, i.e. have to start with `^` and end with `$`, e.g. `^[012]$:OK`.
|
210
|
+
Number replacements can also be performed, e.g. `<8.2` or `<>3`. Execution is applied in the following order `format`,
|
211
|
+
`replace_values`, `filter_columns`, `transpose`.
|
212
|
+
see: https://ruby-doc.org/core-2.7.1/Regexp.html#class-Regexp-label-Character+Classes
|
213
|
+
|
214
|
+
filter_columns:
|
215
|
+
call: filter_columns="<column_name_1>,<column_name_2>,..."
|
216
|
+
description: >-
|
217
|
+
Removes specified columns from result. Execution is applied in the following order `format`, `replace_values`,
|
218
|
+
`filter_columns`, `transpose`.
|
219
|
+
|
220
|
+
transpose:
|
221
|
+
call: transpose="true"
|
222
|
+
description: >-
|
223
|
+
Transposes the query result, i.e. columns become rows and rows become columnns. Execution is applied in the
|
224
|
+
following order `format`, `replace_values`, `filter_columns`, `transpose`.
|
225
|
+
|
226
|
+
column_divider:
|
227
|
+
call: column_divider="<divider>"
|
228
|
+
description: >-
|
229
|
+
Replace the default column divider with another one. Defaults to ` | ` for being interpreted as a asciidoctor column.
|
230
|
+
|
231
|
+
row_divider:
|
232
|
+
call: row_divider="<divider>"
|
233
|
+
description: >-
|
234
|
+
Replace the default row divider with another one. Defaults to `| ` for being interpreted as a asciidoctor row.
|
235
|
+
|
236
|
+
timeout:
|
237
|
+
call: timeout="<timeout_in_seconds>"
|
238
|
+
description: >-
|
239
|
+
Set a timeout for the current query. If not overridden with `grafana_default_timeout` in the report template,
|
240
|
+
this defaults to 60 seconds.
|
241
|
+
|
242
|
+
# ----------------------------------
|
243
|
+
# FUNCTION DOCUMENTATION STARTS HERE
|
244
|
+
# ----------------------------------
|
245
|
+
|
246
|
+
grafana_help:
|
247
|
+
description: Show all available grafana calls within the asciidoctor templates, including available options.
|
248
|
+
call: 'include::grafana_help[]'
|
249
|
+
|
250
|
+
grafana_environment:
|
251
|
+
description: Shows all available variables in the rendering context which can be used in the asciidoctor template.
|
252
|
+
call: 'include::grafana_environment[]'
|
253
|
+
|
254
|
+
grafana_alerts:
|
255
|
+
description: >-
|
256
|
+
Returns a table of active alert states including the specified columns and the connected information. Supports
|
257
|
+
all query parameters from the Grafana Alerting API, such as `query`, `state`, `limit`, `folderId` and others.
|
258
|
+
call: 'include::grafana_alerts[columns="<column_name_1>,<column_name_2>,...",options]'
|
259
|
+
see: https://grafana.com/docs/grafana/latest/http_api/alerting/#get-alerts
|
260
|
+
options:
|
261
|
+
columns:
|
262
|
+
description: >-
|
263
|
+
Specifies columns that shall be returned. Valid columns are `id`, `dashboardId`, `dashboardUId`, `dashboardSlug`,
|
264
|
+
`panelId`, `name`, `state`, `newStateDate`, `evalDate`, `evalData` and `executionError`.
|
265
|
+
call: columns="<column_name_1>,<columns_name_2>,..."
|
266
|
+
panel:
|
267
|
+
description: >-
|
268
|
+
If specified, the resulting alerts are filtered for this panel. This option will only work, if a `dashboard`
|
269
|
+
or `grafana_default_dashboard` is set.
|
270
|
+
call: panel="<panel_id>"
|
271
|
+
standard_options:
|
272
|
+
column_divider:
|
273
|
+
dashboard: >-
|
274
|
+
If this option, or the global option `grafana_default_dashboard` is set, the resulting alerts will be limited to
|
275
|
+
this dashboard. To show all alerts in this case, specify `dashboard=""` as option.
|
276
|
+
filter_columns:
|
277
|
+
format:
|
278
|
+
from:
|
279
|
+
instance:
|
280
|
+
replace_values:
|
281
|
+
row_divider:
|
282
|
+
timeout:
|
283
|
+
to:
|
284
|
+
transpose:
|
285
|
+
from_timezone:
|
286
|
+
to_timezone:
|
287
|
+
|
288
|
+
grafana_annotations:
|
289
|
+
description: >-
|
290
|
+
Returns a table of all annotations, matching the specified filter criteria and the specified columns. Supports all
|
291
|
+
query parameters from the Grafana Alerting API, such as `limit`, `alertId`, `panelId` and others.
|
292
|
+
call: 'include::grafana_annotations[columns="<column_name_1>,<column_name_2>,...",options]'
|
293
|
+
see: https://grafana.com/docs/grafana/latest/http_api/annotations/#find_annotations
|
294
|
+
options:
|
295
|
+
columns:
|
296
|
+
description: >-
|
297
|
+
Specified the columns that shall be returned. Valid columns are `id`, `alertId`, `dashboardId`, `panelId`, `userId`,
|
298
|
+
`userName`, `newState`, `prevState`, `time`, `timeEnd`, `text`, `metric` and `type`.
|
299
|
+
call: columns="<column_name_1>,<columns_name_2>,..."
|
300
|
+
panel:
|
301
|
+
description: >-
|
302
|
+
If specified, the resulting alerts are filtered for this panel. This option will only work, if a `dashboard` or
|
303
|
+
`grafana_default_dashboard` is set.
|
304
|
+
call: panel="<panel_id>"
|
305
|
+
standard_options:
|
306
|
+
column_divider:
|
307
|
+
dashboard: >-
|
308
|
+
If this option, or the global option `grafana_default_dashboard` is set, the resulting alerts will be limited to this
|
309
|
+
dashboard. To show all alerts in this case, specify `dashboard=""` as option.
|
310
|
+
filter_columns:
|
311
|
+
format:
|
312
|
+
from:
|
313
|
+
instance:
|
314
|
+
replace_values:
|
315
|
+
row_divider:
|
316
|
+
timeout:
|
317
|
+
to:
|
318
|
+
transpose:
|
319
|
+
from_timezone:
|
320
|
+
to_timezone:
|
321
|
+
|
322
|
+
grafana_panel_property:
|
323
|
+
description: >-
|
324
|
+
Returns a property field for the specified panel. `<type>` can either be `title` or `description`.
|
325
|
+
Grafana variables will be replaced in the returned value.
|
326
|
+
call: 'grafana_panel_property:<panel_id>["<type>",options]'
|
327
|
+
see: https://grafana.com/docs/grafana/latest/variables/templates-and-variables/#variable-syntax
|
328
|
+
standard_options:
|
329
|
+
dashboard:
|
330
|
+
instance:
|
331
|
+
|
332
|
+
grafana_panel_image:
|
333
|
+
description: Includes a panel image as an image in the document. Can be called for inline-images as well as for blocks.
|
334
|
+
call: 'grafana_panel_image:<panel_id>[options] or grafana_panel_image::<panel_id>[options]'
|
335
|
+
options:
|
336
|
+
render-height:
|
337
|
+
description: can be used to override default `height` in which the panel shall be rendered
|
338
|
+
call: render-height="<height>"
|
339
|
+
render-width:
|
340
|
+
description: can be used to override default `width` in which the panel shall be rendered
|
341
|
+
call: render-width="<width>"
|
342
|
+
render-theme:
|
343
|
+
description: can be used to override default `theme` in which the panel shall be rendered (light by default)
|
344
|
+
call: render-theme="<theme>"
|
345
|
+
render-timeout:
|
346
|
+
description: can be used to override default `timeout` in which the panel shall be rendered (60 seconds by default)
|
347
|
+
call: render-timeout="<timeout>"
|
348
|
+
standard_options:
|
349
|
+
dashboard:
|
350
|
+
from:
|
351
|
+
instance:
|
352
|
+
timeout:
|
353
|
+
to:
|
354
|
+
from_timezone:
|
355
|
+
to_timezone:
|
356
|
+
|
357
|
+
grafana_panel_query_table:
|
358
|
+
description: >-
|
359
|
+
Returns the results of a query, which is configured in a grafana panel, as a table in asciidoctor.
|
360
|
+
Grafana variables will be replaced in the panel's SQL statement.
|
361
|
+
call: 'include::grafana_panel_query_table:<panel_id>[query="<query_letter>",options]'
|
362
|
+
see: https://grafana.com/docs/grafana/latest/variables/templates-and-variables/#variable-syntax
|
363
|
+
options:
|
364
|
+
query:
|
365
|
+
call: query="<query_letter>"
|
366
|
+
description: +<query_letter>+ needs to point to the grafana query which shall be evaluated, e.g. +A+ or +B+.
|
367
|
+
standard_options:
|
368
|
+
column_divider:
|
369
|
+
dashboard:
|
370
|
+
filter_columns:
|
371
|
+
format:
|
372
|
+
from:
|
373
|
+
instance:
|
374
|
+
replace_values:
|
375
|
+
row_divider:
|
376
|
+
timeout:
|
377
|
+
to:
|
378
|
+
transpose:
|
379
|
+
from_timezone:
|
380
|
+
to_timezone:
|
381
|
+
|
382
|
+
grafana_panel_query_value:
|
383
|
+
call: 'grafana_panel_query_value:<panel_id>[query="<query_letter>",options]'
|
384
|
+
description: >-
|
385
|
+
Returns the value in the first column and the first row of a query, which is configured in a grafana panel.
|
386
|
+
Grafana variables will be replaced in the panel's SQL statement.
|
387
|
+
see: https://grafana.com/docs/grafana/latest/variables/templates-and-variables/#variable-syntax
|
388
|
+
options:
|
389
|
+
query:
|
390
|
+
call: query="<query_letter>"
|
391
|
+
description: +<query_letter>+ needs to point to the grafana query which shall be evaluated, e.g. +A+ or +B+.
|
392
|
+
standard_options:
|
393
|
+
dashboard:
|
394
|
+
filter_columns:
|
395
|
+
format:
|
396
|
+
from:
|
397
|
+
instance:
|
398
|
+
replace_values:
|
399
|
+
timeout:
|
400
|
+
to:
|
401
|
+
from_timezone:
|
402
|
+
to_timezone:
|
403
|
+
|
404
|
+
grafana_sql_table:
|
405
|
+
call: 'include::grafana_sql_table:<datasource_id>[sql="<sql_query>",options]'
|
406
|
+
description: >-
|
407
|
+
Returns a table with all results of the given query.
|
408
|
+
Grafana variables will be replaced in the SQL statement.
|
409
|
+
see: https://grafana.com/docs/grafana/latest/variables/templates-and-variables/#variable-syntax
|
410
|
+
standard_options:
|
411
|
+
column_divider:
|
412
|
+
filter_columns:
|
413
|
+
format:
|
414
|
+
from:
|
415
|
+
instance:
|
416
|
+
replace_values:
|
417
|
+
row_divider:
|
418
|
+
timeout:
|
419
|
+
to:
|
420
|
+
transpose:
|
421
|
+
from_timezone:
|
422
|
+
to_timezone:
|
423
|
+
|
424
|
+
grafana_sql_value:
|
425
|
+
call: 'grafana_sql_value:<datasource_id>[sql="<sql_query>",options]'
|
426
|
+
description: >-
|
427
|
+
Returns the value in the first column and the first row of the given query.
|
428
|
+
Grafana variables will be replaced in the SQL statement.
|
429
|
+
see: https://grafana.com/docs/grafana/latest/variables/templates-and-variables/#variable-syntax
|
430
|
+
standard_options:
|
431
|
+
filter_columns:
|
432
|
+
format:
|
433
|
+
from:
|
434
|
+
instance:
|
435
|
+
replace_values:
|
436
|
+
timeout:
|
437
|
+
to:
|
438
|
+
from_timezone:
|
439
|
+
to_timezone:
|
440
|
+
YAML_HELP
|
441
|
+
end
|
442
|
+
end
|
443
|
+
end
|