# MSSQL metric in windows

**URL:** <https://discuss.elastic.co/t/mssql-metric-in-windows/260197>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [January 5, 2021, 11:26am UTC](https://discuss.elastic.co/t/mssql-metric-in-windows/260197 "2021-01-05T11:26:38Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohan0018](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rohan0018/32/79007_2.png) [@rohan0018](https://discuss.elastic.co/u/rohan0018)\
**Post date:** [January 5, 2021, 11:26am UTC](https://discuss.elastic.co/t/mssql-metric-in-windows/260197/1 "2021-01-05T11:26:38Z")

</div>

I have installed metricbeat MSSQL module in windows, but when I enable MSSQL module metricbeat service auto stop. Metricbeat service worksonly if MSSQL module is disabled.

Please help

---

<div class="post-metadata">

**Author:** ![ChrsMark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chrsmark/32/55858_2.png) [@ChrsMark](https://discuss.elastic.co/u/ChrsMark)\
**Post date:** [January 5, 2021, 2:07pm UTC](https://discuss.elastic.co/t/mssql-metric-in-windows/260197/2 "2021-01-05T14:07:18Z")

</div>

Hi!

Do you have any logs to share?

---

<div class="post-metadata">

**Author:** ![rohan0018](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rohan0018/32/79007_2.png) [@rohan0018](https://discuss.elastic.co/u/rohan0018)\
**Post date:** [January 6, 2021, 3:11am UTC](https://discuss.elastic.co/t/mssql-metric-in-windows/260197/3 "2021-01-06T03:11:33Z")

</div>

Hi!,  
Please see below logs

'2021-01-05T14:29:47.141+0530 INFO instance/beat.go:645 Home path: [C:\Program Files\Elastic\Beats\7.10.1\metricbeat] Config path: [C:\ProgramData\Elastic\Beats\metricbeat] Data path: [C:\ProgramData\Elastic\Beats\metricbeat\data] Logs path: [C:\ProgramData\Elastic\Beats\metricbeat\logs]  
2021-01-05T14:29:47.152+0530 INFO instance/beat.go:653 Beat ID: fcc91b37-3e88-4d08-9212-9201fe48c454  
2021-01-05T14:29:47.174+0530 INFO [beat] instance/beat.go:981 Beat info {"system\_info": {"beat": {"path": {"config": "C:\ProgramData\Elastic\Beats\metricbeat", "data": "C:\ProgramData\Elastic\Beats\metricbeat\data", "home": "C:\Program Files\Elastic\Beats\7.10.1\metricbeat", "logs": "C:\ProgramData\Elastic\Beats\metricbeat\logs"}, "type": "metricbeat", "uuid": "fcc91b37-3e88-4d08-9212-9201fe48c454"}}}  
2021-01-05T14:29:47.174+0530 INFO [beat] instance/beat.go:990 Build info {"system\_info": {"build": {"commit": "1da173a9e716715a7a54bb3ff4db05b5c24fc8ce", "libbeat": "7.10.1", "time": "2020-12-04T23:38:30.000Z", "version": "7.10.1"}}}  
2021-01-05T14:29:47.174+0530 INFO [beat] instance/beat.go:993 Go runtime info {"system\_info": {"go": {"os":"windows","arch":"amd64","max\_procs":4,"version":"go1.14.12"}}}  
2021-01-05T14:29:47.210+0530 INFO [beat] instance/beat.go:997 Host info {"system\_info": {"host": {"architecture":"x86\_64","boot\_time":"2020-10-10T18:05:33+05:30","name":"M0946","ip":["fe80::87f:3a23:aa1d:5583/64","10.51.4.201/24","::1/128","127.0.0.1/8","fe80::5efe:a33:4c9/128"],"kernel\_version":"6.1.7601.24520 (win7sp1\_ldr\_escrow.190828-1732)","mac":["20:25:64:08:d8:29","00:00:00:00:00:00:00:e0"],"os":{"family":"windows","platform":"windows","name":"Windows Server 2008 R2 Enterprise","version":"6.1","major":1,"minor":0,"patch":0,"build":"7601.24525"},"timezone":"IST","timezone\_offset\_sec":19800,"id":"d6bd2cfe-8e28-4eb2-864c-31ee93c0919e"}}}  
2021-01-05T14:29:47.211+0530 INFO [beat] instance/beat.go:1026 Process info {"system\_info": {"process": {"cwd": "C:\Windows\system32", "exe": "C:\Program Files\Elastic\Beats\7.10.1\metricbeat\metricbeat.exe", "name": "metricbeat.exe", "pid": 1620, "ppid": 560, "start\_time": "2021-01-05T14:29:46.373+0530"}}}  
2021-01-05T14:29:47.211+0530 INFO instance/beat.go:299 Setup Beat: metricbeat; Version: 7.10.1  
2021-01-05T14:29:47.211+0530 INFO [index-management] idxmgmt/std.go:184 Set output.elasticsearch.index to 'metricbeat-7.10.1' as ILM is enabled.  
2021-01-05T14:29:47.211+0530 INFO eslegclient/connection.go:99 elasticsearch url: [https://kibana](https://kibana) url:9200  
2021-01-05T14:29:47.212+0530 INFO [publisher] pipeline/module.go:113 Beat name: MXXX  
2021-01-05T14:29:47.326+0530 INFO [monitoring] log/log.go:118 Starting metrics logging every 30s  
2021-01-05T14:29:47.326+0530 INFO instance/beat.go:455 metricbeat start running.  
2021-01-05T14:29:47.349+0530 INFO helper/privileges\_windows.go:79 Metricbeat process and system info: {"OSVersion":{"Major":6,"Minor":1,"Build":7601},"Arch":"amd64","NumCPU":4,"User":{"SID":"S-1-5-18","Account":"SYSTEM","Domain":"NT AUTHORITY","Type":1},"ProcessPrivs":{"SeAssignPrimaryTokenPrivilege":{"enabled":false},"SeAuditPrivilege":{"enabled\_by\_default":true,"enabled":true},"SeBackupPrivilege":{"enabled":false},"SeChangeNotifyPrivilege":{"enabled\_by\_default":true,"enabled":true},"SeCreateGlobalPrivilege":{"enabled\_by\_default":true,"enabled":true},"SeCreatePagefilePrivilege":{"enabled\_by\_default":true,"enabled":true},"SeCreatePermanentPrivilege":{"enabled\_by\_default":true,"enabled":true},"SeCreateSymbolicLinkPrivilege":{"enabled\_by\_default":true,"enabled":true},"SeDebugPrivilege":{"enabled\_by\_default":true,"enabled":true},"SeImpersonatePrivilege":{"enabled\_by\_default":true,"enabled":true},"SeIncreaseBasePriorityPrivilege":{"enabled\_by\_default":true,"enabled":true},"SeIncreaseQuotaPrivilege":{"enabled":false},"SeIncreaseWorkingSetPrivilege":{"enabled\_by\_default":true,"enabled":true},"SeLoadDriverPrivilege":{"enabled":false},"SeLockMemoryPrivilege":{"enabled\_by\_default":true,"enabled":true},"SeManageVolumePrivilege":{"enabled":false},"SeProfileSingleProcessPrivilege":{"enabled\_by\_default":true,"enabled":true},"SeRestorePrivilege":{"enabled":false},"SeSecurityPrivilege":{"enabled":false},"SeShutdownPrivilege":{"enabled":false},"SeSystemEnvironmentPrivilege":{"enabled":false},"SeSystemProfilePrivilege":{"enabled\_by\_default":true,"enabled":true},"SeSystemtimePrivilege":{"enabled":false},"SeTakeOwnershipPrivilege":{"enabled":false},"SeTcbPrivilege":{"enabled\_by\_default":true,"enabled":true},"SeTimeZonePrivilege":{"enabled\_by\_default":true,"enabled":true},"SeUndockPrivilege":{"enabled":false}}}  
2021-01-05T14:29:47.349+0530 INFO helper/privileges\_windows.go:87 SeDebugPrivilege is enabled. SeDebugPrivilege=(Default, Enabled)  
2021-01-05T14:29:49.874+0530 WARN [cfgwarn] application\_pool/application\_pool.go:43 BETA: The iis application\_pool metricset is beta.  
2021-01-05T14:29:49.968+0530 INFO [monitoring] log/log.go:153 Total non-zero metrics {"monitoring": {"metrics": {"beat":{"cpu":{"system":{"ticks":2340,"time":{"ms":2340}},"total":{"ticks":3042,"time":{"ms":3042},"value":3042},"user":{"ticks":702,"time":{"ms":702}}},"handles":{"open":392},"info":{"ephemeral\_id":"ef6a8a18-6246-4bb8-9847-71361b4f7a34","uptime":{"ms":3487}},"memstats":{"gc\_next":15771024,"memory\_alloc":10931968,"memory\_total":31180888,"rss":69111808},"runtime":{"goroutines":38}},"libbeat":{"config":{"module":{"running":0}},"output":{"type":"elasticsearch"},"pipeline":{"clients":0,"events":{"active":0}}},"system":{"cpu":{"cores":4}}}}}  
2021-01-05T14:29:49.968+0530 INFO [monitoring] log/log.go:154 Uptime: 3.4881433s  
2021-01-05T14:29:49.968+0530 INFO [monitoring] log/log.go:131 Stopping metrics logging.  
2021-01-05T14:29:49.968+0530 INFO instance/beat.go:461 metricbeat stopped.  
2021-01-05T14:29:49.990+0530 ERROR instance/beat.go:956 Exiting: 2 errors: could not create connection to db: error doing ping to db: Login error: read tcp [::1]:65459-\>[::1]:1433: wsarecv: An existing connection was forcibly closed by the remote host.; could not create connection to db: error doing ping to db: Login error: read tcp [::1]:65461-\>[::1]:1433: wsarecv: An existing connection was forcibly closed by the remote host.'

---

<div class="post-metadata">

**Author:** ![ChrsMark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chrsmark/32/55858_2.png) [@ChrsMark](https://discuss.elastic.co/u/ChrsMark)\
**Post date:** [January 7, 2021, 2:50pm UTC](https://discuss.elastic.co/t/mssql-metric-in-windows/260197/4 "2021-01-07T14:50:17Z")

</div>

Hi!

The last log indicates that Metricbeat is not able to connect to DB. Can you check your configuration again and see what could be the reason?

C.

---

<div class="post-metadata">

**Author:** ![rohan0018](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rohan0018/32/79007_2.png) [@rohan0018](https://discuss.elastic.co/u/rohan0018)\
**Post date:** [January 11, 2021, 4:18am UTC](https://discuss.elastic.co/t/mssql-metric-in-windows/260197/5 "2021-01-11T04:18:39Z")

</div>

Hi!!!

I am able to connect Database server from other machines through SQL server Management Studio but not through mssql.yml

Below is configuration in mssql.yml

"# Module: mssql

# Docs: [https://www.elastic.co/guide/en/beats/metricbeat/7.10/metricbeat-module-mssql.html](https://www.elastic.co/guide/en/beats/metricbeat/7.10/metricbeat-module-mssql.html)

- module: mssql  
metricsets:
  - "transaction\_log"
  - "performance"  
hosts: ["sqlserver://sqlserveraddress"]  
username: domain\username (mentioned correct user name)  
password: verysecurepassword (mentioned correct password)  
period: 10s  
"

please let me know if this is correct way to define MSSQL DB server parameters in yml file.

---

<div class="post-metadata">

**Author:** ![MarianaD](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marianad/32/42687_2.png) [@MarianaD](https://discuss.elastic.co/u/MarianaD)\
**Post date:** [January 11, 2021, 12:52pm UTC](https://discuss.elastic.co/t/mssql-metric-in-windows/260197/6 "2021-01-11T12:52:51Z")

</div>

hi @rohan0018, are you using Active Directory domain credentials for the login? Else you have to specify native user credentials as part of the host string with the following format:  
Ex  
`hosts: ["sqlserver://sa@localhost"]]`

---

<div class="post-metadata">

**Author:** ![rohan0018](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rohan0018/32/79007_2.png) [@rohan0018](https://discuss.elastic.co/u/rohan0018)\
**Post date:** [January 12, 2021, 8:02am UTC](https://discuss.elastic.co/t/mssql-metric-in-windows/260197/7 "2021-01-12T08:02:02Z")

</div>

Hi Mariana,

As per your suggestion I have tried below format

"hosts: ["sqlserver://sa:password@sqlserveraddress"]"

but no luck, I got below logs when tried with above format.

"Exiting: 2 errors: host parsing failed for mssql-transaction\_log: error parsing URL: parse "sqlserver://sa:"sa user password": invalid port ":"sa user password"" after host; host parsing failed for mssql-performance: error parsing URL: parse "sqlserver://sa:sa user password": invalid port ":"sa user password"" after host"

---

<div class="post-metadata">

**Author:** ![rohan0018](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rohan0018/32/79007_2.png) [@rohan0018](https://discuss.elastic.co/u/rohan0018)\
**Post date:** [January 20, 2021, 8:17am UTC](https://discuss.elastic.co/t/mssql-metric-in-windows/260197/8 "2021-01-20T08:17:41Z")

</div>

any help on this issue.

---

<div class="post-metadata">

**Author:** ![Mario\_Castro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mario_castro/32/35107_2.png) [@Mario\_Castro](https://discuss.elastic.co/u/Mario_Castro)\
**Post date:** [January 28, 2021, 3:25pm UTC](https://discuss.elastic.co/t/mssql-metric-in-windows/260197/9 "2021-01-28T15:25:16Z")

</div>

Hi @rohan0018 🙂

Please, can you detail your Metricbeat version, your MSSQL version and your Windows version? It might be some kind of version mismatch (we don't have like a compatibility matrix but maybe you have found some issue on this).

On the other hand, can you try connecting **only** using the hosts field and using an **addressable IP** (not a hostname)? Just to check if it's something related.

---

<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:** [February 25, 2021, 5:25pm UTC](https://discuss.elastic.co/t/mssql-metric-in-windows/260197/10 "2021-02-25T17:25:41Z")

</div>

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