Skip to content
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

#3370 - Add support for monitoring IBM DB2 databases #3439

Conversation

jfcabral
Copy link

@jfcabral jfcabral commented Jul 17, 2023

⚠️⚠️⚠️ Since we do not accept all types of pull requests and do not want to waste your time. Please be sure that you have read pull request rules:
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma

Tick the checkbox if you understand [x]:

  • I have read and understand the pull request rules.

Description

Resolves #3370 feature request

Type of change

Please delete any options that are not relevant.

  • User interface (UI)
  • New feature (non-breaking change which adds functionality)

Checklist

  • My code follows the style guidelines of this project
  • I ran ESLint and other linters for modified files
  • I have performed a self-review of my own code and tested it
  • I have commented my code, particularly in hard-to-understand areas
    (including JSDoc for methods)
  • My changes generate no new warnings

Notes

  • Heavily inspired in the postgres and MySQL implementations
  • Just like for postgres, I've used a default query to make it easier to set up
  • Uses https://www.npmjs.com/package/ibm_db to access db2
  • I've used this connection string format for testing: DATABASE=<dbname>;HOSTNAME=<myhost>;UID=db2user;PWD=password;PORT=<dbport>;PROTOCOL=TCPIP
  • I've used the official db2 docker container for testing purposes https://hub.docker.com/r/ibmcom/db2/

Screenshots (if any)

Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.

image

image

image

image

If you have any question, feedback or suggestion, please do not hesitate to say so :)

@louislam
Copy link
Owner

Thanks for the pr. Please note that npm install failed on arm64/armv7 due to the native build issue.

CONTRIBUTING.md

Easy to install for non-Docker users, no native build dependency is needed (for x86_64/armv7/arm64)

@louislam louislam added the question Further information is requested label Jul 18, 2023
@jfcabral
Copy link
Author

Thanks for the pr.

You're very welcome 😉

Please note that npm install failed on arm64/armv7 due to the native build issue.

Yeah, I've noticed 😕

Unfortunately, it seems that the only IBM DB2 node module that's available, is based on a native build dependency: https://www.npmjs.com/package/ibm_db

After some research, it seems there's not a pure JS module to interface with DB2, and there probably won't ever be one, due to licensing questions...😞

CONTRIBUTING.md

Easy to install for non-Docker users, no native build dependency is needed (for x86_64/armv7/arm64)

I understand your point, after all, native dependencies are quite a fuss. Besides that, I don't think this ibm_db module even works on arm at all (at least I haven't been able to make it work on arm v8 x64). 😢

Yet, it works quite well on x64, and I was able to test it using the new Codespace Environment that you set up. without any change at all 😄

IMHO, for ease of usage, Docker should be the way to go. Yet, I understand it's not really acceptable to constrain the usage of the app for non docker users...

I wonder if it would be possible to use this ibm_db as an optional dependency of sorts, and prepare the frontend/backend to somehow deal with it like it's described here:

try {
  var foo = require('foo')
  var fooVersion = require('foo/package.json').version
} catch (er) {
  foo = null
}
if ( notGoodFooVersion(fooVersion) ) {
  foo = null
}
// .. then later in your program ..
if (foo) {
  foo.doFooThings()
}

This way, it would still be compatible with all the required versions, but this db2 monitor functionality would only be available for the compatible architectures. What do you think about this @louislam?

Thank you

@CommanderStorm

This comment was marked as resolved.

@jfcabral
Copy link
Author

jfcabral commented Sep 5, 2023

@louislam, hi, could you please check my question about the next steps? #3439 (comment)
Thank you

@chakflying chakflying added the area:monitor Everything related to monitors label Dec 2, 2023
@CommanderStorm
Copy link
Collaborator

I am going to close this PR as support for non-Docker (armv7/arm64) users without native dependencies is a hard requirement for monitors in uptime kuma.
If IBM changes their mind and offers a package which does not require this, we can reopen this issue.
We would like to have such a monitor, but are not willing to accept the current drawbacks this would incur.

As it stands, I don't see how keeping this issue open and hoping that IBM changes their mind will get anywhere.

We would like to encourage a second option, developing an agent:

Uptime Kuma <-> Agent <-> Oracle DB

Agent = An HTTP Server with an entry point that allows to make a request with a connection string and a query
Uptime Kuma = Make a http request to the Agent

If somebody develops an agent, we can include this in the unofficial/experimental section of our installation guide.

@jfcabral
Copy link
Author

Hello @CommanderStorm,

Thank you for your reply 😄

So, from what I understand, you're not really keen on this approach either #3439 (comment) right?

Regarding the Agent approach, it does seem to be an interesting idea 👍
I have one question though, assuming the agent is created and running somewhere, how do you see this being configured in Kuma?

Because, in terms of DB Monitor configuration, I do like the existing setup where you can input the Connection String and Query. That said, would it be acceptable for me to create a new DB2 Monitor "external agent edition", that besides the Connection String and Query, would also receive the URL for the agent? What are your thoughts on that?

Thank you once again

@CommanderStorm
Copy link
Collaborator

CommanderStorm commented Feb 14, 2024

Running on armv7/arm64 is a hard requirement, sorry
I don't see how #3439 (comment) does support armv7/arm64.
npm install ibm_db would just error out => hard-bricking armv7/arm64

Such code would be a mess to test, and I don't see us having the capacity currently to do that, sorry.
If we had tests such as discussed in #4451 this might not be such a big issue.

As stated above:
If IBM changes their mind about supporting this platform, we can reopen this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:monitor Everything related to monitors question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for monitoring IBM DB2 databases
4 participants