Follow these sections to create the Gauge dashboard type for the cpu_temperature_celsius
metric.
- Kyma as the target deployment environment.
- Deployed custom kube-prometheus-stack as described in the prometheus example.
- Deployed custom-metrics example.
- Access Grafana.
- Add a new dashboard with a new panel.
- For your new query, select Prometheus from the data source selector.
- Pick the
cpu_temperature_celsius
metric. - To retrieve the latest metric value on demand, activate the Instant switch.
- From the visualization panels, select the Gauge dashboard type.
- Save your changes and provide a name for the dashboard.
- To edit the dashboard settings, go to the Panel Title options and select Edit.
- Find the Field tab and set the measuring unit to Celsius degrees, indicating the metric data type.
- Set the minimum metric value to
60
and the maximum value to90
, indicating thecpu_temperature_celsius
metric value range. - For the dashboard to turn red once the CPU temperature reaches and exceeds 75°C, set a red color threshold to
75
. - Go to the Panel tab and title the dashboard, for example,
CPU Temperature
. - To display this range on the dashboard, make sure that under Panel > Display, the threshold labels and threshold markers are activated.
- Save your changes. We recommend that you add a note to describe the changes made.
Refresh the browser to see how the dashboard changes according to the current value of the cpu_temperature_celsius
metric.
- If the current metric value ranges from 60 to 74 degrees Celsius, it turns green.
- If the current metric value ranges from 75 to 90 degrees Celsius, it turns red.
When you create a dashboard to monitor one of your applications (Function, microservice,...), we recommend that you define the dashboard as a Kubernetes ConfigMap resource. In this case, a Grafana sidecar automatically loads the Dashboard on Grafana startup. Following that approach, you can easily keep the dashboard definition together with the Kubernetes resource definitions of your application and port it to different clusters.
-
Create a JSON document with the dashboard definition; for example, by exporting it from Grafana.
-
Create a Kubernetes resource with a unique name for your dashboard and the JSON content, like the following example:
apiVersion: v1 kind: ConfigMap metadata: name: {UNIQUE_DASHBOARD_NAME}-grafana-dashboard labels: grafana_dashboard: "1" data: {UNIQUE_DASHBOARD_NAME}-dashboard.json: |- { # dashboard JSON content }
-
To apply the Kubernetes resource created in the previous step to your cluster, run:
kubectl apply -f <{UNIQUE_CONFIGMAP_NAME}.yaml>
-
Restart the Grafana deployment with the following command:
kubectl -n ${K8S_NAMESPACE} rollout restart deployment ${HELM_RELEASE}-grafana