cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DB Query Extension

Guys, please, I need some help on an extension. I need to create a plugin that executes a query against a MySQL database. Should I create an ActiveGate Extension or Oneagent extension? Does anyone have an example or any documentation that shows a model?

Dynatrace Professional
3 REPLIES 3

Julius_Loman
DynaMight Guru
DynaMight Guru

The answer is - it depends on the requirements. If it's for a single purpose, I'd consider writing a simple script that will execute queries using MySQL command line client and push the metrics using metric ingestion or events using API. This is much simpler than the writing extension.

If you still need to create an extension, keep in mind:

  • OneAgent extensions can only push data to process groups residing on the same host where they run. (so you must have Oneagent on the DB host).

  • ActiveGate extension creates new entities (custom devices). You can somehow also push data to existing entities based on metadata.

For samples see here in the docs and for inspiration, you can look into the code of the MySQL extension that is shipped with the OneAgent itself.

Certified Dynatrace Master | TEMPEST a.s., Slovakia, Dynatrace Master Partner

Julius, sorry, but just a question. To run the first option you mentioned, I would need the agent installed on the database servers, right? My question is how I would schedule this script execution and sending the metrics, which makes me wonder.

Dynatrace Professional

@RodrigoBiaggio  you have actually two options here for sending. 

  • You have OneAgent on the host from where you will send the metrics -> send them using local ingestion interface 
  • You don't have OneAgent on the host -> send them using API You will need to have an API token created in this case and typically you will want to set the dt.entity in the output.

Depending on your DB you can execute it remotely.
Regarding scheduling - use cron or systemd on Linux for example, Windows scheduler on windows. It's really up to you. You can also run a daemon in and process it in a loop.

 

Certified Dynatrace Master | TEMPEST a.s., Slovakia, Dynatrace Master Partner