oracle-db-appdev-monitoring icon indicating copy to clipboard operation
oracle-db-appdev-monitoring copied to clipboard

Multiple database support

Open luddevik opened this issue 9 months ago • 7 comments

Is there any update on this feature from the roadmap? We have tested the exporter in our environment, but can't really start using it before we have support for multi-target. Our environment consists of multiple cdbs and pdbs.

luddevik avatar May 16 '24 10:05 luddevik

I'll increase the priority for that feature. I am planning to get another release out in the next couple of weeks. Thanks for your interest! If you have any specific requirements for multi-db please let me know.

markxnelson avatar May 16 '24 11:05 markxnelson

We would like to collect metrics from cdbs and pdbs, so that we can monitor our environment without using the Oracle Enterprise Manager for monitoring.

luddevik avatar May 21 '24 07:05 luddevik

Hi @markxnelson, one question considering Multiple database support. In what way will this be implemented in case I want to monitor CDB and the belonging PDB(s)? Are we going to have 2 entries in service?

sudo systemctl edit oracledb_exporter

[Service]
Environment="DB_USERNAME=db_mon"
Environment="DB_PASSWORD=**********"
Environment="DB_CONNECT_STRING_1=server-name.com:1521/cdbname"
Environment="DB_CONNECT_STRING_2=server-name.com:1521/pdbname"

Or you are going to handle this on a query level? For example, to support CDB and belonging PDB monitoring, I've created CDB queries which also gets the data from PDB.

Example for session query:

[[metric]]
context = "sessions"
labels = [ "container_name", "status", "type" ]
metricsdesc = { value= "Gauge metric with count of sessions by container_name, status and type." }
request = '''
SELECT
    CASE
        WHEN s.con_id = 0 THEN 'Entire CDB'
        WHEN s.con_id = 1 THEN 'CDB$ROOT'
        ELSE p.pdb_name
    END AS container_name,
    --s.con_id,
    s.status,
    s.type,
    COUNT(*) as value
FROM
    v$session s
LEFT JOIN
    cdb_pdbs p ON s.con_id = p.con_id
WHERE s.status='ACTIVE'
AND s.wait_class <> 'Idle'
AND s.username is not null
GROUP BY
    CASE
        WHEN s.con_id = 0 THEN 'Entire CDB'
        WHEN s.con_id = 1 THEN 'CDB$ROOT'
        ELSE p.pdb_name
    END,
    s.status,
    s.type
'''

savoir81 avatar Jun 11 '24 15:06 savoir81

I am still thinking it through. I think I would definitely want to allow people to run different sets of metrics on different databases. So I think I would want to separate the metrics defintion from the database/connection defintion. I guess I would need some kind of mapping or tagging. I am planning to allow metrics to be annotated to say whether they are applicable for cdb/pdb/adb or what combination of those. Maybe also for version of the DB? I am also planning to add the ability to run metrics at different time intervals, since some might be much more expensive to run, and you might not want to run them on every scrape.

I am happy to take any suggestions :)

markxnelson avatar Jun 11 '24 15:06 markxnelson

I am still thinking it through. I think I would definitely want to allow people to run different sets of metrics on different databases. So I think I would want to separate the metrics defintion from the database/connection defintion. I guess I would need some kind of mapping or tagging. I am planning to allow metrics to be annotated to say whether they are applicable for cdb/pdb/adb or what combination of those. Maybe also for version of the DB? I am also planning to add the ability to run metrics at different time intervals, since some might be much more expensive to run, and you might not want to run them on every scrape.

I am happy to take any suggestions :)

sounds good! different time intervals could be so useful! question: do you have in your plans to allow also multihost DSNs (dataguard setups)?

lucian-vanghele avatar Oct 01 '24 14:10 lucian-vanghele

Hi @lucian-vanghele, thanks for your input. We'd be happy to add that to our roadmap. If you have any more detail on exactly what you'd like to see, please let us know!

markxnelson avatar Oct 01 '24 14:10 markxnelson

Hi @lucian-vanghele, thanks for your input. We'd be happy to add that to our roadmap. If you have any more detail on exactly what you'd like to see, please let us know!

On short DB_CONNECT_STRING should accept something like host1:1521,host2:1521/freepdb1; that could be useful in active-passive replication setups, when the secondary database is not available while replicating; scraper should automatically fall-back when needed.

lucian-vanghele avatar Oct 01 '24 18:10 lucian-vanghele

@markxnelson does the above make sense?

lucian-vanghele avatar Oct 18 '24 13:10 lucian-vanghele

Hi @lucian-vanghele , yep that make sense, hope to get this working in the next couple of weeks.

markxnelson avatar Oct 18 '24 13:10 markxnelson

hi @markxnelson - any progress on these features?

lucian-vanghele avatar Jan 10 '25 13:01 lucian-vanghele

Hi @lucian-vanghele , sorry had to fix some bugs, getting back to multi-db support now!

markxnelson avatar Jan 13 '25 17:01 markxnelson