Skip to content

Commit

Permalink
support multiple cluster grafana dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangphuocbk committed Nov 14, 2024
1 parent d283c01 commit 816d451
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 19 deletions.
56 changes: 47 additions & 9 deletions dashboards/grafana/ephemeral-storage-namespaces.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "Prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"annotations": {
"list": [
{
Expand All @@ -24,7 +34,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "${datasource}"
},
"description": "Current ephemeral byte usage of a pod",
"fieldConfig": {
Expand Down Expand Up @@ -105,10 +115,10 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "sum(ephemeral_storage_pod_usage{pod_namespace=~\"${namespace}\"})",
"expr": "sum(ephemeral_storage_pod_usage{cluster=~\"$cluster\", pod_namespace=~\"${namespace}\"})",
"format": "time_series",
"hide": false,
"instant": false,
Expand All @@ -124,7 +134,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "${datasource}"
},
"description": "Current ephemeral byte usage of a pod",
"fieldConfig": {
Expand Down Expand Up @@ -205,10 +215,10 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "ephemeral_storage_pod_usage{pod_namespace=~\"${namespace}\"}",
"expr": "ephemeral_storage_pod_usage{cluster=~\"$cluster\", pod_namespace=~\"${namespace}\"}",
"format": "time_series",
"hide": false,
"instant": false,
Expand Down Expand Up @@ -245,6 +255,34 @@
"skipUrlSync": false,
"type": "datasource"
},
{
"current": {
"isNone": true,
"selected": false,
"text": "None",
"value": ""
},
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"definition": "label_values(ephemeral_storage_container_volume_usage,cluster)",
"hide": 0,
"includeAll": false,
"multi": false,
"name": "cluster",
"options": [],
"query": {
"qryType": 1,
"query": "label_values(ephemeral_storage_container_volume_usage,cluster)",
"refId": "PrometheusVariableQueryEditor-VariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"type": "query"
},
{
"current": {
"selected": true,
Expand All @@ -255,7 +293,7 @@
"type": "prometheus",
"uid": "${datasource}"
},
"definition": "label_values(ephemeral_storage_container_volume_usage,pod_namespace)",
"definition": "label_values(ephemeral_storage_container_volume_usage{cluster=~\"$cluster\"},pod_namespace)",
"hide": 0,
"includeAll": false,
"label": "Namespace",
Expand All @@ -264,7 +302,7 @@
"options": [],
"query": {
"qryType": 1,
"query": "label_values(ephemeral_storage_container_volume_usage,pod_namespace)",
"query": "label_values(ephemeral_storage_container_volume_usage{cluster=~\"$cluster\"},pod_namespace)",
"refId": "PrometheusVariableQueryEditor-VariableQuery"
},
"refresh": 2,
Expand All @@ -280,7 +318,7 @@
"to": "now"
},
"timepicker": {},
"timezone": "utc",
"timezone": "",
"title": "Kubernetes / Ephemeral Storage Namespaces",
"version": 1,
"weekStart": ""
Expand Down
58 changes: 48 additions & 10 deletions dashboards/grafana/ephemeral-storage-nodes.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "Prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"annotations": {
"list": [
{
Expand All @@ -24,7 +34,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "${datasource}"
},
"description": "Storage usage in bytes by namespaces on the Kubernetes cluster",
"fieldConfig": {
Expand Down Expand Up @@ -105,7 +115,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "sum by (pod_namespace) (ephemeral_storage_pod_usage{node_name=~\"${node}\"})",
Expand All @@ -124,7 +134,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "${datasource}"
},
"description": "Total capacity of the ephemeral storage for nodes with their usage bytes",
"fieldConfig": {
Expand Down Expand Up @@ -205,7 +215,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "ephemeral_storage_node_capacity{node_name=~\"${node}\"}",
Expand All @@ -220,7 +230,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "ephemeral_storage_node_capacity{node_name=~\"${node}\"} - ephemeral_storage_node_available{node_name=~\"${node}\"}",
Expand All @@ -239,7 +249,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "${datasource}"
},
"description": "Percentage of ephemeral storage used on nodes",
"fieldConfig": {
Expand Down Expand Up @@ -320,7 +330,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "ephemeral_storage_node_percentage{node_name=~\"${node}\"}\r\n",
Expand Down Expand Up @@ -360,6 +370,34 @@
"skipUrlSync": false,
"type": "datasource"
},
{
"current": {
"isNone": true,
"selected": false,
"text": "None",
"value": ""
},
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"definition": "label_values(ephemeral_storage_node_capacity,cluster)",
"hide": 0,
"includeAll": false,
"multi": false,
"name": "cluster",
"options": [],
"query": {
"qryType": 1,
"query": "label_values(ephemeral_storage_node_capacity,cluster)",
"refId": "PrometheusVariableQueryEditor-VariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"type": "query"
},
{
"allValue": ".*",
"current": {
Expand All @@ -383,7 +421,7 @@
"type": "prometheus",
"uid": "${datasource}"
},
"definition": "label_values(ephemeral_storage_node_capacity,node_name)",
"definition": "label_values(ephemeral_storage_node_capacity{cluster=~\"$cluster\"},node_name)",
"hide": 0,
"includeAll": false,
"label": "node",
Expand All @@ -392,7 +430,7 @@
"options": [],
"query": {
"qryType": 1,
"query": "label_values(ephemeral_storage_node_capacity,node_name)",
"query": "label_values(ephemeral_storage_node_capacity{cluster=~\"$cluster\"},node_name)",
"refId": "PrometheusVariableQueryEditor-VariableQuery"
},
"refresh": 2,
Expand All @@ -408,7 +446,7 @@
"to": "now"
},
"timepicker": {},
"timezone": "utc",
"timezone": "",
"title": "Kubernetes / Ephemeral Storage Nodes",
"version": 1,
"weekStart": ""
Expand Down

0 comments on commit 816d451

Please sign in to comment.