Skip to content

Commit 96f09fe

Browse files
authored
Merge pull request #175 from wiremind/master
Pod dashboard : add requests/limits, PV dashboard: fix UID + fix namespaces not being shown
2 parents 0e1fdfc + 549155c commit 96f09fe

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

config.libsonnet

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
'k8s-cluster-rsrc-use.json': 'uXQldxzqUNgIOUX6FyZNvqgP2vgYb78daNu4GiDc',
3535
'k8s-node-rsrc-use.json': 'E577CMUOwmPsxVVqM9lj40czM1ZPjclw7hGa7OT7',
3636
'nodes.json': 'kcb9C2QDe4IYcjiTOmYyfhsImuzxRcvwWC3YLJPS',
37+
'persistentvolumesusage.json': 'AhCeikee0xoa6faec0Weep2nee6shaiquigahw8b',
3738
'pods.json': 'AMK9hS0rSbSz7cKjPHcOtk6CGHFjhSHwhbQ3sedK',
3839
'statefulset.json': 'dPiBt0FRG5BNYo0XJ4L0Meoc7DWs9eL40c1CRc1g',
3940
'k8s-resources-windows-cluster.json': '4d08557fd9391b100730f2494bccac68',

dashboards/persistentvolumesusage.libsonnet

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ local gauge = promgrafonnet.gauge;
6262
dashboard.new(
6363
'%(dashboardNamePrefix)sPersistent Volumes' % $._config.grafanaK8s,
6464
time_from='now-7d',
65-
uid=($._config.grafanaDashboardIDs['nodes.json']),
65+
uid=($._config.grafanaDashboardIDs['persistentvolumesusage.json']),
6666
tags=($._config.grafanaK8s.dashboardTags),
6767
).addTemplate(
6868
{
@@ -94,7 +94,7 @@ local gauge = promgrafonnet.gauge;
9494
template.new(
9595
'namespace',
9696
'$datasource',
97-
'label_values(kubelet_volume_stats_capacity_bytes{%(clusterLabel)s="$cluster", %(kubeletSelector)s}, exported_namespace)' % $._config,
97+
'label_values(kubelet_volume_stats_capacity_bytes{%(clusterLabel)s="$cluster", %(kubeletSelector)s}, namespace)' % $._config,
9898
label='Namespace',
9999
refresh='time',
100100
)
@@ -103,7 +103,7 @@ local gauge = promgrafonnet.gauge;
103103
template.new(
104104
'volume',
105105
'$datasource',
106-
'label_values(kubelet_volume_stats_capacity_bytes{%(clusterLabel)s="$cluster", %(kubeletSelector)s, exported_namespace="$namespace"}, persistentvolumeclaim)' % $._config,
106+
'label_values(kubelet_volume_stats_capacity_bytes{%(clusterLabel)s="$cluster", %(kubeletSelector)s, namespace="$namespace"}, persistentvolumeclaim)' % $._config,
107107
label='PersistentVolumeClaim',
108108
refresh='time',
109109
)

dashboards/pods.libsonnet

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ local numbersinglestat = promgrafonnet.numbersinglestat;
2929
legendFormat='Current: {{ container_name }}',
3030
))
3131
.addTarget(prometheus.target(
32-
'sum by(container) (kube_pod_container_resource_requests_memory_bytes{%(kubeStateMetricsSelector)s, %(clusterLabel)s="$cluster", namespace="$namespace", pod="$pod", container=~"$container"})' % $._config,
32+
'sum by(container) (kube_pod_container_resource_requests{%(kubeStateMetricsSelector)s, %(clusterLabel)s="$cluster", namespace="$namespace", resource="memory", pod="$pod", container=~"$container"})' % $._config,
3333
legendFormat='Requested: {{ container }}',
3434
))
3535
.addTarget(prometheus.target(
36-
'sum by(container) (kube_pod_container_resource_limits_memory_bytes{%(kubeStateMetricsSelector)s, %(clusterLabel)s="$cluster", namespace="$namespace", pod="$pod", container=~"$container"})' % $._config,
36+
'sum by(container) (kube_pod_container_resource_limits{%(kubeStateMetricsSelector)s, %(clusterLabel)s="$cluster", namespace="$namespace", resource="memory", pod="$pod", container=~"$container"})' % $._config,
3737
legendFormat='Limit: {{ container }}',
3838
))
3939
);
@@ -55,11 +55,11 @@ local numbersinglestat = promgrafonnet.numbersinglestat;
5555
legendFormat='Current: {{ container_name }}',
5656
))
5757
.addTarget(prometheus.target(
58-
'sum by(container) (kube_pod_container_resource_requests_cpu_cores{%(kubeStateMetricsSelector)s, %(clusterLabel)s="$cluster", namespace="$namespace", pod="$pod", container=~"$container"})' % $._config,
58+
'sum by(container) (kube_pod_container_resource_requests{%(kubeStateMetricsSelector)s, %(clusterLabel)s="$cluster", namespace="$namespace", resource="cpu", pod="$pod", container=~"$container"})' % $._config,
5959
legendFormat='Requested: {{ container }}',
6060
))
6161
.addTarget(prometheus.target(
62-
'sum by(container) (kube_pod_container_resource_limits_cpu_cores{%(kubeStateMetricsSelector)s, %(clusterLabel)s="$cluster", namespace="$namespace", pod="$pod", container=~"$container"})' % $._config,
62+
'sum by(container) (kube_pod_container_resource_limits{%(kubeStateMetricsSelector)s, %(clusterLabel)s="$cluster", namespace="$namespace", resource="cpu", pod="$pod", container=~"$container"})' % $._config,
6363
legendFormat='Limit: {{ container }}',
6464
))
6565
);

0 commit comments

Comments
 (0)