Hello everyone,
So I have an Oracle database query with a format more or less like this:
select “REUPLOAD_VALUE” COLUMN,count(*) from DBNAME.REG_VALUE where status=‘REUPLOAD’ and the output will be a table like the one below.COLUMN | COUNT(*)REUPLOAD_VALUE | 3276543
Is it possible to use Dynatrace, perhaps with an extension, to retrieve the result from the COUNT(*) column?
Then from the result, we will set a threshold, and if it exceeds a certain value, then an alert will be sent.
If possible, could you please assist in showing an example of how to do this?
Thank you.
Hi @agylpradipta. Yes it’s possible, one easy approach is do it with a script:
- Execute the query from command line. Save output to txt.
- Parse the output txt.
- Use the Metrics API to ingest you REUPLOAD_VALUE METRIC.
- Create a Metric Event based on your metric from step 3.
- Cron your script and you’re done!!!
Is there a simpler approach? For instance, I just came across this extension https://www.dynatrace.com/hub/detail/custom-database-queries/?query=custom+database+qu&filter=all, could we use that?
You could use that, but the extension is deprecated so I wouldn’t use something that is not supported anymore.
Rather use this one: https://www.dynatrace.com/hub/detail/custom-database-extension/?query=queries&filter=all
I’ve just come across the following extension version, which seems to be new and not deprecated → https://www.dynatrace.com/hub/detail/custom-database-extension/?query=custom+database+query&filter=all. Can we use this?
If so, would anyone here be willing to share how to use it, referring to the Oracle database query I sent earlier?
Thank you.
Yes, you can use it.
You need to build your own extension. I would recommend using the extension plugin for VSCode
https://developer.dynatrace.com/extensions-v2/dynatrace-extensions-vscode/
Then you need to build the extensión, refer to SQL datasource here SQL data source reference — Dynatrace Docs