[openstack-exporter-k8s] Correct the Ceph dectect variable in dashboard

The query for `Ceph Shared Storage` variable returned both values 0 and 1 when a shared Ceph config is detected, since the `or` operator in promql returns both values when evaluating between two terms that both have data.
This can be simply fixed by wrapping a max() around the expression.

Change-Id: Idb64b57185020f8b38b540e501fd2e01b180b247
Signed-off-by: Quang Ngo <quang.ngo@canonical.com>
This commit is contained in:
Quang Ngo
2025-08-01 17:13:25 +10:00
parent 24e1efb495
commit 9ceebc26ae
2 changed files with 4 additions and 4 deletions

View File

@@ -1682,7 +1682,7 @@
"datasource": {
"uid": "${prometheusds}"
},
"definition": "query_result(((ceph_cluster_total_bytes or vector(0) > bool(0)) * scalar(stddev(openstack_nova_local_storage_available_bytes) < bool(1e8)) * scalar(abs(sum(ceph_cluster_total_bytes or vector(0)) - max(openstack_nova_local_storage_available_bytes)) < bool(5e9))))",
"definition": "query_result(max(((ceph_cluster_total_bytes or vector(0)) > bool(0)) * scalar(stddev(openstack_nova_local_storage_available_bytes) < bool(1e8)) * scalar(abs(sum(ceph_cluster_total_bytes or vector(0)) - max(openstack_nova_local_storage_available_bytes)) < bool(5e9))))",
"description": "Detect if Ceph is used as shared backend storage (no ephemeral available)",
"error": null,
"hide": 0,
@@ -1692,7 +1692,7 @@
"name": "ceph_without_ephemeral",
"options": [],
"query": {
"query": "query_result(((ceph_cluster_total_bytes or vector(0) > bool(0)) * scalar(stddev(openstack_nova_local_storage_available_bytes) < bool(1e8)) * scalar(abs(sum(ceph_cluster_total_bytes or vector(0)) - max(openstack_nova_local_storage_available_bytes)) < bool(5e9))))",
"query": "query_result(max(((ceph_cluster_total_bytes or vector(0)) > bool(0)) * scalar(stddev(openstack_nova_local_storage_available_bytes) < bool(1e8)) * scalar(abs(sum(ceph_cluster_total_bytes or vector(0)) - max(openstack_nova_local_storage_available_bytes)) < bool(5e9))))",
"refId": "${prometheusds}-ceph_without_ephemeral-Variable-Query"
},
"refresh": 1,

View File

@@ -2378,7 +2378,7 @@
"datasource": {
"uid": "${prometheusds}"
},
"definition": "query_result(((ceph_cluster_total_bytes or vector(0) > bool(0)) * scalar(stddev(openstack_nova_local_storage_available_bytes) < bool(1e8)) * scalar(abs(sum(ceph_cluster_total_bytes or vector(0)) - max(openstack_nova_local_storage_available_bytes)) < bool(5e9))))",
"definition": "query_result(max(((ceph_cluster_total_bytes or vector(0)) > bool(0)) * scalar(stddev(openstack_nova_local_storage_available_bytes) < bool(1e8)) * scalar(abs(sum(ceph_cluster_total_bytes or vector(0)) - max(openstack_nova_local_storage_available_bytes)) < bool(5e9))))",
"description": "Detect if Ceph is used as shared backend storage (no ephemeral available)",
"error": null,
"hide": 0,
@@ -2388,7 +2388,7 @@
"name": "ceph_without_ephemeral",
"options": [],
"query": {
"query": "query_result(((ceph_cluster_total_bytes or vector(0) > bool(0)) * scalar(stddev(openstack_nova_local_storage_available_bytes) < bool(1e8)) * scalar(abs(sum(ceph_cluster_total_bytes or vector(0)) - max(openstack_nova_local_storage_available_bytes)) < bool(5e9))))",
"query": "query_result(max(((ceph_cluster_total_bytes or vector(0)) > bool(0)) * scalar(stddev(openstack_nova_local_storage_available_bytes) < bool(1e8)) * scalar(abs(sum(ceph_cluster_total_bytes or vector(0)) - max(openstack_nova_local_storage_available_bytes)) < bool(5e9))))",
"refId": "${prometheusds}-ceph_without_ephemeral-Variable-Query"
},
"refresh": 1,