windows_exporter icon indicating copy to clipboard operation
windows_exporter copied to clipboard

Exporter can't use the right SQL Server Instance Name

Open maurodouglas opened this issue 1 year ago • 6 comments

I installed the version 0.24 of the windows_exporter, and enable the mssql colector, but it's trying to get the MSSQLSERVER instance, although the windows reg key has the right value (PROD) ;

image

Am I doing something wrong here?

maurodouglas avatar Nov 10 '23 12:11 maurodouglas

Hi @maurodouglas

Can you see in the logs the following warning ?(Most probably in windows eventviewer, it depends how you run the service and what log level is set) https://github.com/prometheus-community/windows_exporter/blob/9c0be5fd48b0fa417e21b98466c45c0595402bd9/collector/mssql.go#L44

In case win exporter can not open the registry it should print that message followed by the error which should indicate why it can not open the registry.

DiniFarb avatar Nov 10 '23 15:11 DiniFarb

Hi @maurodouglas

Can you see in the logs the following warning ?(Most probably in windows eventviewer, it depends how you run the service and what log level is set)

https://github.com/prometheus-community/windows_exporter/blob/9c0be5fd48b0fa417e21b98466c45c0595402bd9/collector/mssql.go#L44

In case win exporter can not open the registry it should print that message followed by the error which should indicate why it can not open the registry.

Thanks for the response;

Here's all the log

C:\Program Files (x86)\windows_exporter>"C:\Program Files (x86)\windows_exporter\windows_exporter.exe" --config.file=config.yml --collectors.enabled="cs,os,cpu,mssql,memory,system,logical_disk,net,tcp,process,service"
ts=2023-11-10T15:40:57.656Z caller=config.go:63 level=info msg="Loading configuration file: config.yml"
ts=2023-11-10T15:40:57.657Z caller=exporter.go:91 level=debug msg="Initializing SWbemServices"
ts=2023-11-10T15:40:57.879Z caller=collector.go:51 level=debug msg="Detected Windows version 6.300000\n"
**ts=2023-11-10T15:40:57.879Z caller=mssql.go:44 level=warn collector=mssql msg="Couldn't open registry to determine SQL instances" err="The system cannot find the file specified."**
ts=2023-11-10T15:40:57.881Z caller=process.go:113 level=warn collector=process msg="No filters specified for process collector. This will generate a very large number of metrics!"
ts=2023-11-10T15:40:57.881Z caller=collector.go:51 level=debug collector=cpu msg="Detected Windows version 6.300000\n"
ts=2023-11-10T15:40:57.882Z caller=service.go:60 level=warn collector=service msg="No where-clause specified for service collector. This will generate a very large number of metrics!"

But I Can get the key value from cmd prompt;

image

maurodouglas avatar Nov 10 '23 16:11 maurodouglas

The only thing I can think of now is that its some sort of access issue. Have you tried running the windows_exporter as Administrator as you did for Reg Query... in CMD ?

DiniFarb avatar Nov 10 '23 16:11 DiniFarb

Yeah I used the same prompt;

image

On the KEY I set full access to everybody;

image

I resolved the issue altering the default value for PROD and building a version;

sqlDefaultInstance["PROD"] = ""

maurodouglas avatar Nov 10 '23 17:11 maurodouglas

I tried to reproduce your issue again and the only way I could was if I added a space to the SQL Key like: image

The diff between with and without space on the SQL key is barely seeable but if I look on your screenshot it might be possible that there is one.

DiniFarb avatar Nov 20 '23 16:11 DiniFarb

This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.

github-actions[bot] avatar Feb 19 '24 02:02 github-actions[bot]