influxdata / influxdata/telegraf

[inputs.sqlserver] SQLServerDatabaseIO produces no metrics when running as a Windows service, works correctly with --test

Open
#18,672 3 comments 0 reactions 1 assignee Claimed by @srebhan View on GitHub
Dominant language
Go
Stars
17.8k
Forks
5.8k
Avg merge
1d 20h
Merged PRs (30d)
161

Description

## Environment

Telegraf: 1.37.0
OS: Windows Server 2019 Standard 10.0.17763.0
SQL Server: 2019 (MSSQL 15), named instance
Output plugin: outputs.prometheus_client, metric_version = 2
database_type: SQLServer
Description

The measurement sqlserver_database_io is visible in --test mode but never appears in the /metrics endpoint when Telegraf runs as a Windows service. All other SQLServer queries (sqlserver_performance, sqlserver_waitstats, etc.) work correctly in both modes.

## Steps to reproduce

1. Install Telegraf 1.37.0 as a Windows service
2. Configure inputs.sqlserver with database_type = "SQLServer"
3. Run telegraf.exe --config telegraf.conf --test → sqlserver_database_io metrics appear
4. Start the Telegraf service → query http://localhost:9273/metrics → sqlserver_database_io is absent
What was verified

- health_metric shows 13/13 attempted and successful queries — SQLServerDatabaseIO is included based on github
- No errors or warnings in debug logs related to sqlserver
- outputs.file with namepass = ["sqlserver_database_io"] produces an empty file
- sys.dm_io_virtual_file_stats returns 23 rows when executed as a scheduled task in session 0 (NT AUTHORITY\SYSTEM)
- sys.dm_os_volume_stats works for all files (CROSS APPLY returns no missing entries)
- NT AUTHORITY\SYSTEM has VIEW SERVER STATE granted
- No metrics dropped (metrics_dropped = 0)
- tagexclude has no effect
- interval = "120s" on inputs.sqlserver has no effect
Minimal config

```toml
[[outputs.prometheus_client]]
listen = ":9273"
metric_version = 2
export_timestamp = true

[[inputs.sqlserver]]
servers = ["Server=localhost;Port=1433;app name=telegraf;log=1;"]
database_type = "SQLServer"
```

## Expected behavior

sqlserver_database_io metrics appear in /metrics like all other sqlserver_* measurements.

## Actual behavior

sqlserver_database_io is completely absent from /metrics. No error is logged. The query is reported as successful by health_metric.

Note

This issue appears similar to #3349. The problem is not specific to this single server but most (90%) of the others servers running the same Telegraf version and config expose sqlserver_database_io correctly.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.