Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does this exporter support IBM DB2 and Oracle DB? #207

Closed
shingou0120 opened this issue Mar 22, 2023 · 4 comments
Closed

Does this exporter support IBM DB2 and Oracle DB? #207

shingou0120 opened this issue Mar 22, 2023 · 4 comments
Labels
enhancement New feature or request response pending

Comments

@shingou0120
Copy link

Is your feature request related to a problem? Please describe.
I am looking for a solution to export metrics from DB2 and Oracle database.
Current we use https://github.com/albertodonato/query-exporter as our biz monitor solution.
However, the configuration format in albertodonato/query-exporter is hard to implement to helm chart.

Describe the solution you'd like
The solution I need is to make db, metrics and query sql more flexible and reusable with helm chart
There are many sites in our company such as A site, B site and C site, and we should export the metrics with the same SQL from DB of each site.
For example,
metric: goods_inventory_count
query: select count from tbl_inventory where <condition>
Both of those above are the same, and I should deploy 3 sql_exporter in 3 sites to connect different DB.
So, I want to build a helm chart package to form the same metrics and queries.

After I survey overall, sql_exporter seems to fit my needs except that DB2 and oracle are not supported. :(

Describe alternatives you've considered
Currently not. Only if I try to build the config template for query-exporter, and I am sure it's really not easy.

If the DB2 and Oracle could be supported, it's so appreciated, thanks a lot.

@shingou0120 shingou0120 added the enhancement New feature or request label Mar 22, 2023
@burningalchemist
Copy link
Owner

Hi @shingou0120, I'm sorry for the late response - had many things around.

Generally, any database that has a driver in golang, supporting sql/database interface, and supported by dburl can be used by sql_exporter.

Following your case I found next things:

  • Oracle DB is supported. 👍 The suitable driver for Oracle DB is likely https://github.com/sijms/go-ora.

  • As for IBM DB2 - it's a bit tricky. There is a driver written in go, but it's not supported by dburl dependency, so a pull request is needed on the upstream.

These drivers are rather specific, and aren't available out of the box, but it's not difficult to add them (one of them at the moment):

  1. add a driver to one of the maps here
  2. generate drivers.go by running make drivers-all command
  3. once drivers.go is generated, you can compile the binary with make build
  4. done.

P.S. You can also create the binary only with custom drivers - populate the list custom, and run make drivers-custom before compiling the binary.

Let me know if you have any questions, I'm happy to assist. 👍

@JustNZ
Copy link

JustNZ commented Aug 22, 2023

Hey @burningalchemist,
I added the driver you mentioned to custom section, did the make for drivers-custom and after that the build.

After installing the binary and adding oracle://... to the connection string I get the following error on execution of the binary:
sql: unknown driver \"oracle\" (forgotten import?)"

Do you know what I did wrong?
Is there any way for you to add the mentioned oracle driver directly to this project?

@burningalchemist
Copy link
Owner

Hey @JustNZ,

I just tested it, and it works fine. It's also that you need to use github.com/sijms/go-ora/v2. This might be the cause of your issue.

Here's a short screencast, hope it helps:

Kapture.2023-08-22.at.17.08.40.mp4

As for adding oracle driver by default - it's unlikely, since there's no way to test it, it also increases the application footprint, which is against the idea of this app - to be lightweight and simple. It's also a pretty niche solution. I'm also considering moving previously added Vertica and Snowflake drivers off.

I think adding a simple guide to add your own driver is the best option as it gives control and flexibility.

@JustNZ
Copy link

JustNZ commented Aug 23, 2023

Hey @burningalchemist ,

yes seems like the issue was by not using the v2 version of the oracle driver.
Thanks a lot for the lightning fast response and it is working like a charm now.

And keeping this project lightweight does make sense and if there is the possibility to add own drivers then it is more than perfect.

Thanks!

Repository owner locked and limited conversation to collaborators Aug 26, 2023
@burningalchemist burningalchemist converted this issue into discussion #299 Aug 26, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request response pending
Projects
None yet
Development

No branches or pull requests

3 participants