# Synthetic SQL query monitor

**URL:** <https://community.dynatrace.com/t/synthetic-sql-query-monitor/20982>\
**Category:** Extensions\
**Tags:** databases, sql, extensions\
**Created:** [June 13, 2019, 3:53pm UTC](https://community.dynatrace.com/t/synthetic-sql-query-monitor/20982 "2019-06-13T15:53:58Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Enrico\_F](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/enrico_f/32/23774_2.png) [@Enrico\_F](https://community.dynatrace.com/u/Enrico_F)\
**Post date:** [June 13, 2019, 3:53pm UTC](https://community.dynatrace.com/t/synthetic-sql-query-monitor/20982/1 "2019-06-13T15:53:58Z")

</div>

Dear community,

In good old AppMon there existed the [DB Query Monitor](https://community.dynatrace.com/community/display/DL/DB+Query+Monitor+Plugin?_ga=2.186801579.2011618517.1560422189-1388494667.1539072555) plugin which could be used to send an arbitrary SQL query against a database at scheduled intervals and derive various measures from it (row count, response time etc.).

Question: Is there an equivalent capability or plugin available for Dynatrace which could be used to run SQL queries at scheduled intervals (say: hourly) either from an ActiveGate or a OneAgent and derive metrics such as row count and response time from it? Kinda like a synthetic monitor, only for simulating DB clients 🙂

If there isn’t anything available out-of-the-box or as an optional plugin: Would this be a project worth pursuing as a self-written Python plugin to run on OneAgents?

Any feedback would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![pahofmann](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pahofmann/32/17076_2.png) [@pahofmann](https://community.dynatrace.com/u/pahofmann)\
**Post date:** [June 13, 2019, 6:12pm UTC](https://community.dynatrace.com/t/synthetic-sql-query-monitor/20982/2 "2019-06-13T18:12:40Z")

</div>

There is none yet that I know of.

Would be a good way to get started with dynatrace plugins. You could use a [Active Gate Plugin](https://www.dynatrace.com/support/help/extend-dynatrace/plugins/activegate-plugins/) for that aswell.

---

<div class="post-metadata">

**Author:** ![dave\_mauney](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dave_mauney/32/27784_2.png) [@dave\_mauney](https://community.dynatrace.com/u/dave_mauney)\
**Post date:** [June 13, 2019, 11:38pm UTC](https://community.dynatrace.com/t/synthetic-sql-query-monitor/20982/3 "2019-06-13T23:38:00Z")

</div>

I agree this is a good candidate for an Active Gate plugin. I’m sure others would make use of it if you publish it on github.

---

<div class="post-metadata">

**Author:** ![AlexanderSommer](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/alexandersommer/32/2501_2.png) [@AlexanderSommer](https://community.dynatrace.com/u/AlexanderSommer)\
**Post date:** [June 14, 2019, 6:27am UTC](https://community.dynatrace.com/t/synthetic-sql-query-monitor/20982/4 "2019-06-14T06:27:29Z")

</div>

[@Patrick H.](https://answers.dynatrace.com/users/11534/view.html) and [@Dave M.](https://answers.dynatrace.com/users/3212/view.html) are right, you can create a plugin. What we have on our road map are “custom monitors” which enrich our Synthetic use case to additional protocol checks like pings, trace route or ldap checks. I can’t give you a date when we will be ready … but it will not be in the next 6 months 😉

---

<div class="post-metadata">

**Author:** ![pahofmann](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pahofmann/32/17076_2.png) [@pahofmann](https://community.dynatrace.com/u/pahofmann)\
**Post date:** [June 14, 2019, 9:11am UTC](https://community.dynatrace.com/t/synthetic-sql-query-monitor/20982/5 "2019-06-14T09:11:19Z")

</div>

That’s a great addition for the feature though!

Heard requests like that at a few customers, and although it’s possible via plugins, having this directly in synthetic would be a lower barrier of entry.

---

<div class="post-metadata">

**Author:** ![Enrico\_F](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/enrico_f/32/23774_2.png) [@Enrico\_F](https://community.dynatrace.com/u/Enrico_F)\
**Post date:** [June 14, 2019, 9:52am UTC](https://community.dynatrace.com/t/synthetic-sql-query-monitor/20982/6 "2019-06-14T09:52:13Z")

</div>

Thanks for the feedback!

Regarding the custom plugin approach: What’s limiting in our case is that the execution interval is [hard-coded to be 1 min and can’t be changed](https://answers.dynatrace.com/spaces/482/dynatrace-open-qa/questions/217821/change-plugin-execution-interval.html)…

Is this still the case for the latest version? And if so, is there something on the roadmap for allowing more flexibility?

---

<div class="post-metadata">

**Author:** ![rene\_forstner](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@rene\_forstner](https://community.dynatrace.com/u/rene_forstner)\
**Post date:** [September 10, 2020, 11:56am UTC](https://community.dynatrace.com/t/synthetic-sql-query-monitor/20982/7 "2020-09-10T11:56:14Z")

</div>

Not sure if this still an actual case, however we developed a rather experimental plugin, which does not rely on OneAgent or ActiveGates but using the 3rd Party Synthetic API and pythons APScheduler to exectue SQL Queries regulary:

> **[GitHub - NTTDATA-EMEA/dynatrace-sql-plugin: Dynatrace Synthetic SQL Plugin](https://github.com/NTTDATA-EMEA/dynatrace-sql-plugin)**
>
> Dynatrace Synthetic SQL Plugin

---

<div class="post-metadata">

**Author:** ![Kenny\_Gillette](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/kenny_gillette/32/20170_2.png) [@Kenny\_Gillette](https://community.dynatrace.com/u/Kenny_Gillette)\
**Post date:** [September 10, 2020, 7:55pm UTC](https://community.dynatrace.com/t/synthetic-sql-query-monitor/20982/8 "2020-09-10T19:55:17Z")

</div>

Hi, Any update or news on this?

---

<div class="post-metadata">

**Author:** ![Enrico\_F](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/enrico_f/32/23774_2.png) [@Enrico\_F](https://community.dynatrace.com/u/Enrico_F)\
**Post date:** [September 11, 2020, 6:29am UTC](https://community.dynatrace.com/t/synthetic-sql-query-monitor/20982/9 "2020-09-11T06:29:12Z")

</div>

This is great - thanks a lot for sharing!

“can easily be containerized” sounds good, too - although for me not so easy to do atm… If anyone can share an OpenShift build config, docker compose file or even a deployable docker image that would be awesome…

---

<div class="post-metadata">

**Author:** ![rene\_forstner](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@rene\_forstner](https://community.dynatrace.com/u/rene_forstner)\
**Post date:** [September 11, 2020, 7:15am UTC](https://community.dynatrace.com/t/synthetic-sql-query-monitor/20982/10 "2020-09-11T07:15:03Z")

</div>

Hi,

give this a try - did not test the functionality of the app itself but at least the API is reachable

FROM python:3.8.5-slim-busterADD installODBCDrivers.sh .RUN chmod +x installODBCDrivers.shRUN bash -c “./installODBCDrivers.sh”  
WORKDIR /codeCOPY requirements.txt .RUN pip install -r requirements.txtCOPY src/ .  
CMD [“python”, “./server.py”]

you could play around with passing the env variables through the dockerfile, I’ll update the repo next week with a fully tested dockerfile

---

<div class="post-metadata">

**Author:** ![rene\_forstner](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@rene\_forstner](https://community.dynatrace.com/u/rene_forstner)\
**Post date:** [September 11, 2020, 7:16am UTC](https://community.dynatrace.com/t/synthetic-sql-query-monitor/20982/11 "2020-09-11T07:16:23Z")

</div>

as mentioned on the answer above,

Check out this repo:

> **[GitHub - NTTDATA-EMEA/dynatrace-sql-plugin: Dynatrace Synthetic SQL Plugin](https://github.com/NTTDATA-EMEA/dynatrace-sql-plugin)**
>
> Dynatrace Synthetic SQL Plugin

Its using the 3rd party synthetic API, flask to add/remove synthetic  
SQL queries and APScheduler to execute them at the defined intervals.
