diff --git a/dashboards/network-usage/cluster-total.libsonnet b/dashboards/network-usage/cluster-total.libsonnet index 3bcfe1d28..ed9a5007f 100644 --- a/dashboards/network-usage/cluster-total.libsonnet +++ b/dashboards/network-usage/cluster-total.libsonnet @@ -67,7 +67,15 @@ local var = g.dashboard.variable; + 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 + ||| + 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'), ]), @@ -77,7 +85,15 @@ local var = g.dashboard.variable; + 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 + ||| + 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'), ]), @@ -85,35 +101,115 @@ local var = g.dashboard.variable; 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'), ]) @@ -214,7 +310,16 @@ local var = g.dashboard.variable; + 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 + ||| + 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'), ]), @@ -224,7 +329,16 @@ local var = g.dashboard.variable; + 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 + ||| + 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'), ]), @@ -234,7 +348,16 @@ local var = g.dashboard.variable; + 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 + ||| + 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'), ]), @@ -244,7 +367,16 @@ local var = g.dashboard.variable; + 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 + ||| + 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'), ]), @@ -252,28 +384,68 @@ local var = g.dashboard.variable; 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'), ]),