# Metricbeat sql module with dynamic database values

**URL:** <https://discuss.elastic.co/t/metricbeat-sql-module-with-dynamic-database-values/292623>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [December 22, 2021, 12:29am UTC](https://discuss.elastic.co/t/metricbeat-sql-module-with-dynamic-database-values/292623 "2021-12-22T00:29:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nsharath](https://avatars.discourse-cdn.com/v4/letter/n/c6cbf5/32.png) [@nsharath](https://discuss.elastic.co/u/nsharath)\
**Post date:** [December 22, 2021, 12:29am UTC](https://discuss.elastic.co/t/metricbeat-sql-module-with-dynamic-database-values/292623/1 "2021-12-22T00:29:32Z")

</div>

I am using metricbeat 7.15 version with sql module enabled.  
I have a huge list of databases and currently my sql module config size is very big. I would like to know how to send the database name (e.g. database1, database2,database3, etc) in below config dynamically (or) from a input config file which has list of database names and credentials that can be passed as a parameters. Maybe even the SQL query used as an input as i have a list of SQL queries which I run on different oracle databases. Please advise on smarter way.

```auto
- module: sql
  metricsets:
    - query
  period: 30s
  hosts: ["oracle://username:password@server:port/database1"]
  driver: "oracle"
  sql_query: "select open_mode database1_open_state from v$database1"
  sql_response_format: table
- module: sql
  metricsets:
    - query
  period: 30s
  hosts: ["oracle://username:password@server:port/database2"]
  driver: "oracle"
  sql_query: "select open_mode database2_open_state from v$database2"
  sql_response_format: table
- module: sql
  metricsets:
    - query
  period: 30s
  hosts: ["oracle://username:password@server:port/database3"]
  driver: "oracle"
  sql_query: "select open_mode database3_open_state from v$database3"
  sql_response_format: table

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 19, 2022, 2:30am UTC](https://discuss.elastic.co/t/metricbeat-sql-module-with-dynamic-database-values/292623/2 "2022-01-19T02:30:04Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
