-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_old.jsonnet
41 lines (38 loc) · 1.56 KB
/
main_old.jsonnet
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
local grafana = import 'github.com/grafana/grafonnet/gen/grafonnet-latest/main.libsonnet';
local dashboard = grafana.dashboard;
local timeSeries = grafana.panel.timeSeries;
local prometheus = grafana.query.prometheus;
local cpuQuery(cpuMode) =
prometheus.new(
'bebsfl2z94g74c',
'sum(irate(node_cpu_seconds_total{mode="' + cpuMode + '", cpu="0"}[1m])) / scalar(count(count(node_cpu_seconds_total{mode="' + cpuMode + '", cpu="0"}) by(cpu)))'
) + prometheus.withLegendFormat(cpuMode);
dashboard.new('Node Metrics')
+ dashboard.withDescription('Metrics from the node exporter')
+ dashboard.time.withFrom(value = "now-30m")
+ dashboard.withPanels([
timeSeries.new('CPU Usage')
+ timeSeries.queryOptions.withTargets([
cpuQuery('irq'),
cpuQuery('idle'),
cpuQuery('system'),
cpuQuery('user')
])
+ timeSeries.gridPos.withW(24)
+ timeSeries.gridPos.withH(8)
+ timeSeries.standardOptions.withUnit('percentunit'),
timeSeries.new('Memory Usage')
+ timeSeries.queryOptions.withTargets([
prometheus.new(
'bebsfl2z94g74c',
'node_memory_MemTotal_bytes'
) + prometheus.withLegendFormat('RAM Total'),
prometheus.new(
'bebsfl2z94g74c',
'node_memory_MemTotal_bytes - node_memory_MemFree_bytes - (node_memory_Cached_bytes + node_memory_Buffers_bytes + node_memory_SReclaimable_bytes)'
) + prometheus.withLegendFormat('RAM Used')
])
+ timeSeries.gridPos.withW(24)
+ timeSeries.gridPos.withH(8)
+ timeSeries.standardOptions.withUnit('bytes')
])