Skip to content

Commit

Permalink
fix: Error "multiple matches for labels: many-to-one matching must be…
Browse files Browse the repository at this point in the history
… explicit (group_left/group_right)" on Kubernetes/Networking Dashboards

Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
  • Loading branch information
jkroepke committed Jul 26, 2024
1 parent dd5c59a commit 2ea98c7
Showing 1 changed file with 180 additions and 24 deletions.
204 changes: 180 additions & 24 deletions dashboards/network-usage/cluster-total.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,16 @@ local var = g.dashboard.variable;
+ tsPanel.standardOptions.withUnit('binBps')
+ tsPanel.queryOptions.withTargets([
prometheus.new(
'${datasource}',
'sum by (namespace) (rate(container_network_receive_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s]) * on (%(clusterLabel)s,namespace,pod) kube_pod_info{host_network="false"})' % $._config
'${datasource}', |||
sum by (namespace) (
rate(container_network_receive_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s])
* on (%(clusterLabel)s,namespace,pod) group_left ()
topk by (%(clusterLabel)s,namespace,pod) (
1,
max by (%(clusterLabel)s,namespace,pod) (kube_pod_info{host_network="false"})
)
)
||| % $._config
)
+ prometheus.withLegendFormat('__auto'),
]),
Expand All @@ -76,44 +84,124 @@ local var = g.dashboard.variable;
+ tsPanel.standardOptions.withUnit('binBps')
+ tsPanel.queryOptions.withTargets([
prometheus.new(
'${datasource}',
'sum by (namespace) (rate(container_network_transmit_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s]) * on (%(clusterLabel)s,namespace,pod) kube_pod_info{host_network="false"})' % $._config
'${datasource}', |||
sum by (namespace) (
rate(container_network_transmit_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s])
* on (%(clusterLabel)s,namespace,pod) group_left ()
topk by (%(clusterLabel)s,namespace,pod) (
1,
max by (%(clusterLabel)s,namespace,pod) (kube_pod_info{host_network="false"})
)
)
||| % $._config
)
+ prometheus.withLegendFormat('__auto'),
]),

table.new('Current Status')
+ table.gridPos.withW(24)
+ table.queryOptions.withTargets([
prometheus.new('${datasource}', 'sum by (namespace) (rate(container_network_receive_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s]) * on (%(clusterLabel)s,namespace,pod) kube_pod_info{host_network="false"})' % $._config)
prometheus.new('${datasource}', |||
sum by (namespace) (
rate(container_network_receive_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s])
* on (%(clusterLabel)s,namespace,pod) group_left ()
topk by (%(clusterLabel)s,namespace,pod) (
1,
max by (%(clusterLabel)s,namespace,pod) (kube_pod_info{host_network="false"})
)
)
||| % $._config)
+ prometheus.withInstant(true)
+ prometheus.withFormat('table'),

prometheus.new('${datasource}', 'sum by (namespace) (rate(container_network_transmit_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s]) * on (%(clusterLabel)s,namespace,pod) kube_pod_info{host_network="false"})' % $._config)
prometheus.new('${datasource}', |||
sum by (namespace) (
rate(container_network_transmit_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s])
* on (%(clusterLabel)s,namespace,pod) group_left ()
topk by (%(clusterLabel)s,namespace,pod) (
1,
max by (%(clusterLabel)s,namespace,pod) (kube_pod_info{host_network="false"})
)
)
||| % $._config)
+ prometheus.withInstant(true)
+ prometheus.withFormat('table'),

prometheus.new('${datasource}', 'avg by (namespace) (rate(container_network_receive_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s]) * on (%(clusterLabel)s,namespace,pod) kube_pod_info{host_network="false"})' % $._config)
prometheus.new('${datasource}', |||
avg by (namespace) (
rate(container_network_receive_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s])
* on (%(clusterLabel)s,namespace,pod) group_left ()
topk by (%(clusterLabel)s,namespace,pod) (
1,
max by (%(clusterLabel)s,namespace,pod) (kube_pod_info{host_network="false"})
)
)
||| % $._config)
+ prometheus.withInstant(true)
+ prometheus.withFormat('table'),

prometheus.new('${datasource}', 'avg by (namespace) (rate(container_network_transmit_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s]) * on (%(clusterLabel)s,namespace,pod) kube_pod_info{host_network="false"})' % $._config)
prometheus.new('${datasource}', |||
avg by (namespace) (
rate(container_network_transmit_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s])
* on (%(clusterLabel)s,namespace,pod) group_left ()
topk by (%(clusterLabel)s,namespace,pod) (
1,
max by (%(clusterLabel)s,namespace,pod) (kube_pod_info{host_network="false"})
)
)
||| % $._config)
+ prometheus.withInstant(true)
+ prometheus.withFormat('table'),

