-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.libsonnet
82 lines (73 loc) · 2.5 KB
/
variables.libsonnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
local g = import 'github.com/grafana/grafonnet/gen/grafonnet-latest/main.libsonnet';
local var = g.dashboard.variable;
{
datasource:
var.datasource.new('datasource', 'prometheus'),
host:
var.query.new('host')
+ var.query.withDatasourceFromVariable(self.datasource)
+ var.query.queryTypes.withLabelValues(
'host',
'cpu_usage_idle{job="telegraf"}',
)
+ var.query.refresh.onTime(),
hostWithMdArrays:
var.query.new('host')
+ var.query.withDatasourceFromVariable(self.datasource)
+ var.query.queryTypes.withLabelValues(
'host',
'mdstat_DisksTotal{job="telegraf"}',
)
+ var.query.refresh.onTime(),
mdArray:
var.query.new('array')
+ var.query.withDatasourceFromVariable(self.datasource)
+ var.query.queryTypes.withLabelValues(
'Name',
'mdstat_DisksTotal{job="telegraf", host="$%s"}' % self.hostWithMdArrays.name,
)
+ var.query.refresh.onTime()
+ var.query.selectionOptions.withMulti(true)
+ var.query.selectionOptions.withIncludeAll(),
cpu:
var.query.new('cpu')
+ var.query.withDatasourceFromVariable(self.datasource)
+ var.query.queryTypes.withLabelValues(
'cpu',
'cpu_usage_idle{job="telegraf", host="$%s"}' % self.host.name,
)
+ var.query.withRegex('/cpu[0-9]+/')
+ var.query.refresh.onTime()
+ var.query.selectionOptions.withMulti(true)
+ var.query.selectionOptions.withIncludeAll(),
disk:
var.query.new('disk')
+ var.query.withDatasourceFromVariable(self.datasource)
+ var.query.queryTypes.withLabelValues(
'name',
'diskio_reads{job="telegraf", host="$%s"}' % self.host.name,
)
+ var.query.refresh.onTime()
+ var.query.selectionOptions.withMulti(true)
+ var.query.selectionOptions.withIncludeAll(),
interface:
var.query.new('interface')
+ var.query.withDatasourceFromVariable(self.datasource)
+ var.query.queryTypes.withLabelValues(
'interface',
'net_bytes_recv{job="telegraf", host="$%s"}' % self.host.name,
)
+ var.query.refresh.onTime()
+ var.query.selectionOptions.withMulti(true)
+ var.query.selectionOptions.withIncludeAll(),
mountpoint:
var.query.new('mountpoint')
+ var.query.withDatasourceFromVariable(self.datasource)
+ var.query.queryTypes.withLabelValues(
'path',
'disk_total{job="telegraf", host="$%s"}' % self.host.name,
)
+ var.query.refresh.onTime()
+ var.query.selectionOptions.withMulti(true)
+ var.query.selectionOptions.withIncludeAll(),
}