Relevant telegraf.conf:
database_type = "SQLServer"
System info:
SQL Server 2016 running on Windows Server 2016
Telegraf v1.13.3
Steps to reproduce:
Collect SQL Server CPU metrics on a system with hyperthreading (and lots of cores)
The case I saw
From sys.dm_os_sys_info
cpu_count -> 80
hyperthread_ratio -> 20
- Collect CPU metrics
- Output example (notice the negative value of blue line):

When running the Telegraf SQL query:

Expected behavior:
Sum of all 3 CPU metrics should be equal to 100%
Actual behavior:
The calculation of sqlserver_process_cpu is incorrect.
The sum of sqlserver_process_cpu and system_idle_cpu gives more than 100% and thus the other_process_cpu gives negative value.
Additional info:
This problem is on the following T-SQL queries
sqlCPUHistory
sqlServerCpuV2
sqlServerRingBufferCpu
I have a fix for this, will open a PR.
Relevant telegraf.conf:
System info:
SQL Server 2016 running on Windows Server 2016
Telegraf v1.13.3
Steps to reproduce:
Collect SQL Server CPU metrics on a system with hyperthreading (and lots of cores)
The case I saw
From
sys.dm_os_sys_infocpu_count -> 80
hyperthread_ratio -> 20
When running the Telegraf SQL query:

Expected behavior:
Sum of all 3 CPU metrics should be equal to 100%
Actual behavior:
The calculation of
sqlserver_process_cpuis incorrect.The sum of
sqlserver_process_cpuandsystem_idle_cpugives more than 100% and thus theother_process_cpugives negative value.Additional info:
This problem is on the following T-SQL queries
sqlCPUHistory
sqlServerCpuV2
sqlServerRingBufferCpu
I have a fix for this, will open a PR.