prometheus.new('${datasource}', 'sum by (namespace) (rate(container_network_receive_packets_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s]) * on (%(clusterLabel)s,namespace,pod) kube_pod_info{host_network="false"})' % $._config)
prometheus.new('${datasource}', |||
sum by (namespace) (
rate(container_network_receive_packets_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s])
* on (%(clusterLabel)s,namespace,pod) group_left ()
topk by (%(clusterLabel)s,namespace,pod) (
1,
max by (%(clusterLabel)s,namespace,pod) (kube_pod_info{host_network="false"})
)
)
||| % $._config)
+ prometheus.withInstant(true)
+ prometheus.withFormat('table'),

prometheus.new('${datasource}', 'sum by (namespace) (rate(container_network_transmit_packets_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s]) * on (%(clusterLabel)s,namespace,pod) kube_pod_info{host_network="false"})' % $._config)
prometheus.new('${datasource}', |||
sum by (namespace) (
rate(container_network_transmit_packets_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s])
* on (%(clusterLabel)s,namespace,pod) group_left ()
topk by (%(clusterLabel)s,namespace,pod) (
1,
max by (%(clusterLabel)s,namespace,pod) (kube_pod_info{host_network="false"})
)
)
||| % $._config)
+ prometheus.withInstant(true)
+ prometheus.withFormat('table'),

prometheus.new('${datasource}', 'sum by (namespace) (rate(container_network_receive_packets_dropped_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s]) * on (%(clusterLabel)s,namespace,pod) kube_pod_info{host_network="false"})' % $._config)
prometheus.new('${datasource}', |||
sum by (namespace) (
rate(container_network_receive_packets_dropped_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s])
* on (%(clusterLabel)s,namespace,pod) group_left ()
topk by (%(clusterLabel)s,namespace,pod) (
1,
max by (%(clusterLabel)s,namespace,pod) (kube_pod_info{host_network="false"})
)
)
||| % $._config)
+ prometheus.withInstant(true)
+ prometheus.withFormat('table'),

prometheus.new('${datasource}', 'sum by (namespace) (rate(container_network_transmit_packets_dropped_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s]) * on (%(clusterLabel)s,namespace,pod) kube_pod_info{host_network="false"})' % $._config)
prometheus.new('${datasource}', |||
sum by (namespace) (
rate(container_network_transmit_packets_dropped_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s])
* on (%(clusterLabel)s,namespace,pod) group_left ()
topk by (%(clusterLabel)s,namespace,pod) (
1,
max by (%(clusterLabel)s,namespace,pod) (kube_pod_info{host_network="false"})
)
)
||| % $._config)
+ prometheus.withInstant(true)
+ prometheus.withFormat('table'),
])
Expand Down Expand Up @@ -213,8 +301,16 @@ local var = g.dashboard.variable;
+ tsPanel.standardOptions.withUnit('binBps')
+ tsPanel.queryOptions.withTargets([
prometheus.new(
'${datasource}',
'avg by (namespace) (rate(container_network_receive_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s]) * on (%(clusterLabel)s,namespace,pod) kube_pod_info{host_network="false"})' % $._config
'${datasource}', |||
avg by (namespace) (
rate(container_network_receive_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s])
* on (%(clusterLabel)s,namespace,pod) group_left ()
topk by (%(clusterLabel)s,namespace,pod) (
1,
max by (%(clusterLabel)s,namespace,pod) (kube_pod_info{host_network="false"})
)
)
||| % $._config
)
+ prometheus.withLegendFormat('__auto'),
]),
Expand All @@ -223,8 +319,16 @@ local var = g.dashboard.variable;
+ tsPanel.standardOptions.withUnit('binBps')
+ tsPanel.queryOptions.withTargets([
prometheus.new(
'${datasource}',
'avg by (namespace) (rate(container_network_transmit_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s]) * on (%(clusterLabel)s,namespace,pod) kube_pod_info{host_network="false"})' % $._config
'${datasource}', |||
avg by (namespace) (
rate(container_network_transmit_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s])
* on (%(clusterLabel)s,namespace,pod) group_left ()
topk by (%(clusterLabel)s,namespace,pod) (
1,
max by (%(clusterLabel)s,namespace,pod) (kube_pod_info{host_network="false"})
)
)
||| % $._config
)
+ prometheus.withLegendFormat('__auto'),
]),
Expand All @@ -233,8 +337,16 @@ local var = g.dashboard.variable;
+ tsPanel.standardOptions.withUnit('binBps')
+ tsPanel.queryOptions.withTargets([
prometheus.new(
'${datasource}',
'sum by (namespace) (rate(container_network_receive_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s]) * on (%(clusterLabel)s,namespace,pod) kube_pod_info{host_network="false"})' % $._config
'${datasource}', |||
sum by (namespace) (
rate(container_network_receive_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s])
* on (%(clusterLabel)s,namespace,pod) group_left ()
topk by (%(clusterLabel)s,namespace,pod) (
1,
max by (%(clusterLabel)s,namespace,pod) (kube_pod_info{host_network="false"})
)
)
||| % $._config
)
+ prometheus.withLegendFormat('__auto'),
]),
Expand All @@ -243,37 +355,81 @@ local var = g.dashboard.variable;
+ tsPanel.standardOptions.withUnit('binBps')
+ tsPanel.queryOptions.withTargets([
prometheus.new(
'${datasource}',
'sum by (namespace) (rate(container_network_transmit_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s]) * on (%(clusterLabel)s,namespace,pod) kube_pod_info{host_network="false"})' % $._config
'${datasource}', |||
sum by (namespace) (
rate(container_network_transmit_bytes_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s])
* on (%(clusterLabel)s,namespace,pod) group_left ()
topk by (%(clusterLabel)s,namespace,pod) (
1,
max by (%(clusterLabel)s,namespace,pod) (kube_pod_info{host_network="false"})
)
)
||| % $._config
)
+ prometheus.withLegendFormat('__auto'),
]),

