iamseth / oracledb_exporter

Prometheus Oracle database exporter.
MIT License
470 stars 242 forks source link

Different results between metric and Oracle query #457

Open Masa-luke opened 3 weeks ago

Masa-luke commented 3 weeks ago

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.

Masa-luke commented 1 week ago

Hello everyone, can no one help me with this problem? Thanks.