Fix calculation of OpenStack resource usage
The current version incorrectly calculates resources usage
percentage: number of used resource divided by number of
free resource instead of total number of resources.
Change the calculation to use sum of used and free resources
as a denominator.
Change-Id: I415eb9de7252cb8ee02be789560f4001c0dec197
diff --git a/devops_portal/files/grafana_dashboards/cloud_usage_dashboard.json b/devops_portal/files/grafana_dashboards/cloud_usage_dashboard.json
index 7596000..6b305f7 100644
--- a/devops_portal/files/grafana_dashboards/cloud_usage_dashboard.json
+++ b/devops_portal/files/grafana_dashboards/cloud_usage_dashboard.json
@@ -70,7 +70,7 @@
"tableColumn": "",
"targets": [
{
- "expr": "openstack_nova_total_used_vcpus / openstack_nova_total_free_vcpus * 100",
+ "expr": "openstack_nova_total_used_vcpus / (openstack_nova_total_free_vcpus + openstack_nova_total_used_vcpus) * 100",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
@@ -148,7 +148,7 @@
"tableColumn": "Value",
"targets": [
{
- "expr": "openstack_nova_total_used_ram / openstack_nova_total_free_ram * 100",
+ "expr": "openstack_nova_total_used_ram / (openstack_nova_total_free_ram + openstack_nova_total_used_ram) * 100",
"format": "time_series",
"interval": "5m",
"intervalFactor": 1,
@@ -227,7 +227,7 @@
"tableColumn": "",
"targets": [
{
- "expr": "openstack_nova_total_used_disk / openstack_nova_total_free_disk * 100",
+ "expr": "openstack_nova_total_used_disk / (openstack_nova_total_free_disk + openstack_nova_total_used_disk) * 100",
"format": "time_series",
"intervalFactor": 2,
"metric": "openstack_nova_total_free_disk",
diff --git a/devops_portal/files/grafana_dashboards/csm_dashboard.json b/devops_portal/files/grafana_dashboards/csm_dashboard.json
index e649d00..dde26f3 100644
--- a/devops_portal/files/grafana_dashboards/csm_dashboard.json
+++ b/devops_portal/files/grafana_dashboards/csm_dashboard.json
@@ -937,7 +937,7 @@
"tableColumn": "",
"targets": [
{
- "expr": "openstack_nova_total_used_vcpus / openstack_nova_total_free_vcpus * 100",
+ "expr": "openstack_nova_total_used_vcpus / (openstack_nova_total_free_vcpus + openstack_nova_total_used_vcpus)* 100",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
@@ -1015,7 +1015,7 @@
"tableColumn": "Value",
"targets": [
{
- "expr": "openstack_nova_total_used_ram / openstack_nova_total_free_ram * 100",
+ "expr": "openstack_nova_total_used_ram / (openstack_nova_total_free_ram + openstack_nova_total_used_ram) * 100",
"format": "time_series",
"interval": "5m",
"intervalFactor": 1,
@@ -1094,7 +1094,7 @@
"tableColumn": "",
"targets": [
{
- "expr": "openstack_nova_total_used_disk / openstack_nova_total_free_disk * 100",
+ "expr": "openstack_nova_total_used_disk / (openstack_nova_total_free_disk + openstack_nova_total_used_disk) * 100",
"format": "time_series",
"intervalFactor": 2,
"metric": "openstack_nova_total_free_disk",
diff --git a/devops_portal/files/grafana_dashboards/openstack_availability.json b/devops_portal/files/grafana_dashboards/openstack_availability.json
index 2c96698..a298e12 100644
--- a/devops_portal/files/grafana_dashboards/openstack_availability.json
+++ b/devops_portal/files/grafana_dashboards/openstack_availability.json
@@ -937,7 +937,7 @@
"tableColumn": "",
"targets": [
{
- "expr": "openstack_nova_total_used_vcpus / openstack_nova_total_free_vcpus * 100",
+ "expr": "openstack_nova_total_used_vcpus / (openstack_nova_total_used_vcpus + openstack_nova_total_free_vcpus) * 100",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
@@ -1015,7 +1015,7 @@
"tableColumn": "Value",
"targets": [
{
- "expr": "openstack_nova_total_used_ram / openstack_nova_total_free_ram * 100",
+ "expr": "openstack_nova_total_used_ram / (openstack_nova_total_free_ram + openstack_nova_total_used_ram) * 100",
"format": "time_series",
"interval": "5m",
"intervalFactor": 1,
@@ -1094,7 +1094,7 @@
"tableColumn": "",
"targets": [
{
- "expr": "openstack_nova_total_used_disk / openstack_nova_total_free_disk * 100",
+ "expr": "openstack_nova_total_used_disk / (openstack_nova_total_free_disk + openstack_nova_total_used_ram) * 100",
"format": "time_series",
"intervalFactor": 2,
"metric": "openstack_nova_total_free_disk",