A DBA should be able to review every statement SQLInsight sends to a monitored server before granting it access. "SQL Scripts/<rule-id>.sql" holds, per rule (82 built-in, 16 community), a Danish header (what and why, how C# judges the data, thresholds with config keys, severity, exact GRANTs, versions, collector file and member) and the collector's SQL verbatim, every version variant as its own batch. "_collectors/<Collector>.sql" holds each collector's queries once. The only statement that is not strictly read-only is documented in the scripts: the deadlock collector's session temp table (#system_health). Inline SQL in the collectors moved to internal constants and Build*Sql methods (no text changed), so SqlScriptTests can check that the scripts still contain the SQL the code sends, that every rule has a script, that every collector query is registered, and that nothing writes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
23 lines
1.5 KiB
Transact-SQL
23 lines
1.5 KiB
Transact-SQL
-- ===================================================================================================================
|
|
-- Collector: TraceFlagCollector ("trace-flags")
|
|
-- ===================================================================================================================
|
|
-- Hvad: De globalt slåede trace flags.
|
|
-- Fil: src/SQLInsight.Collectors/Instance/TraceFlagCollector.cs
|
|
-- Interval: 15 min som standard (SQLInsight:CollectorIntervals:trace-flags)
|
|
-- Versioner: Alle (SQL Server 2000 og nyere)
|
|
--
|
|
-- Rettigheder til agentens login (se db/permissions/grant-least-privilege.sql; [agent] = agentens login):
|
|
-- Ingen ekstra rettighed: public må læse dette (SERVERPROPERTY, sys.configurations, DBCC TRACESTATUS, xp_msver).
|
|
--
|
|
-- Bruges af: SQLI-CFG-012
|
|
-- Read-only: Ja: kun SELECT samt DBCC TRACESTATUS (læser trace flags), SET-sessionsindstillinger. Intet ændrer
|
|
-- data, indstillinger eller objekter.
|
|
-- Kørsel: Kør i SSMS som agentens login. Hver variant er sin egen batch (GO); en variant for en anden SQL Server-version
|
|
-- end din kan fejle - det er forventet. Agenten kører altid med sessionsindstillingerne i _collectors/InstanceProbe.sql.
|
|
-- ===================================================================================================================
|
|
|
|
-- Variant: Alle versioner (SQL Server 2000 og nyere)
|
|
-- Kilde: TraceFlagCollector.Sql
|
|
-- Kode: src/SQLInsight.Collectors/Instance/TraceFlagCollector.cs : TraceFlagCollector.Sql
|
|
DBCC TRACESTATUS(-1) WITH NO_INFOMSGS
|
|
GO
|