Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Different results between metric and Oracle query #457

@Masa-luke

Description

@Masa-luke

In oracledb_exporter, I noticed that the values collected by the metric on Prometheus are different from those obtained from the same select on the database.

Could anyone tell me why? Where am I going wrong?

Here is the metric from the default-metrics.toml:

[[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." }
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
FROM dba_tablespace_usage_metrics dtum, dba_tablespaces dt
WHERE dtum.tablespace_name = dt.tablespace_name
ORDER by tablespace
'''

From Prometheus, I get the following results, for example:

oracledb_tablespace_bytes{instance="xxx.xx.x.xx:9161", job="oracle_exporter", tablespace="SYSAUX", type="PERMANENT"} 872939520
oracledb_tablespace_bytes{instance="xxx.xx.x.xx:9161", job="oracle_exporter", tablespace="SYSTEM", type="PERMANENT"} 1020067840

However, on the database, the values are:

TABLESPACE TYPE BYTES MAX_BYTES FREE


SYSAUX PERMANENT 467468288 2.9548E+10 2.9081E+10
SYSTEM PERMANENT 527171584 2.9548E+10 2.9021E+10

Why is the BYTES value different?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions