Code Monkey home page Code Monkey logo

prometheus_oracle_exporter's Introduction

Prometheus Oracle Exporter

A Prometheus exporter for Oracle.

The following metrics are exposed currently. Support for RAC (databasename and instancename added via lables)

  • oracledb_exporter_last_scrape_duration_seconds
  • oracledb_exporter_last_scrape_error
  • oracledb_exporter_scrapes_total
  • oracledb_uptime (days)
  • oracledb_session (view v$session system/user active/passive)
  • oracledb_sysmetric (view v$sysmetric (Physical Read Total IO Requests Per Sec / Physical Write Total IO Requests Per Sec Physical Read Total Bytes Per Sec / Physical Write Total Bytes Per Sec))
  • oracledb_sysstat (view v$sysstat (parse count (total) / execute count / user commits / user rollbacks))
  • oracledb_waitclass (view v$waitclass)
  • oracledb_tablespace (tablespace total/free)
  • oracledb_asmspace (Space in ASM (v$asm_disk/v$asm_diskgroup))
  • oracledb_interconnect (view v$sysstat (gc cr blocks served / gc cr blocks flushed / gc cr blocks received))
  • oracledb_redo (Redo log switches over last 5 min from v$log_history)
  • oracledb_cachehitratio (Cache hit ratios (v$sysmetric)
  • oracledb_up (Whether the Oracle server is up)
  • oracledb_error (Errors parsed from the alert.log)
  • oracledb_error_unix_seconds (Last modified Date of alert.log in Unixtime)
  • oracledb_services (Active Oracle Services (v$active_services))
  • oracledb_parameter (Configuration Parameters (v$parameter))

*TOOK VERY LONG, BE CAREFUL (Put the Metrics below in a separate Scrape-Config):

  • oracledb_tablerows (Number of Rows in Tables)
  • oracledb_tablebytes (Bytes used by Table)
  • oracledb_indexbytes (Bytes used by Indexes of associated Table)
  • oracledb_lobbytes (Bytes used by Lobs of associated Table)
  • oracledb_recovery (percentage usage in FRA from V$RECOVERY_FILE_DEST)

The Oracle Alertlog file is scanned and the metrics are exposed as a gauge metric with a total occurence of the specific ORA. You can define your own Queries and execute/scrape them

Installation

Ensure that the configfile (oracle.conf) is set correctly before starting. You can add multiple instances, e.g. the ASM instance. It is even possible to run one Exporter for all your Databases, but this is not recommended. We use it in our Company because on one host multiple Instances are running.

Custom metrics:

You can add custom queries in config file for scraping (see field queries in example). The query identifier is name parameter. For each query you define columns for metrics (metrics parameter) and columns for labels (labels parameter).

Limitations:

  1. If two queries contains different columns in metrics or labels parameter, then you need use different name for this queries (through the entire config file).
  2. Mandatory params: metrics, name, help
  3. Parameter labels is optional
  4. Columns defined in labels parameter should be CHAR, VARCHAR or NUMBER type.
  5. Columns defined in metrics parameter should be NUMBER type.

Each defined query will provide a set of Prometheus metrics with a name oracledb_custom_<query_name> for every column defined in metrics parameter and for every row in query result. Column defined in metrics will appear in metric label.

Example:

queries:
 - sql: "select 1 as column1, 2 as column2, 3 as label_column from dual"
   name: sample1
   help: "This is my metric number 1"
   metrics:
    - column1
    - column2
   labels:
    - label_column

If this query returns two rows then exporter will provide such set of metrics:

# HELP oracledb_custom_sample1 This is my metric number 1
# TYPE oracledb_custom_sample1 gauge
oracledb_custom_sample1{database="mydb",dbinstance="mydb",metric="column1",label_column="some value 1",rownum="1"} 3.14
oracledb_custom_sample1{database="mydb",dbinstance="mydb",metric="column1",label_column="some value 2",rownum="2"} 6.28
oracledb_custom_sample1{database="mydb",dbinstance="mydb",metric="column2",label_column="some value 1",rownum="1"} 1
oracledb_custom_sample1{database="mydb",dbinstance="mydb",metric="column2",label_column="some value 2",rownum="2"} 2

Prometheus Configuration

scrape_configs:
  - job_name: 'oracle-short'
    metrics_path: /metrics
    static_configs:
      - targets:
        - oracle.host.com:9161
    relabel_configs:
     - source_labels: ['__address__']
       target_label: instance
       regex:  '(.*):\d+'
       replacement: "${1}"

  - job_name: 'oracle-tab'
    scrape_interval: 6h
    scrape_timeout: 120s
    metrics_path: /metrics
    params:
      tablerows: [true]
      lobbytes: [true]
      recovery: [true]
    static_configs:
      - targets:
         - oracle.host.com:9161
    relabel_configs:
     - source_labels: ['__address__']
       target_label: instance
       regex:  '(.*):\d+'
       replacement: "${1}"

  - job_name: 'oracle-ind'
    scrape_interval: 6h
    scrape_timeout: 120s
    metrics_path: /metrics
    params:
      tablebytes: [true]
      indexbytes: [true]
      recovery: [true]
    static_configs:
      - targets:
         - oracle.host.com:9161
    relabel_configs:
     - source_labels: ['__address__']
       target_label: instance
       regex:  '(.*):\d+'
       replacement: "${1}"
export NLS_LANG=AMERICAN_AMERICA.UTF8
/path/to/binary -configfile=/home/user/oracle.conf -web.listen-address :9161

Usage

Usage of ./prometheus_oracle_exporter:
  -accessfile string
    Last access for parsed Oracle Alerts. (default "access.conf")
  -configfile string
    ConfigurationFile in YAML format. (default "oracle.conf")
  -defaultmetrics
    Expose standard metrics (default true)
  -indexbytes
    Expose Index size for any Table (CAN TAKE VERY LONG)
  -lobbytes
    Expose Lobs size for any Table (CAN TAKE VERY LONG)
  -logfile string
    Logfile for parsed Oracle Alerts. (default "exporter.log")
  -recovery
    Expose Recovery percentage usage of FRA (CAN TAKE VERY LONG)
  -tablebytes
    Expose Table size (CAN TAKE VERY LONG)
  -tablerows
    Expose Table rows (CAN TAKE VERY LONG)
  -web.listen-address string
    Address to listen on for web interface and telemetry. (default ":9161")
  -web.telemetry-path string
    Path under which to expose metrics. (default "/metrics")

Grafana

In The folder Grafana are examples of my used Dashboards

Overview

Overview

Tablespace

Tablespace

Transfers

Transfer

Transfers RAC

Transfer RAC

Errors

Errors

prometheus_oracle_exporter's People

Contributors

azet avatar eternalme avatar floyd871 avatar skpenpen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prometheus_oracle_exporter's Issues

exporter breaks down

I started the Exporter. He is started to work, but after 2 minutes he is broke down ( full log is in attach: oracle_exporter.log ). Maybe i took the wrong grant from in ORACLE the user (MONITORING).

Grant ORACLE user from monitoring (MONITORING):

CREATE USER $USER identified by $USER default tablespace $USER;
grant CREATE MATERIALIZED VIEW to $USER;
grant CREATE VIEW to $USER;
grant CREATE ANY INDEX to $USER;
grant CREATE TABLE to $USER;
grant ALTER ANY TABLE TO $USER;
grant CREATE SEQUENCE to $USER;
grant CREATE SESSION to $USER;
grant CREATE TYPE to $USER;
grant SELECT ANY TABLE to $USER;
grant SELECT ANY DICTIONARY to $USER;
grant UNLIMITED TABLESPACE to $USER;
grant QUERY REWRITE to $USER;
grant UPDATE ANY TABLE to $USER;

Exporter config:

---
connections:
  - connection: MONITORING/ORACLE_EXPORTER@pele5:1521/armsdev2
    database: armsdev2
    instance: armsdev2
    alertlog:
      - file: /data/oracle/diag/rdbms/develop/DEVELOP/trace/alert_DEVELOP.log
        ignoreora:
          - ORA-00001
          - ORA-01033
          - ORA-01041
          - ORA-01089
          - ORA-01555
          - ORA-28
          - ORA-235
          - ORA-609
          - ORA-3136
    queries:
    - name: sample1
      sql: select 1 from dual`

Log error (full log in attache: oracle_exporter.log)

time="2018-10-11T09:40:55+03:00" level=info msg="Starting Prometheus Oracle exporter 1.1.0" source="main.go:938"
time="2018-10-11T09:40:55+03:00" level=info msg="Config loaded:  /home/monitoring/monitoring/conf/oracle_exporter/oracle_exporter.yml" source="main.go:940"
time="2018-10-11T09:40:55+03:00" level=info msg="Listening on :9161" source="main.go:948"
time="2018-10-11T09:41:07+03:00" level=info msg="open /data/oracle/diag/rdbms/develop/DEVELOP/trace/alert_DEVELOP.log: no such file or directory" source="alertlog.go:120"
time="2018-10-11T09:41:20+03:00" level=info msg="open /data/oracle/diag/rdbms/develop/DEVELOP/trace/alert_DEVELOP.log: no such file or directory" source="alertlog.go:120"
time="2018-10-11T09:41:22+03:00" level=info msg="open /data/oracle/diag/rdbms/develop/DEVELOP/trace/alert_DEVELOP.log: no such file or directory" source="alertlog.go:120"
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x68 pc=0x7fc8744acb1d]

runtime stack:
runtime.throw(0x8d9c65, 0x2a)
	/usr/lib/go-1.10/src/runtime/panic.go:616 +0x81
runtime.sigpanic()
	/usr/lib/go-1.10/src/runtime/signal_unix.go:372 +0x28e

oracle_exporter.log

Can your give me some recommendation about that?

Initial query failed

Thank You for Your work on this Exporter!
I am working with your product and i have a problem with it, if You will be able to help me, i will appreciate it.

The problem is: when Exporter connecting with ORACLE, i got the following error:

time="2018-10-05T11:51:26+03:00" level=info msg="Connect OK, Inital query failed: exporter_test/exporter_test@TEST09" source="main.go:789"

The connection way was: created file $ vim ~/tnsnames.ora

TEST09=                                                                                                                                                                     
(DESCRIPTION=                                                                                                                                                               
  (ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.200)(PORT=1521)                                                                                                                           
  )                                                                                                                                                                         
  (CONNECT_DATA=                                                                                                                                                            
    (SID=test09)                                                                                                                                                            
  )                                                                                                                                                                         
) 

Exporter config:

connections:
  - connection: exporter_test/exporter_test@TEST09
    database: TEST09
    instance: TEST09
    alertlog:
      - file: /data/oracle/diag/rdbms/develop/DEVELOP/trace/alert_DEVELOP.log
        ignoreora:
          - ORA-00001
          - ORA-01033
          - ORA-01041
          - ORA-01089
          - ORA-01555
          - ORA-28
          - ORA-235
          - ORA-609
          - ORA-3136
    queries:
     - sql: "select 1 from dual"
       name: sample1
     - sql: "select 2 from dual"
       name: sample2​

Hope to hear from You soon!
Best Regards

Prometheus Configuration steps for /path/to/binary

Hi all,
Under "Prometheus Configuration" section, "/path/to/binary -configfile=/home/user/oracle.conf -web.listen-address :9161" is not clear me. Here I am not getting what is "/path/to/binary" mean, is it oracle client or /usr/bin/ path, or which file I need to replace with? I have RHEL7.3

$ /path/to/binary -configfile=/home/user/oracle.conf -web.listen-address :9161
-bash: /path/to/binary: No such file or directory
$

can someone help me what is "/path/to/binary" path in this context?

Missing metrics on oracle-short

I have setup oracle_export 1.1.1 on Centos 6.9 64bit with Oracle 11.2.0.4.0.
I can set oracle-short UP (with blue) in prometheus target. However, I run below commands without data return:
curl -s http://localhost:9161/metrics|grep oracledb_uptime
curl -s http://localhost:9161/metrics|grep oracledb_session

Starting command is as below:
/usr/local/bin/oracle_exporter -configfile "/home/appuser/oracle.conf"
INFO[0000] Starting Prometheus Oracle exporter 1.1.1 source="main.go:940"
INFO[0000] Config loaded: /home/appuser/oracle.conf source="main.go:942"
INFO[0000] Listening on :9161 source="main.go:950"

Content of the configfile(/home/appuser/oracle.conf) is as below:
connections:

  • connection: /@
    database: WSCTEST
    instance: wsctest
    alertlog:
    • file: /home/wang/app/oracle/diag/rdbms/wsctest/wsctest/trace/alert_wsctest.log
      ignoreora:
      • ORA-00001
      • ORA-01033
      • ORA-01041
      • ORA-01089
      • ORA-01555
      • ORA-28
      • ORA-235
      • ORA-609
      • ORA-3136
        queries:
    • sql: "select 1 from dual"
      name: sample1
    • sql: "select 2 from dual"
      name: sample2

Can't found Oracle errors in grafana dashboard

Hello !

Thanks for your new release of prometheus_oracle_exporter with multiples tables query.

I want to know why exporter don't prinf Oracle error like ORA-01089 in alert_instance.log

Thanks for your reply.

counter for v$sysstat

Thanks for the work on this exporter! I'm just curious if you might consider using a counter metric type for some of these metrics, especially those that come from v$sysstat? My understanding is that the values exposed by that view are always increasing and would thus fit very nicely with Prometheus counter type metric.

With new version 1.1.4 exporter multi column value

Hi @floyd871 Thanks for release multi column support Exporter.

Issue is , which multi column value exporter not able to display proper output. Mean column1 as "name" and column2 as "value" .

For instance,
exporter o/p:
oracledb_query{column="value ",database="orcl",dbinstance="orcl",name="test",row="9"} 208

sql : SELECT component, current_size/1024/1024 as value FROM v$sga_dynamic_components where component='shared pool';

we are expecting exporter o/p like :
oracledb_query{column="shared pool",database="orcl",dbinstance="orcl",name="test",row="9"} 208

Can you please suggest how can we achieve this ?

No more than two instances supported for scraping metrics

Hi,

Apparently the way this exporter is written its not possible to enumerate more than two databases/instances. While it enumerates all possible alertlog files it doesn't do DB queries to scrape for interconnect, tablespace, service, sysstat, or waitclass.

Example of a live configuration with 8 instances, 7 of them active:

...
lots of metrics before with only two instances from the config file reflected in them
...

oracledb_up{database="DEDI1",dbinstance="DEDI1"} 1
oracledb_up{database="PARCH1",dbinstance="PARCH1"} 1
oracledb_up{database="PCOOP1",dbinstance="PCOOP1"} 1
oracledb_up{database="PEXITE1",dbinstance="PEXITE1"} 1
oracledb_up{database="PGEN1",dbinstance="PGEN1"} 0
oracledb_up{database="PINT1",dbinstance="PINT1"} 1
oracledb_up{database="PSTERI1",dbinstance="PSTERI1"} 1
oracledb_up{database="TEDI1",dbinstance="TEDI1"} 1
# HELP oracledb_uptime Gauge metric with uptime in days of the Instance.
# TYPE oracledb_uptime gauge
oracledb_uptime{database="PEXITE1",dbinstance="PEXITE12"} 30.667696759259258
oracledb_uptime{database="TEDI1",dbinstance="TEDI11"} 30.67241898148148
# HELP oracledb_waitclass Gauge metric with Waitevents (v$waitclassmetric).
# TYPE oracledb_waitclass gauge
oracledb_waitclass{database="PEXITE1",dbinstance="PEXITE12",type="administrative"} 0
oracledb_waitclass{database="PEXITE1",dbinstance="PEXITE12",type="application"} 0
oracledb_waitclass{database="PEXITE1",dbinstance="PEXITE12",type="cluster"} 0.012
oracledb_waitclass{database="PEXITE1",dbinstance="PEXITE12",type="commit"} 0.033
oracledb_waitclass{database="PEXITE1",dbinstance="PEXITE12",type="concurrency"} 0.001
oracledb_waitclass{database="PEXITE1",dbinstance="PEXITE12",type="configuration"} 0
oracledb_waitclass{database="PEXITE1",dbinstance="PEXITE12",type="network"} 0
oracledb_waitclass{database="PEXITE1",dbinstance="PEXITE12",type="other"} 0.015
oracledb_waitclass{database="PEXITE1",dbinstance="PEXITE12",type="scheduler"} 0
oracledb_waitclass{database="PEXITE1",dbinstance="PEXITE12",type="system_io"} 0.034
oracledb_waitclass{database="PEXITE1",dbinstance="PEXITE12",type="user_io"} 0.003
oracledb_waitclass{database="TEDI1",dbinstance="TEDI11",type="administrative"} 0
oracledb_waitclass{database="TEDI1",dbinstance="TEDI11",type="application"} 0
oracledb_waitclass{database="TEDI1",dbinstance="TEDI11",type="cluster"} 0
oracledb_waitclass{database="TEDI1",dbinstance="TEDI11",type="commit"} 0.001
oracledb_waitclass{database="TEDI1",dbinstance="TEDI11",type="concurrency"} 0
oracledb_waitclass{database="TEDI1",dbinstance="TEDI11",type="configuration"} 0
oracledb_waitclass{database="TEDI1",dbinstance="TEDI11",type="network"} 0
oracledb_waitclass{database="TEDI1",dbinstance="TEDI11",type="other"} 0.011
oracledb_waitclass{database="TEDI1",dbinstance="TEDI11",type="scheduler"} 0
oracledb_waitclass{database="TEDI1",dbinstance="TEDI11",type="system_io"} 0.015
oracledb_waitclass{database="TEDI1",dbinstance="TEDI11",type="user_io"} 0.005

I think the reason is that the scrape functions just do a simple .Next() and don't iterate over all entries that the config file offers.

impossible to connect

Hello,
I try https://github.com/iamseth/oracledb_exporter
when I do this call

export DATA_SOURCE_NAME=USER/PASSWORD@localhost/DATABASE
./oracledb_exporter

I got the information and the database is considered as UP

When i try with this exporter with the configuration file

connections:
 - connection: USER/PASSWORD
   database: DATABASE
   instance: DATABASE
   alertlog:
    - file: /oracle/diag/rdbms/....log
      ignoreora:
       - ORA-00001
       - ORA-01033
       - ORA-01041
       - ORA-01089
       - ORA-01555
       - ORA-28
       - ORA-235
       - ORA-609
       - ORA-3136
   queries:
    - sql: "select 1 from dual"
      name: sample1

the database is down but I didn't see anything.

Add possibility to filter by instance in grafana ?

Hi,

I have two oracle database with same SID (there are clones but hosted on different servers) and in Grafana dashboard I can't differenciate databases.

Please, Is it possible to add a new tab for filter by instance ? (actualy there are only filters for database and dbinstance)

thank you.

How can I disable the alertlog feature?

Cause I'm running the exporter on a specific server monitoring all oracle database, I can't reach the alert log from the server, so I want to disable this feature by deleting the alertlog field in the config, but the exporter can't startup if I do so.

Exporter service failing with "slice index out of range" error

Hi

The oracle prometheus exporter service is failing after a few days on several of our servers. The error in the messages file is below...

Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: panic: reflect: slice index out of range [recovered]
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: panic: reflect: slice index out of range
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: goroutine 560646 [running]:
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: gopkg.in/yaml%2ev2.handleErr(0xc00085db98)
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: /home/mneumann3/go/src/gopkg.in/yaml.v2/yaml.go:249 +0x9a
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: panic(0x8dd840, 0xa3f140)
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: /usr/lib/go-1.12/src/runtime/panic.go:522 +0x1b5
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: reflect.Value.Index(0x8d3780, 0x10062a0, 0x197, 0xe, 0xc0000d5408, 0x199, 0x199)
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: /usr/lib/go-1.12/src/reflect/value.go:925 +0x20c
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: gopkg.in/yaml%2ev2.(*encoder).slicev(0xc0000d8000, 0x0, 0x0, 0x8d3780, 0x10062a0, 0x197)
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: /home/mneumann3/go/src/gopkg.in/yaml.v2/encode.go:272 +0x1c1
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: gopkg.in/yaml%2ev2.(*encoder).marshal(0xc0000d8000, 0x0, 0x0, 0x8d3780, 0x10062a0, 0x197)
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: /home/mneumann3/go/src/gopkg.in/yaml.v2/encode.go:166 +0x404
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: gopkg.in/yaml%2ev2.(*encoder).structv.func1()
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: /home/mneumann3/go/src/gopkg.in/yaml.v2/encode.go:226 +0x299
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: gopkg.in/yaml%2ev2.(*encoder).mappingv(0xc0000d8000, 0x0, 0x0, 0xc0000e5530)
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: /home/mneumann3/go/src/gopkg.in/yaml.v2/encode.go:256 +0x147
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: gopkg.in/yaml%2ev2.(*encoder).structv(0xc0000d8000, 0x0, 0x0, 0x91e480, 0x10062a0, 0x199)
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: /home/mneumann3/go/src/gopkg.in/yaml.v2/encode.go:213 +0xf7
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: gopkg.in/yaml%2ev2.(*encoder).marshal(0xc0000d8000, 0x0, 0x0, 0x91e480, 0x10062a0, 0x199)
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: /home/mneumann3/go/src/gopkg.in/yaml.v2/encode.go:160 +0x718
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: gopkg.in/yaml%2ev2.(*encoder).marshal(0xc0000d8000, 0x0, 0x0, 0x8c75e0, 0x10062a0, 0x16)
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: /home/mneumann3/go/src/gopkg.in/yaml.v2/encode.go:154 +0x591
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: gopkg.in/yaml%2ev2.(*encoder).marshalDoc(0xc0000d8000, 0x0, 0x0, 0x8c75e0, 0x10062a0, 0x16)
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: /home/mneumann3/go/src/gopkg.in/yaml.v2/encode.go:93 +0x10f
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: gopkg.in/yaml%2ev2.Marshal(0x8c75e0, 0x10062a0, 0x0, 0x0, 0x0, 0x0, 0x0)
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: /home/mneumann3/go/src/gopkg.in/yaml.v2/yaml.go:203 +0x329
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: main.WriteAccess()
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: /home/mneumann3/go/src/github.com/freenetgigital/prometheus_oracle_exporter/misc.go:91 +0x3d
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: main.(*Exporter).ScrapeAlertlog(0xc000150300)
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: /home/mneumann3/go/src/github.com/freenetgigital/prometheus_oracle_exporter/alertlog.go:152 +0xba6
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: main.(*Exporter).Collect(0xc000150300, 0xc0004ad320)
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: /home/mneumann3/go/src/github.com/freenetgigital/prometheus_oracle_exporter/main.go:881 +0x2d3
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: /home/mneumann3/go/src/github.com/prometheus/client_golang/prometheus/registry.go:442 +0x19d
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
Nov 25 15:48:54 cs-tc3-oracle-liv1 prometheus_oracle_exporter-amd64[4005]: /home/mneumann3/go/src/github.com/prometheus/client_golang/prometheus/registry.go:453 +0x56e
Nov 25 15:48:54 cs-tc3-oracle-liv1 systemd[1]: systemd-oracledp-exporter.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Nov 25 15:49:01 cs-tc3-oracle-liv1 systemd[1]: Created slice User Slice of root.

the service file looks like this...

[Unit]
Description=Oracle Database Exporter for Prometheus
DefaultDependencies=no

[Service]
User=oracle
Group=oinstall
Environment=ORACLE_HOME=/u01/app/oracle/product/18.4.0/dbhome_1
Environment=LD_LIBRARY_PATH=/u01/app/oracle/product/18.4.0/dbhome_1/lib
Environment=PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/oracle/Scripts:/u01/app/oracle/product/18.4.0/dbhome_1/bin
Type=simple
RemainAfterExit=yes
ExecStart=/home/oracle/prometheus_oracle_exporter/prometheus_oracle_exporter-amd64 -configfile=/home/oracle/prometheus_oracle_exporter/oracle.conf -web.listen-address :9161

any ideas what the problem would be ??

Missing metric oracledb_recovery

Hi, first of all I want to thank you for this very useful exporter.

Since the upgrade from 1.1.1 to 1.1.2 one metric does not work anymore for me as seen below.

1.1.1:

# curl -s http://localhost:9161/metrics |grep oracledb_recovery
# HELP oracledb_recovery Gauge metric with percentage usage of FRA (v$recovery_file_dest).
# TYPE oracledb_recovery gauge
oracledb_recovery{database="mivudb",dbinstance="mivudb",type="percent_space_reclaimable"} 1.39
oracledb_recovery{database="mivudb",dbinstance="mivudb",type="percent_space_used"} 16.63
#

1.1.2:

# curl -s http://localhost:9161/metrics |grep oracledb_recovery
#

All other metrics are presenting values when using the 1.1.2 version.

I make use of the precompiled binaries from the release page.

Specs: RHEL7 and Oracle 11gR2

Exporter Crashes on Logfile with non UTF8 Chars

Hi There,

my exporter is crashing when it's trying to read a logfile which contains "non UTF8" Chars.

INFO[0000] Starting Prometheus Oracle exporter 1.1.3 source="main.go:942"
INFO[0000] Config loaded: /etc/prometheus-oracle.yml source="main.go:944"
INFO[0000] Listening on :9161 source="main.go:952"
panic: label value "Fehler beim autom Ausf\xfchren von Job 128" is not valid UTF-8

goroutine 34 [running]:
github.com/prometheus/client_golang/prometheus.(*GaugeVec).WithLabelValues(0xc000132128, 0xc0002ef360, 0x5, 0x5, 0x100ee40, 0x0)
/root/go/src/github.com/prometheus/client_golang/prometheus/gauge.go:217 +0xe0
main.(*Exporter).ScrapeAlertlog(0xc000150100)
/usr/local/prometheus_oracle_exporter11/alertlog.go:145 +0x825
main.(*Exporter).Collect(0xc000150100, 0xc0001405a0)
/usr/local/prometheus_oracle_exporter11/main.go:879 +0x2c6
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
/root/go/src/github.com/prometheus/client_golang/prometheus/registry.go:442 +0x19d
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
/root/go/src/github.com/prometheus/client_golang/prometheus/registry.go:534 +0xdf8

from the alert log:
ORA-12012: Fehler beim autom Ausfhren von Job 128

i just fixed the log, but you might want to have a look at it if you like ;)

Start up error: error while loading shared libraries: libclntsh.so.12.1

Hello,
I am getting below error when starting the exporter.

[root@seliicbl01060 prometheus]# /root/prometheus/prometheus_oracle_exporter-amd64 -configfile=/root/prometheus/oracle.conf -web.listen-address :9161
/root/prometheus/prometheus_oracle_exporter-amd64: error while loading shared libraries: libclntsh.so.12.1: cannot open shared object file: No such file or directory

System Information:
[oracle@seliicbl01060 dpdump]$ $ORACLE_HOME/OPatch/opatch lsinventory | awk '/^Oracle Database/ {print $NF}'
12.2.0.1.0

Find file from error:
[root@seliicbl01060 prometheus]# find / -name libclntsh* -ls 2>/dev/null
109193783 7848 -rwxr-x--- 1 oracle dba 8033199 Apr 12 2019 /opt/oracle/product/12gr2/db/inventory/Scripts/ext/lib/libclntshcore.so.12.1
109193786 69960 -rwxr-x--- 1 oracle dba 71638263 Apr 12 2019 /opt/oracle/product/12gr2/db/inventory/Scripts/ext/lib/libclntsh.so.12.1
511713792 7848 -rw-r----- 1 oracle dba 8033199 Apr 12 2019 /opt/oracle/product/12gr2/db/inventory/backup/2019-04-12_06-58-35PM/Scripts/ext/lib/libclntshcore.so.12.1
511713795 69960 -rw-r----- 1 oracle dba 71638263 Apr 12 2019 /opt/oracle/product/12gr2/db/inventory/backup/2019-04-12_06-58-35PM/Scripts/ext/lib/libclntsh.so.12.1
251662958 0 lrwxrwxrwx 1 oracle dba 17 Apr 12 2019 /opt/oracle/product/12gr2/db/lib/libclntsh.so -> libclntsh.so.12.1
251814403 7848 -rwxr-xr-x 1 oracle dba 8033608 Apr 12 2019 /opt/oracle/product/12gr2/db/lib/libclntshcore.so.12.1
251814406 69964 -rwxr-xr-x 1 oracle dba 71640160 Apr 12 2019 /opt/oracle/product/12gr2/db/lib/libclntsh.so.12.1
251814408 0 lrwxrwxrwx 1 oracle dba 12 Apr 12 2019 /opt/oracle/product/12gr2/db/lib/libclntsh.so.10.1 -> libclntsh.so
251814409 0 lrwxrwxrwx 1 oracle dba 12 Apr 12 2019 /opt/oracle/product/12gr2/db/lib/libclntsh.so.11.1 -> libclntsh.so
251658785 0 lrwxrwxrwx 1 oracle dba 21 Apr 12 2019 /opt/oracle/product/12gr2/db/lib/libclntshcore.so -> libclntshcore.so.12.1

about TS

We are have a metrics (name="SCHEMA_DEV4"):
oracledb_tablespace{autoextend="NO",contents="PERMANENT",database="uat",dbinstance="uat",instance="box99-07:9161",job="automatique",name="SCHEMA_DEV4",node="lhpm99-07",team="devops",type="free"}537902055424 oracledb_tablespace{autoextend="NO",contents="PERMANENT",database="uat",dbinstance="uat",instance="box99-07:9161",job="automatique",name="SCHEMA_DEV4",node="lhpm99-07",team="devops",type="total"}1064062418944 oracledb_tablespace{autoextend="NO",contents="PERMANENT",database="uat",dbinstance="uat",instance="box99-07:9161",job="automatique",name="SCHEMA_DEV4",node="lhpm99-07",team="devops",type="used"}526160363520 oracledb_tablespace{autoextend="YES",contents="PERMANENT",database="uat",dbinstance="uat",instance="box99-07:9161",job="automatique",name="SCHEMA_DEV4",node="lhpm99-07",team="devops",type="free"}537902055424 oracledb_tablespace{autoextend="YES",contents="PERMANENT",database="uat",dbinstance="uat",instance="box99-07:9161",job="automatique",name="SCHEMA_DEV4",node="lhpm99-07",team="devops",type="total"}343588847616 oracledb_tablespace{autoextend="YES",contents="PERMANENT",database="uat",dbinstance="uat",instance="box99-07:9161",job="automatique",name="SCHEMA_DEV4",node="lhpm99-07",team="devops",type="used"}-194313207808
But I got six metrics insted of three.

I sent query:

select * from dba_data_files where tablespace_name='SCHEMA_DEV4';

I got following answer:
`

FILE_ID TABLESPACE_NAME BYTES BLOCKS STATUS RELATIVE_FNO AUTOEXTENSIBLE MAXBYTES MAXBLOCKS INCREMENT_BY USER_BYTES USER_BLOCKS ONLINE_STATUS
21 SCHEMA_DEV4 33 285 996 544 4 063 232 AVAILABLE 21 NO 0 0 0 33284947968 4 063 104 ONLINE
26 SCHEMA_DEV4 34 358 689 792 4 194 176 AVAILABLE 26 NO 0 0 0 34357641216 4 194 048 ONLINE
27 SCHEMA_DEV4 34 358 689 792 4 194 176 AVAILABLE 27 NO 0 0 0 34357641216 4 194 048 ONLINE
30 SCHEMA_DEV4 34 358 689 792 4 194 176 AVAILABLE 30 NO 0 0 0 34357641216 4 194 048 ONLINE
31 SCHEMA_DEV4 34 358 689 792 4 194 176 AVAILABLE 31 NO 0 0 0 34357641216 4 194 048 ONLINE
41 SCHEMA_DEV4 34 358 689 792 4 194 176 AVAILABLE 41 NO 0 0 0 34357641216 4 194 048 ONLINE
42 SCHEMA_DEV4 34 358 689 792 4 194 176 AVAILABLE 42 NO 0 0 0 34357641216 4 194 048 ONLINE
43 SCHEMA_DEV4 34 358 689 792 4 194 176 AVAILABLE 43 NO 0 0 0 34357641216 4 194 048 ONLINE
57 SCHEMA_DEV4 32 212 254 720 3 932 160 AVAILABLE 57 NO 0 0 0 32211206144 3 932 032 ONLINE
32 SCHEMA_DEV4 34 358 689 792 4 194 176 AVAILABLE 32 NO 0 0 0 34357641216 4 194 048 ONLINE
33 SCHEMA_DEV4 34 358 689 792 4 194 176 AVAILABLE 33 NO 0 0 0 34357641216 4 194 048 ONLINE
34 SCHEMA_DEV4 34 358 689 792 4 194 176 AVAILABLE 34 NO 0 0 0 34357641216 4 194 048 ONLINE
35 SCHEMA_DEV4 34 358 689 792 4 194 176 AVAILABLE 35 NO 0 0 0 34357641216 4 194 048 ONLINE
36 SCHEMA_DEV4 34 358 689 792 4 194 176 AVAILABLE 36 NO 0 0 0 34357641216 4 194 048 ONLINE
37 SCHEMA_DEV4 34 358 689 792 4 194 176 AVAILABLE 37 NO 0 0 0 34357641216 4 194 048 ONLINE
60 SCHEMA_DEV4 34 358 689 792 4 194 176 AVAILABLE 60 NO 0 0 0 34357641216 4 194 048 ONLINE
61 SCHEMA_DEV4 34 358 689 792 4 194 176 AVAILABLE 61 NO 0 0 0 34357641216 4 194 048 ONLINE
62 SCHEMA_DEV4 17 179 869 184 2 097 152 AVAILABLE 62 NO 0 0 0 17178820608 2 097 024 ONLINE
78 SCHEMA_DEV4 33 285 996 544 4 063 232 AVAILABLE 78 NO 0 0 0 33284947968 4 063 104 ONLINE
79 SCHEMA_DEV4 33 285 996 544 4 063 232 AVAILABLE 79 NO 0 0 0 33284947968 4 063 104 ONLINE
80 SCHEMA_DEV4 33 285 996 544 4 063 232 AVAILABLE 80 NO 0 0 0 33284947968 4 063 104 ONLINE
81 SCHEMA_DEV4 33 285 996 544 4 063 232 AVAILABLE 81 NO 0 0 0 33284947968 4 063 104 ONLINE
82 SCHEMA_DEV4 33 285 996 544 4 063 232 AVAILABLE 82 NO 0 0 0 33284947968 4 063 104 ONLINE
83 SCHEMA_DEV4 33 285 996 544 4 063 232 AVAILABLE 83 NO 0 0 0 33284947968 4 063 104 ONLINE
84 SCHEMA_DEV4 33 285 996 544 4 063 232 AVAILABLE 84 NO 0 0 0 33284947968 4 063 104 ONLINE
85 SCHEMA_DEV4 33 285 996 544 4 063 232 AVAILABLE 85 NO 0 0 0 33284947968 4 063 104 ONLINE
86 SCHEMA_DEV4 33 285 996 544 4 063 232 AVAILABLE 86 NO 0 0 0 33284947968 4 063 104 ONLINE
87 SCHEMA_DEV4 33 285 996 544 4 063 232 AVAILABLE 87 NO 0 0 0 33284947968 4 063 104 ONLINE
88 SCHEMA_DEV4 33 285 996 544 4 063 232 AVAILABLE 88 NO 0 0 0 33284947968 4 063 104 ONLINE
89 SCHEMA_DEV4 33 285 996 544 4 063 232 AVAILABLE 89 NO 0 0 0 33284947968 4 063 104 ONLINE
90 SCHEMA_DEV4 33 285 996 544 4 063 232 AVAILABLE 90 NO 0 0 0 33284947968 4 063 104 ONLINE
91 SCHEMA_DEV4 33 285 996 544 4 063 232 AVAILABLE 91 NO 0 0 0 33284947968 4 063 104 ONLINE
7 SCHEMA_DEV4 34 359 721 984 4 194 302 AVAILABLE 7 YES 34 359 721 984 4 194 302 12 800 34358624256 4 194 168 ONLINE
12 SCHEMA_DEV4 34 359 721 984 4 194 302 AVAILABLE 12 YES 34 359 721 984 4 194 302 12 800 34358624256 4 194 168 ONLINE
14 SCHEMA_DEV4 34 351 349 760 4 193 280 AVAILABLE 14 YES 34 359 721 984 4 194 302 12 800 34350301184 4 193 152 ONLINE
15 SCHEMA_DEV4 34 359 721 984 4 194 302 AVAILABLE 15 YES 34 359 721 984 4 194 302 12 800 34358624256 4 194 168 ONLINE
16 SCHEMA_DEV4 34 359 721 984 4 194 302 AVAILABLE 16 YES 34 359 721 984 4 194 302 262 144 34358624256 4 194 168 ONLINE
17 SCHEMA_DEV4 34 359 721 984 4 194 302 AVAILABLE 17 YES 34 359 721 984 4 194 302 262 144 34358624256 4 194 168 ONLINE
23 SCHEMA_DEV4 34 359 721 984 4 194 302 AVAILABLE 23 YES 34 359 721 984 4 194 302 1 34358624256 4 194 168 ONLINE
24 SCHEMA_DEV4 34 359 721 984 4 194 302 AVAILABLE 24 YES 34 359 721 984 4 194 302 262 144 34358624256 4 194 168 ONLINE
25 SCHEMA_DEV4 34 359 721 984 4 194 302 AVAILABLE 25 YES 34 359 721 984 4 194 302 262 144 34358624256 4 194 168 ONLINE
53 SCHEMA_DEV4 34 359 721 984 4 194 302 AVAILABLE 53 YES 34 359 721 984 4 194 302 1 34358624256 4 194 168 ONLINE
`
default

Maybe we have created wrong TS ? Or where the problem is ?

Table space Metrics showing -ve values

Hi
I am getting table space used values in negative number.

oracledb_tablespace{autoextend="NO",contents="UNDO",database="XXXX",dbinstance="XXXX",exporter_id="freenetdigital",instance="XXXX",job="oracle_health",name="UNDOTBS1",type="used"} -33856094208
oracledb_tablespace{autoextend="YES",,contents="UNDO",database="XXXX",dbinstance="XXXX",exporter_id="freenetdigital",instance="XXXX",job="oracle_health",name="UNDOTBS1",type="used"} -570114048

Can you please check it asap.

undefined: prometheus.Handler

seeing following error with latest version

bash-4.2# go build
# _/prometheus_oracle_exporter
./main.go:938:3: undefined: prometheus.Handler
bash-4.2#

prometheus_oracle_exporter: error while loading shared libraries:

I have a problem when I start the service:

prometheus_oracle_exporter: /usr/local/bin/prometheus_oracle_exporter: error while loading shared libraries: libclntsh.so.12.1: cannot open shared object file: No such file or directory

I have my env correct:

export ORACLE_BASE=/orasoft/oracle/product
export ORACLE_HOME=$ORACLE_BASE/12.2.0.1/db
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:/usr/local/bin:$PATH

And the library exist but don´t work:

[root@aquilesoralxvd012 system]# find / -name libclntsh.so.12.1
/oracw/grid/product/12.2.0.1/grid/lib/libclntsh.so.12.1
/oracw/grid/product/12.2.0.1/grid/inventory/Scripts/ext/lib/libclntsh.so.12.1
/oracw/grid/product/12.2.0.1/grid/inventory/backup/2019-05-21_11-47-08AM/Scripts/ext/lib/libclntsh.so.12.1
/orasoft/oracle/agent13c/agent_13.2.0.0.0/instantclient/libclntsh.so.12.1
/orasoft/oracle/product/12.2.0.1/db/lib/libclntsh.so.12.1
/orasoft/oracle/product/12.2.0.1/db/inventory/backup/2019-05-21_12-22-54PM/Scripts/ext/lib/libclntsh.so.12.1
/orasoft/oracle/product/12.2.0.1/db/inventory/Scripts/ext/lib/libclntsh.so.12.1

Any idea for fix this ?

Not able to select multiple column query added in oracle.conf file

Hi Michael,

This oracle exporter is superb.
But have some complication here , While selecting multiple column in oracle.conf file, then exporter is not able to collect the data.

For Instance,

select name, db_unique_name from gv$database. ---------> This is not work
select count(1) from gv$database. ---------> This working fine.

Can you please help to resolve this issue. Even it is better if we can select multiple column as we wish in query in oracle.conf file.
Looking forward for your response.

[Question] Drop necessary DBA metrics

Hi @floyd871.
Thanks a lot for your work on exporter.

I have only one question, is there a official way to drop neccesary DBA metrics?
My idea is run clean exporter to scrape self-defined selects only.
How to do this?

Best regards, Lorus.

oracle exporter error

I am facing the below error while running the exporter as mentioned in your blog please help what i am missing

[root@localhost ~]# ./prometheus_oracle_exporter-amd64 --configfile=/root/prometheus-2.14.0.linux-amd64/oracle.conf --web.listen-address :9161
INFO[0000] Starting Prometheus Oracle exporter 1.1.4 source="main.go:963"
FATA[0000] error: yaml: unmarshal errors:
line 45: cannot unmarshal !!map into string source="misc.go:72"

panic: runtime error: index out of range

When I try to run the ./prometheus_oracle_exporter-amd64 I get an index out of range problem that is given by:

panic: runtime error: index out of range

goroutine 13 [running]:
main.(*Exporter).ScrapeAlertlog(0xc420198100)
/home/mneumann3/repo/prometheus_oracle_exporter/alertlog.go:117 +0xc4c
main.(*Exporter).Collect(0xc420198100, 0xc4200785a0)
/home/mneumann3/repo/prometheus_oracle_exporter/main.go:875 +0x31c
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
/home/mneumann3/go/src/github.com/prometheus/client_golang/prometheus/registry.go:409 +0x5c
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
/home/mneumann3/go/src/github.com/prometheus/client_golang/prometheus/registry.go:418 +0x4ac

Question on building?

I am new to this process, but can you provide the steps to create the binary for this exporter?

How to build pormoetheus Oracle exporter

Hello @floyd871

Thank you for your great job.

Can you tell us or give us your Makefile for build Oracle Prometheus exporter step by step ?

It is good job but if we want to continuous your work, we need the way for compile your exporter.

Sincerely,

oracledb_query

For oracledb_query how do I use queries with multiple values in output?

For example, i'm execute query like this

SELECT COUNT(1) FROM object_info oi,cad_qual_dev.v$_onew_request_status v WHERE v.code = oi.status AND oi.status IN (004,002) AND oi.date_registration >= TRUNC(sysdate) AND oi.address_code IN ('40.0.0.0','30.0.0.0') AND oi.kind = 2 GROUP BY oi.status, v.name
with this result
COUNT(1)
7255
582

But, exporter gives only the last result

# TYPE oracledb_query gauge
oracledb_query{database="XXX",dbinstance="XXX",name="cnt_pckt_xxx"} 582

But, i'm need give all values, and divide them into separate metrics, how can i do this?

Or. this is a better example

SELECT oi.status, COUNT(1) FROM object_info oi, cad_qual_dev.v$_onew_request_status v WHERE v.code = oi.status AND oi.date_registration >= trunc(sysdate) AND oi.address_code IN ('40.0.0.0','30.0.0.0') AND oi.kind = 2 GROUP BY oi.status

And two column in output
STATUS COUNT(1)
003 2
004 7227
002 307
001 1921

how to scrape oracledb_recovery metric

Hi, first of all thank you for this very useful exporter.

So should i run binary with flag to scrape oracledb_recovery metric
-recovery
Expose Recovery percentage usage of FRA (CAN TAKE VERY LONG)
, or just use params in prometheus scrape config ?
Becouse now when i try to scrape this metric I can't do it

curl -s 'host:9161/metrics?recovery=true' | grep oracledb_recovery

but i can scrape other metrics

curl -s 'host:9161/metrics?recovery=true' |grep oracledb_up
# HELP oracledb_up Whether the Oracle server is up.
# TYPE oracledb_up gauge
oracledb_up{database="LWTER.internal",dbinstance="LWTER"} 1

Support of old version Oracle

Hello @floyd871

It is good ulility for Oracle DB monitoring. But I have Oracle 11.2 and can not use this tool for monitoring. How I can rebuild your exporter to support old version of Oracle?

prometheus_oracle_exporter Abnormal exit !

time="2019-07-04T14:13:49+08:00" level=info msg="Starting Prometheus Oracle exporter 1.1.1" source="main.go:940"
time="2019-07-04T14:13:49+08:00" level=info msg="Config loaded: /u01/exporter/oracle.conf" source="main.go:942"
time="2019-07-04T14:13:49+08:00" level=info msg="Listening on :9161" source="main.go:950"
panic: label value "\xd3û\xa7\xc7\xeb\xc7\xf3ȡ\xcf\xfb\xb5\xb1ǰ\xb5IJ\xd9\xd7\xf7" is not valid UTF-8

goroutine 19 [running]:
github.com/prometheus/client_golang/prometheus.(*GaugeVec).WithLabelValues(0xc42000e220, 0xc420606320, 0x5, 0x5, 0xc4200ce7e0, 0x68)
/home/mneumann3/go/src/github.com/prometheus/client_golang/prometheus/gauge.go:217 +0x91
main.(*Exporter).ScrapeAlertlog(0xc42002e100)
/home/mneumann3/go/src/github.com/freenetgigital/prometheus_oracle_exporter/alertlog.go:138 +0x8b9
main.(*Exporter).Collect(0xc42002e100, 0xc4200d0ea0)
/home/mneumann3/go/src/github.com/freenetgigital/prometheus_oracle_exporter/main.go:877 +0x31c
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
/home/mneumann3/go/src/github.com/prometheus/client_golang/prometheus/registry.go:434 +0x199
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
/home/mneumann3/go/src/github.com/prometheus/client_golang/prometheus/registry.go:526 +0xe90

Checking `asm_disk[group]_stat` instead of or as an alternative to `asm_disk[group[`

asm_disk[group] performs a discovery on each query, this increases overhead on the database. Per Oracle's documentation there is also asm_disk[group]_stat, which is identical to asm_disk[group] but without the discovery overhead:

Contains the same columns as V$ASM_DISK, but to reduce overhead, does not perform a discovery when it is queried. V$ASM_DISK_STAT only returns information about any disks that are part of mounted disk groups in the storage system.

The V$ASM_DISK_STAT view is recommended for monitoring scripts.

To display information about all disks, use V$ASM_DISK instead.

Contains the same columns as V$ASM_DISKGROUP, but to reduce overhead, V$ASM_DISKGROUP_STAT does not perform a discovery when it is queried.

The V$ASM_DISKGROUP_STAT view is recommended for monitoring scripts.

To display more complete information about all disks, use V$ASM_DISKGROUP.

We're wondering if we could get the ASM check updated to query this table instead, as it is the intended table for monitoring.

I wanted to make an issue for this to see if there would be any issues that might arise and if it would be better to change the ASM alert to use these _stat tables or maybe to add this as a flag for the installer so that it could be used in lieu of the non-_stat. Either way I can get a PR in, just wanted to know which way would be more ideal.

In my opinion, there shouldn't be a reason that everyone can't just use the _stat tables instead, that's what these are meant for and this would be a net gain. Additionally it shouldn't cause any breaking change.

Alert Rules

Anybody has some alert rules samples for Alertmanager that would like to share here?

Why exporter had many connections

Thank You for Your work on this Exporter!
I am working with your product and i have a question, if You will be able to help me, i will appreciate it.
I connected to the ORACLE and saw:

SQL > select username, count(*) from v$sessions group by username;
USENAME                   COUNT(*)
--------------------------------
USER1                                2
MONITORING                    126
SYS                                     1

We use MONITORING (ORACLE user) for oracle_exporter and it's hold 126 sessions. It is all-time-long fact. Why is this happening?

telegram-cloud-file-2-257901626-255282--373329220835460863

breaking in the graph

Thank You for Your work on this Exporter!
I am working with your product and i have a question, if You will be able to help me, i will appreciate it.
On the graph, which i attached, are able to see some breaking in all-over line, i was wonder what kind of problem that symbolises?
Prometheus config:

# if alertmanager is not defined on this host, statement will raise error

global:
  evaluation_interval: 20s
  external_labels:
    monitor: test54
  scrape_interval: 1m
  scrape_timeout: 55s
alerting:
  alertmanagers:
    - path_prefix: /alertmanager
      static_configs:
        - targets:
          - test54:19093
rule_files:
- /home/mon/monitoring/conf/prometheus/rules/*.yml
scrape_configs:
- job_name: blackboxes
  metrics_path: "/probe"
  file_sd_configs:
  - files:
    - /home/mon/monitoring/conf/prometheus/files_sd/blackboxes_*.yml
    refresh_interval: 30s
  scrape_interval: 1m
  relabel_configs:
    - source_labels: [__address__]
      regex: "([a-zA-Z0-9]+)://(([A-Za-z0-9.-]+)(?::([0-9]+))?)?(/[a-zA-Z0-9_/-]+)?(?:,([a-zA-Z0-9_]+))?#([a-z0-9-]+):([0-9]+)"
      replacement: '$2$5'
      target_label: __param_target
    - source_labels: [__address__]
      regex: "(https?)://(([A-Za-z0-9.-]+)(?::([0-9]+))?)?(/[a-zA-Z0-9_/-]+)?(?:,([a-zA-Z0-9_]+))?#([a-z0-9-]+):([0-9]+)"
      replacement: '$1://$2$5'
      target_label: __param_target
    - source_labels: [__address__]
      regex: "([a-zA-Z0-9]+)://(([A-Za-z0-9.-]+)(?::([0-9]+))?)?(/[a-zA-Z0-9_/-]+)?(?:,([a-zA-Z0-9_]+))?#([a-z0-9-]+):([0-9]+)"
      replacement: '$1://$2$5'
      target_label: target
    - source_labels: [__address__]
      regex: "([a-zA-Z0-9]+)://(([A-Za-z0-9.-]+)(?::([0-9]+))?)?(/[a-zA-Z0-9_/-]+)?(?:,([a-zA-Z0-9_]+))?#([a-z0-9-]+):([0-9]+)"
      replacement: '$1'
      target_label: __param_module
    - source_labels: ["__address__"]
      regex: "([a-zA-Z0-9]+)://(([A-Za-z0-9.-]+)(?::([0-9]+))?)?(/[a-zA-Z0-9_/-]+)?(?:,([a-zA-Z0-9_]+))?#([a-z0-9-]+):([0-9]+)"
      replacement: '$7'
      target_label: "node"
    - source_labels: [__address__]
      regex: "([a-zA-Z0-9]+)://(([A-Za-z0-9.-]+)(?::([0-9]+))?)?(/[a-zA-Z0-9_/-]+)?(?:,([a-zA-Z0-9_]+))?#([a-z0-9-]+):([0-9]+)"
      replacement: '$6'
      target_label: blackbox_name
    - source_labels: [__address__]
      regex: "([a-zA-Z0-9]+)://(([A-Za-z0-9.-]+)(?::([0-9]+))?)?(/[a-zA-Z0-9_/-]+)?(?:,([a-zA-Z0-9_]+))?#([a-z0-9-]+):([0-9]+)"
      replacement: '$7:$8'
      target_label: __address__
- job_name: automatique
  file_sd_configs:
  - files:
    - /home/mon/monitoring/conf/prometheus/files_sd/auto_*.yml
    refresh_interval: 1m
  scrape_interval: 1m
  relabel_configs:
    - source_labels: ["__address__"]
      target_label:  "__metrics_path__"
      regex: "[A-Za-z0-9-]+:[0-9]+([/a-z]+)(#[a-z0-9]+)?"
    - source_labels: ["__address__"]
      target_label:  "team"
      regex: "[A-Za-z0-9-]+:[0-9]+[/a-z]+(#([a-z0-9]+))?"
      replacement: '$2'
    - source_labels: ["__address__"]
      target_label: "node"
      regex: "([A-Za-z0-9-]+):[0-9]+[/a-z]+(#[a-z0-9]+)?"
    - source_labels: ["__address__"]
      target_label:  "__address__"
      regex: "([A-Za-z0-9-]+:[0-9]+)[/a-z]+(#[a-z0-9]+)?"
  metric_relabel_configs:
    - source_labels: [mountpoint]
      regex: '.+'
      target_label: system
      replacement: 'env'
      action: replace # set default value
    - source_labels: [mountpoint]
      regex: '/home/([a-z]+)_.+'
      target_label: team
      replacement: '$1'
      action: replace
    - source_labels: [mountpoint]
      regex: '/home/ora[a-z0-9]+'
      target_label: system
      replacement: 'oracle'
      action: replace
    - source_labels: [mountpoint]
      regex: '/home/jenkins'
      target_label: system
      replacement: 'jenkins'
      action: replace
    - source_labels: [mountpoint]
      regex: '/home/nexus'
      target_label: system
      replacement: 'nexus'
      action: replace
    - source_labels: [mountpoint]
      regex: '/([a-z0-9_]+)?'
      target_label: system
      replacement: 'infra'
      action: replace
    - source_labels: [mountpoint]
      regex: '/home/([a-z0-9_-]+)'
      target_label: env_name
      replacement: '$1'
      action: replace

image004

image007

SQLNet message from db causes metrics collection to fail.

A database I was monitoring returned a "password expiring in 5 days" message to instant client.
This caused the metrics collection to fail. More seriously, after a couple of hours, the exporter had hundreds of open connection to the database that were not closed as the metrics collection had repeatedly failed. I'm not sure is this a problem with the instant client or the exporter itself, but it is a serious situation if the monitoring tools starts to affect performance of the database itself.
Please advise.

Reusable Queries

It would be a nice if it was possible to define a query outside of the connection definition. Then it could be referenced in the connection settings. This way a single query could be reused by multiple connections, and be updated in one place.

debug mode ?

Hello,
it could be very helpfull to have a debug mode saying for exemple why it's not possible to connect to a database, why something appends, etc

ERRO[0009] Error connecting to database: ORA-12154

ERRO[0009] Error connecting to database: ORA-12154: TNS:could not resolve the connect identifier specified source="main.go:790"
This error shows when i'm opened smt in http://127.0.0.1:9161/metrics
obviously, it's mean, exporter can't connect to DB
It's not crystal clear in what format I should save the settings that describe the database connection
If it's tnsnames.ora, then, where should I put this file?

Can't find libraries

Hello there, I'm trying to install this exporter for an entire day and just can't find the right way, I'm hoping someone here can help...

[root@myserver ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.5 (Santiago)
[root@myserver ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/softplan/prometheus/exporters/dist/lib/
[root@myserver ~]# echo $LD_LIBRARY_PATH
/opt/softplan/prometheus/exporters/dist/lib/
[root@myserver ~]# ls /opt/softplan/prometheus/exporters/dist/lib/
libclntshcore.so.12.1  libclntsh.so.12.1  libipc1.so  libmql1.so  libnnz12.so  libons.so
[root@myserver ~]# cat /etc/init/prometheus-oracle-exporter.conf 
description "Prometheus Oracle Exporter"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [016]

respawn

script
  exec >> "/var/log/prometheus/oracle-exporter.log"
  exec 2>&1
  exec /opt/softplan/prometheus/exporters/oracle_exporter_current/prometheus_oracle_exporter-amd64 -indexbytes -lobbytes -tablebytes -tablerows --configfile=/etc/prometheus/exporters/oracle.conf --web.listen-address=0.0.0.0:9161 

end script
[root@myserver ~]# 
[root@myserver ~]# 
[root@myserver ~]# 
[root@myserver ~]# 
[root@myserver ~]# 
[root@myserver ~]# initctl start prometheus-oracle-exporter && tail -f /var/log/prometheus/oracle-exporter.log 
prometheus-oracle-exporter start/running, process 20267
/opt/softplan/prometheus/exporters/oracle_exporter_current/prometheus_oracle_exporter-amd64: error while loading shared libraries: libclntsh.so.12.1: cannot open shared object file: No such file or directory
/opt/softplan/prometheus/exporters/oracle_exporter_current/prometheus_oracle_exporter-amd64: error while loading shared libraries: libclntsh.so.12.1: cannot open shared object file: No such file or directory
/opt/softplan/prometheus/exporters/oracle_exporter_current/prometheus_oracle_exporter-amd64: error while loading shared libraries: libclntsh.so.12.1: cannot open shared object file: No such file or directory
/opt/softplan/prometheus/exporters/oracle_exporter_current/prometheus_oracle_exporter-amd64: error while loading shared libraries: libclntsh.so.12.1: cannot open shared object file: No such file or directory

As you can see, I have my libs in a custom path, but it is set both on the PATH env and LD_LIBRARY_PATH env...
Why oracle-exporter can't find them?

oracledb_query (Self defined Queries in Configuration File) not running

config file:
connections:

  • connection: /*@tnsname
    database: ***
    instance: ***
    alertlog:

    • file: alert.log
      ignoreora:
      • ORA-00001
      • ORA-01033
      • ORA-01041

    queries:

    • sql: "select count(*) from dbo.AUDITTRAIL"
      name: sa03

with above config i am not able to get any query output
can you please help

Having hard time to start the service

I have followed all the instructions but unable to start the service getting below error please help:

[oracle@localhost prometheus_oracle_exporter-master]$ ./prometheus_oracle_exporter-amd64 --configfile=/u01/userhome/oracle/scripts/prometheus_oracle_exporter-master/oracle.conf --web.listen-address :9161
INFO[0000] Starting Prometheus Oracle exporter 1.1.1 source="main.go:940"
FATA[0000] error: yaml: unmarshal errors:
line 45: cannot unmarshal !!map into string source="misc.go:72"

I am using go version 1.9 on oel7 linux

go version go1.9.2 linux/amd64

Oracle exporter stop running

Hello,

I have this problem when i run exporter service.

label value "TNS : l'identificateur de connexion indiqu\xe9 n'a pas pu \xeatre r\xe9solu" is not valid UTF-8
github.com/prometheus/client_golang/prometheus.(*GaugeVec).WithLabelValues(0xc0001400d8, 0xc0003bb7c0, 0x5, 0x5, 0x1006e40, 0x0)
/home/mneumann3/go/src/github.com/prometheus/client_golang/prometheus/gauge.go:217 +0xe0
main.(*Exporter).ScrapeAlertlog(0xc000146100)
/home/mneumann3/go/src/github.com/freenetgigital/prometheus_oracle_exporter/alertlog.go:138 +0x802
main.(*Exporter).Collect(0xc000146100, 0xc0001ce240)
/home/mneumann3/go/src/github.com/freenetgigital/prometheus_oracle_exporter/main.go:881 +0x2d3
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
/home/mneumann3/go/src/github.com/prometheus/client_golang/prometheus/registry.go:442 +0x19d
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
/home/mneumann3/go/src/github.com/prometheus/client_golang/prometheus/registry.go:453 +0x56e

Can you please tell me if it is exporter problem or my OS service ?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.