overview.jsonnet: Use a template variable to allow restricting to certain nodes

pull/158/head
Mike Lang 5 years ago
parent 4a2fe7a6ed
commit bb3814f9f7

@ -102,11 +102,22 @@ local service_status_table = {
links: [], links: [],
}; };
local labels = {
labels: 'instance=~"$instance"'
};
grafana.dashboard({ grafana.dashboard({
name: "Overview", name: "Overview",
uid: "rjd405mn", uid: "rjd405mn",
refresh: "30s", refresh: "30s",
templates: [
{
name: "instance",
query: 'label_values(up, instance)'
},
],
rows: [ rows: [
{ {
@ -124,8 +135,8 @@ grafana.dashboard({
display: "bars", display: "bars",
expressions: { expressions: {
"{{instance}} {{service}} {{level}}({{module}}:{{function}})": ||| "{{instance}} {{service}} {{level}}({{module}}:{{function}})": |||
sum(irate(log_count_total{level!="INFO"}[2m])) by (instance, service, level, module, function) > 0 sum(irate(log_count_total{level!="INFO", %(labels)s}[2m])) by (instance, service, level, module, function) > 0
|||, ||| % labels,
}, },
}, },
], ],
@ -136,9 +147,9 @@ grafana.dashboard({
axis: {min: 0, label: "segments / sec"}, axis: {min: 0, label: "segments / sec"},
expressions: { expressions: {
"{{channel}}({{quality}}) live capture": "{{channel}}({{quality}}) live capture":
'sum(rate(segments_downloaded_total[2m])) by (channel, quality)', 'sum(rate(segments_downloaded_total{%(labels)s}[2m])) by (channel, quality)' % labels,
"{{channel}}({{quality}}) backfilled": "{{channel}}({{quality}}) backfilled":
'sum(rate(segments_backfilled_total[2m])) by (channel, quality)', 'sum(rate(segments_backfilled_total{%(labels)s}[2m])) by (channel, quality)' % labels,
}, },
}, },
{ {
@ -146,7 +157,7 @@ grafana.dashboard({
axis: {min: 0, label: "requests / sec"}, axis: {min: 0, label: "requests / sec"},
expressions: { expressions: {
"{{method}} {{endpoint}}": "{{method}} {{endpoint}}":
'sum(rate(http_request_latency_all_count{status="200"}[2m])) by (endpoint, method)', 'sum(rate(http_request_latency_all_count{status="200", %(labels)s}[2m])) by (endpoint, method)' % labels,
}, },
}, },
{ {
@ -156,8 +167,8 @@ grafana.dashboard({
tooltip: "Does not include UNEDITED or DONE events", tooltip: "Does not include UNEDITED or DONE events",
expressions: { expressions: {
"{{state}}": ||| "{{state}}": |||
sum(event_counts{state!="UNEDITED", state!="DONE"}) by (state) sum(event_counts{state!="UNEDITED", state!="DONE", %(labels)s}) by (state)
|||, ||| % labels,
}, },
}, },
], ],
@ -169,16 +180,16 @@ grafana.dashboard({
expressions: { expressions: {
"{{instance}} {{service}}": ||| "{{instance}} {{service}}": |||
sum by (instance, service) ( sum by (instance, service) (
rate(process_cpu_seconds_total[2m]) rate(process_cpu_seconds_total{%(labels)s}[2m])
) )
||| ||| % labels,
}, },
}, },
{ {
name: "Memory usage (RSS)", name: "Memory usage (RSS)",
axis: {min: 0, format: grafana.formats.bytes}, axis: {min: 0, format: grafana.formats.bytes},
expressions: { expressions: {
"{{instance}} {{service}}": "process_resident_memory_bytes", "{{instance}} {{service}}": "process_resident_memory_bytes{%(labels)s}" % labels,
}, },
}, },
{ {
@ -186,7 +197,7 @@ grafana.dashboard({
axis: {min: 0, label: "restarts within last minute"}, axis: {min: 0, label: "restarts within last minute"},
tooltip: "Multiple restarts within 15sec will be missed, and only counted as one.", tooltip: "Multiple restarts within 15sec will be missed, and only counted as one.",
expressions: { expressions: {
"{{instance}} {{service}}": "changes(process_start_time_seconds[1m])", "{{instance}} {{service}}": "changes(process_start_time_seconds{%(labels)s}[1m])" % labels,
}, },
}, },
], ],
@ -201,7 +212,7 @@ grafana.dashboard({
axis: {min: 0, label: "segments / sec"}, axis: {min: 0, label: "segments / sec"},
expressions: { expressions: {
"{{instance}} {{channel}}({{quality}})": "{{instance}} {{channel}}({{quality}})":
'sum(rate(segments_downloaded_total[2m])) by (instance, channel, quality)', 'sum(rate(segments_downloaded_total{%(labels)s}[2m])) by (instance, channel, quality)' % labels,
}, },
}, },
{ {
@ -213,9 +224,9 @@ grafana.dashboard({
// Ignore series where we're no longer fetching segments, // Ignore series where we're no longer fetching segments,
// as they just show that it's been a long time since the last segment. // as they just show that it's been a long time since the last segment.
||| |||
time() - max(latest_segment) by (instance, channel, quality) time() - max(latest_segment{%(labels)s}) by (instance, channel, quality)
and sum(irate(segments_downloaded_total[2m])) by (instance, channel, quality) > 0 and sum(irate(segments_downloaded_total{%(labels)s}[2m])) by (instance, channel, quality) > 0
|||, ||| % labels,
}, },
}, },
], ],
@ -229,7 +240,7 @@ grafana.dashboard({
axis: {min: 0, label: "segments / sec"}, axis: {min: 0, label: "segments / sec"},
expressions: { expressions: {
"{{remote}} -> {{instance}}": "{{remote}} -> {{instance}}":
'sum(rate(segments_backfilled_total[2m])) by (remote, instance)', 'sum(rate(segments_backfilled_total{%(labels)s}[2m])) by (remote, instance)' % labels,
}, },
}, },
], ],

Loading…
Cancel
Save