# Mysql database monitoring

**URL:** <https://discuss.elastic.co/t/mysql-database-monitoring/266761>\
**Category:** Metrics\
**Created:** [March 10, 2021, 4:57am UTC](https://discuss.elastic.co/t/mysql-database-monitoring/266761 "2021-03-10T04:57:48Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonsacri](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jonsacri](https://discuss.elastic.co/u/jonsacri)\
**Post date:** [March 10, 2021, 4:57am UTC](https://discuss.elastic.co/t/mysql-database-monitoring/266761/1 "2021-03-10T04:57:48Z")

</div>

colleagues to be able to monitor a database which are the permissions that the user must have. and which table is the one that should have these permissions in my SQL

---

<div class="post-metadata">

**Author:** ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)\
**Post date:** [March 10, 2021, 6:43pm UTC](https://discuss.elastic.co/t/mysql-database-monitoring/266761/2 "2021-03-10T18:43:16Z")

</div>

Hi @jonsacri,

it seems like you're asking for advice about monitoring of some unspecified RDBMS. Could you please clarify your deployment scenario and your specific question?

---

<div class="post-metadata">

**Author:** ![jonsacri](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jonsacri](https://discuss.elastic.co/u/jonsacri)\
**Post date:** [March 15, 2021, 11:29pm UTC](https://discuss.elastic.co/t/mysql-database-monitoring/266761/3 "2021-03-15T23:29:47Z")

</div>

> [@weltenwort](#):
>
> RDBMS

It is correct what I am looking for is to monitor different databases in my sql but when activating the component the connection is wrong by Go

---

<div class="post-metadata">

**Author:** ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)\
**Post date:** [March 16, 2021, 11:02am UTC](https://discuss.elastic.co/t/mysql-database-monitoring/266761/4 "2021-03-16T11:02:15Z")

</div>

So you're trying to monitor a MySQL database server but have trouble connecting to it, right? In order for community members to help you a few more pieces of information might be helpful:

- What monitoring agent are you trying to use? Filebeat or Metricbeat with the MySQL module? Or some other agent?
- What are the versions and configurations involved?
- What error do you specifically see when trying to connect?

---

<div class="post-metadata">

**Author:** ![jonsacri](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jonsacri](https://discuss.elastic.co/u/jonsacri)\
**Post date:** [March 25, 2021, 3:56am UTC](https://discuss.elastic.co/t/mysql-database-monitoring/266761/5 "2021-03-25T03:56:26Z")

</div>

I use metricbeat 9.0 with the mssql module

- module: mssql

I need to declare the instance how could I do it

sqlserver://127.0.0.1:1433;databaseName=MyDatabase ?

Thank you

---

<div class="post-metadata">

**Author:** ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)\
**Post date:** [March 25, 2021, 9:59am UTC](https://discuss.elastic.co/t/mysql-database-monitoring/266761/6 "2021-03-25T09:59:44Z")

</div>

🤔 In your posts you were talking about MySQL, but your config snippet uses the `mssql` module. Which one is it?

---

<div class="post-metadata">

**Author:** ![jonsacri](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jonsacri](https://discuss.elastic.co/u/jonsacri)\
**Post date:** [March 25, 2021, 12:18pm UTC](https://discuss.elastic.co/t/mysql-database-monitoring/266761/7 "2021-03-25T12:18:58Z")

</div>

If you are right I am using the mssql module, would you recommend using the sql one? Could you help me how the configuration would be? I thank you so

---

<div class="post-metadata">

**Author:** ![jonsacri](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jonsacri](https://discuss.elastic.co/u/jonsacri)\
**Post date:** [March 25, 2021, 12:39pm UTC](https://discuss.elastic.co/t/mysql-database-monitoring/266761/8 "2021-03-25T12:39:57Z")

</div>

to clarify the database is in a SQL server not in my sql

---

<div class="post-metadata">

**Author:** ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)\
**Post date:** [March 25, 2021, 12:50pm UTC](https://discuss.elastic.co/t/mysql-database-monitoring/266761/9 "2021-03-25T12:50:37Z")

</div>

If you're trying to monitor the Microsoft SQL Server, `mssql` looks like the right module. I'm wondering where you're taking the version 9.0 of Metricbeat from since the latest released version is 7.12.

If you're trying to log in as a native user, a string like `sqlserver://user:pass@127.0.0.1:1433;databaseName=MyDatabase` should work, but for AD users you'd have to use separate `username` and `password` config keys or store them in the secrets keystore (see the [module-specific notes](https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-module-mssql.html#_module_specific_configuration_notes_9)).

Could you tell us which error Metricbeat is logging when unsuccessfully trying to connect to the SQL server?

---

<div class="post-metadata">

**Author:** ![jonsacri](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jonsacri](https://discuss.elastic.co/u/jonsacri)\
**Post date:** [March 25, 2021, 1:15pm UTC](https://discuss.elastic.co/t/mysql-database-monitoring/266761/10 "2021-03-25T13:15:45Z")

</div>

Exiting: 2 errors: host parsing failed for mssql-transaction\_log: error parsing URL: parse "sqlserver://User:Pass  
@host:port;databaseName=pocoyo": invalid port ":####;databaseName=pocoyo" after host; host parsing fai  
led for mssql-performance: error parsing URL: parse "sqlserver://user:pass@host:port;databaseNam  
e=pocoyo": invalid port ":####;databaseName=pocoyo" after host

Welcome to Metricbeat 7.9.0

---

<div class="post-metadata">

**Author:** ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)\
**Post date:** [March 25, 2021, 3:00pm UTC](https://discuss.elastic.co/t/mysql-database-monitoring/266761/11 "2021-03-25T15:00:20Z")

</div>

Looking at the implementation of the underlying [`go-mssqldb` library](https://github.com/denisenkom/go-mssqldb) it seems the `sqlserver` url-style string expects the database name as a query parameter after the `?`:

```nohighlight
sqlserver://user:pass@localhost:1234?database=mydatabase

```

Does that work?

---

<div class="post-metadata">

**Author:** ![jonsacri](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jonsacri](https://discuss.elastic.co/u/jonsacri)\
**Post date:** [March 25, 2021, 3:13pm UTC](https://discuss.elastic.co/t/mysql-database-monitoring/266761/12 "2021-03-25T15:13:58Z")

</div>

perfect thank you. one more favor could you please if you can collaborate with this problem and apply your wise knowledge

[URl](https://discuss.elastic.co/t/mssql-performance-ignores-some-metrics-metricbeat/268277)

---

<div class="post-metadata">

**Author:** ![jonsacri](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jonsacri](https://discuss.elastic.co/u/jonsacri)\
**Post date:** [March 25, 2021, 6:35pm UTC](https://discuss.elastic.co/t/mysql-database-monitoring/266761/13 "2021-03-25T18:35:19Z")

</div>

Would you like to clarify something for the database user what permissions he must have in addition to these  
VIEW SERVER STATE and VIEW DATABASE STATE

thanks

---

<div class="post-metadata">

**Author:** ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)\
**Post date:** [March 26, 2021, 9:54am UTC](https://discuss.elastic.co/t/mysql-database-monitoring/266761/14 "2021-03-26T09:54:15Z")

</div>

Sorry, I barely know anything about MSSQL. I'd recommend reading the [MSSQL documentation](https://docs.microsoft.com/en-us/sql/sql-server/?view=sql-server-ver15) or asking your support contact at Microsoft.

---

<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:** [April 23, 2021, 9:55am UTC](https://discuss.elastic.co/t/mysql-database-monitoring/266761/15 "2021-04-23T09:55:00Z")

</div>

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