Commit 7fddf92
Fix erikdarlingdata#1048: stop alert engine fabricating 100% host CPU on Linux
The erikdarlingdata#1049 fix corrected every path that reads CPU from the collected
table (collector, views, chart reads), but the alert engine doesn't read
that table — DatabaseService.NocHealth.GetCpuPercentAsync runs its own
live query against sys.dm_os_ring_buffers and was never touched. It
computes other_cpu_percent = 100 - SystemIdle - ProcessUtilization, and
since SystemIdle is always 0 on SQL Server on Linux, that returns
100 - sqlcpu. AlertHealthResult.TotalCpuPercent then sums to a permanent
100%, so AlertStateService's TotalCpuPercent >= CpuThresholdPercent check
fires the host-CPU alert forever — exactly what the reporter still saw
after installing the nightly.
Fix: apply the same Linux guard used by install/18, RemoteCollectorService.Cpu,
and FinOps.Inventory — detect host_platform via sp_executesql behind an
OBJECT_ID(N'sys.dm_os_host_info', N'V') check (so SQL 2016 never binds the
2017+ DMV) and return NULL for other_cpu_percent on Linux. The existing
TotalCpuPercent getter already falls back to the SQL-only figure when
OtherCpuPercent is null, so the alert clears. Windows behavior is unchanged.
Dashboard-only change — no schema or installer impact.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 176b931 commit 7fddf92
1 file changed
Lines changed: 31 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
255 | 271 | | |
256 | 272 | | |
257 | 273 | | |
| |||
260 | 276 | | |
261 | 277 | | |
262 | 278 | | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
274 | 294 | | |
275 | 295 | | |
276 | 296 | | |
| |||
0 commit comments