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

Add Oracle as a new monitor #2493

Open
1 task done
simone80an opened this issue Dec 28, 2022 · 4 comments
Open
1 task done

Add Oracle as a new monitor #2493

simone80an opened this issue Dec 28, 2022 · 4 comments
Labels
area:monitor Everything related to monitors feature-request Request for new features to be added type:new proposing to add a new monitor

Comments

@simone80an
Copy link

⚠️ Please verify that this feature request has NOT been suggested before.

  • I checked and didn't find similar feature request

🏷️ Feature Request Type

New Monitor

🔖 Feature description

Having Oracle as a new Specific Monitor Type so i can monitor also Oracle db servers.

✔️ Solution

Testing connection of Oracle database servers.

❓ Alternatives

No response

📝 Additional Context

No response

@simone80an simone80an added the feature-request Request for new features to be added label Dec 28, 2022
@bitsky6

This comment was marked as spam.

@simone80an
Copy link
Author

I did a test using uptime-kuma version 19.4 and the following steps:

  • installed oracledb node package
  • edited file src\pages\EditMonitor.vue to add OracleDb type at line 267:
<template v-if="monitor.type === 'oracledb'">
    <input id="sqlConnectionString" v-model="monitor.databaseConnectionString" type="text" class="form-control" placeholder='"user":"<USER>","password":"<PASSWORD>","connectionString":"(DESCRIPTION =(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=<HOSTADDRESS>)(PORT=<PORT>)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=<SERVICENAME>)))"'>
</template>
  • edited file server\util-server.js to handle connection and query towards Oracle:

added new const

const oracledb = require("oracledb");

added this code at line 321:

/**
 * Run a query on Oracle DB
 * @param {string} connectionString The database connection string
 * @param {string} query The query to validate the database with
 * @returns {Promise<(string[]|Object[]|Object)>}
 */
exports.oracledbQuery = async function (connectionString, query) {

    try {

        let connectionStringJson=JSON.parse('{' + connectionString + '}');
        let connection = await oracledb.getConnection(connectionStringJson);

        await connection.execute(query);
        await connection.close();

    } 
    catch (err) {
        throw err;
    } 

};
  • edited file server\model\monitor.js to handle OracleDb monitor:

modified line 6 as following:

const { tcping, ping, dnsResolve, checkCertificate, checkStatusCode, getTotalClientInRoom, setting, mssqlQuery, postgresQuery, mysqlQuery, oracledbQuery, mqttAsync, setSetting, httpNtlm, radius, grpcQuery } = require("../util-server");

added this code at line 584:

else if (this.type === "oracledb") {
    let startTime = dayjs().valueOf();

    await oracledbQuery(this.databaseConnectionString, this.databaseQuery);

    bean.msg = "";
    bean.status = UP;
    bean.ping = dayjs().valueOf() - startTime;
}

cd to project dir and run npm rebuild, then start again uptime-kuma.
I tested for a couple of weeks and seems working.

@bitsky6
Copy link

bitsky6 commented Feb 17, 2023

Cool maybe ask to build into the next version, make a request. Thanks will try to see if I manage like this.

@bitsky6
Copy link

bitsky6 commented Feb 17, 2023

Hey thanks for that,

I have pushed a pull request for it.

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 feature-request Request for new features to be added type:new proposing to add a new monitor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants