From e69bfbe5bd9b8c49c8ef49623b7fc367c683be2f Mon Sep 17 00:00:00 2001 From: Chris Kirk Date: Thu, 16 Dec 2021 15:41:55 +0000 Subject: [PATCH] #219 add oracledb_tablespace_used_percent metric --- README.md | 1 + default-metrics.toml | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 80261509..0c0f9050 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ The following metrics are exposed currently. - oracledb_tablespace_bytes - oracledb_tablespace_max_bytes - oracledb_tablespace_free +- oracledb_tablespace_used_percent - oracledb_process_count - oracledb_resource_current_utilization - oracledb_resource_limit_value diff --git a/default-metrics.toml b/default-metrics.toml index 28c7e93e..0a5a3d1d 100644 --- a/default-metrics.toml +++ b/default-metrics.toml @@ -45,14 +45,15 @@ WHERE [[metric]] context = "tablespace" labels = [ "tablespace", "type" ] -metricsdesc = { bytes = "Generic counter metric of tablespaces bytes in Oracle.", max_bytes = "Generic counter metric of tablespaces max bytes in Oracle.", free = "Generic counter metric of tablespaces free bytes in Oracle." } +metricsdesc = { bytes = "Generic counter metric of tablespaces bytes in Oracle.", max_bytes = "Generic counter metric of tablespaces max bytes in Oracle.", free = "Generic counter metric of tablespaces free bytes in Oracle.", used_percent = "Gauge metric showing as a percentage of how much of the tablespace has been used." } request = ''' SELECT dt.tablespace_name as tablespace, dt.contents as type, dt.block_size * dtum.used_space as bytes, dt.block_size * dtum.tablespace_size as max_bytes, - dt.block_size * (dtum.tablespace_size - dtum.used_space) as free + dt.block_size * (dtum.tablespace_size - dtum.used_space) as free, + dtum.used_percent FROM dba_tablespace_usage_metrics dtum, dba_tablespaces dt WHERE dtum.tablespace_name = dt.tablespace_name ORDER by tablespace