tsPanel.new('Rate of Received Packets')
+ tsPanel.standardOptions.withUnit('pps')
+ tsPanel.queryOptions.withTargets([
prometheus.new('${datasource}', 'sum by (namespace) (rate(container_network_receive_packets_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s]) * on (%(clusterLabel)s,namespace,pod) kube_pod_info{host_network="false"})' % $._config)
prometheus.new('${datasource}', |||
sum by (namespace) (
rate(container_network_receive_packets_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s])
* on (%(clusterLabel)s,namespace,pod) group_left ()
topk by (%(clusterLabel)s,namespace,pod) (
1,
max by (%(clusterLabel)s,namespace,pod) (kube_pod_info{host_network="false"})
)
)
||| % $._config)
+ prometheus.withLegendFormat('__auto'),
]),

tsPanel.new('Rate of Transmitted Packets')
+ tsPanel.standardOptions.withUnit('pps')
+ tsPanel.queryOptions.withTargets([
prometheus.new('${datasource}', 'sum by (namespace) (rate(container_network_transmit_packets_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s]) * on (%(clusterLabel)s,namespace,pod) kube_pod_info{host_network="false"})' % $._config)
prometheus.new('${datasource}', |||
sum by (namespace) (
rate(container_network_transmit_packets_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s])
* on (%(clusterLabel)s,namespace,pod) group_left ()
topk by (%(clusterLabel)s,namespace,pod) (
1,
max by (%(clusterLabel)s,namespace,pod) (kube_pod_info{host_network="false"})
)
)
||| % $._config)
+ prometheus.withLegendFormat('__auto'),
]),

tsPanel.new('Rate of Received Packets Dropped')
+ tsPanel.standardOptions.withUnit('pps')
+ tsPanel.queryOptions.withTargets([
prometheus.new('${datasource}', 'sum by (namespace) (rate(container_network_receive_packets_dropped_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s]) * on (%(clusterLabel)s,namespace,pod) kube_pod_info{host_network="false"})' % $._config)
prometheus.new('${datasource}', |||
sum by (namespace) (
rate(container_network_receive_packets_dropped_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s])
* on (%(clusterLabel)s,namespace,pod) group_left ()
topk by (%(clusterLabel)s,namespace,pod) (
1,
max by (%(clusterLabel)s,namespace,pod) (kube_pod_info{host_network="false"})
)
)
||| % $._config)
+ prometheus.withLegendFormat('__auto'),
]),

tsPanel.new('Rate of Transmitted Packets Dropped')
+ tsPanel.standardOptions.withUnit('pps')
+ tsPanel.queryOptions.withTargets([
prometheus.new('${datasource}', 'sum by (namespace) (rate(container_network_transmit_packets_dropped_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s]) * on (%(clusterLabel)s,namespace,pod) kube_pod_info{host_network="false"})' % $._config)
prometheus.new('${datasource}', |||
sum by (namespace) (
rate(container_network_transmit_packets_dropped_total{%(clusterLabel)s="$cluster",namespace!=""}[%(grafanaIntervalVar)s])
* on (%(clusterLabel)s,namespace,pod) group_left ()
topk by (%(clusterLabel)s,namespace,pod) (
1,
max by (%(clusterLabel)s,namespace,pod) (kube_pod_info{host_network="false"})
)
)
||| % $._config)
+ prometheus.withLegendFormat('__auto'),
]),

Expand Down

0 comments on commit 2ea98c7

Please sign in to comment.