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>
33 lines
2.1 KiB
Transact-SQL
33 lines
2.1 KiB
Transact-SQL
-- ===================================================================================================================
|
|
-- Collector: ConfigurationCollector ("configuration")
|
|
-- ===================================================================================================================
|
|
-- Hvad: sp_configure: konfigureret værdi og værdi i brug for alle serverindstillinger.
|
|
-- Fil: src/SQLInsight.Collectors/Instance/ConfigurationCollector.cs
|
|
-- Interval: 15 min som standard (SQLInsight:CollectorIntervals:configuration)
|
|
-- 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-001, SQLI-CFG-002, SQLI-CFG-003, SQLI-CFG-004, SQLI-CFG-005, SQLI-CFG-006, SQLI-CFG-007,
|
|
-- SQLI-CFG-008, SQLI-CFG-009, SQLI-CFG-010, SQLI-CFG-011
|
|
-- Read-only: Ja: kun SELECT samt 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: SQL Server 2005 og nyere
|
|
-- Kilde: ConfigurationCollector.Sql2005
|
|
-- Kode: src/SQLInsight.Collectors/Instance/ConfigurationCollector.cs : ConfigurationCollector.Sql2005
|
|
SELECT name, CAST(value AS bigint), CAST(value_in_use AS bigint) FROM sys.configurations
|
|
GO
|
|
|
|
-- Variant: SQL Server 2000 (legacy ODBC-sti)
|
|
-- Kilde: ConfigurationCollector.Sql2000
|
|
-- Kode: src/SQLInsight.Collectors/Instance/ConfigurationCollector.cs : ConfigurationCollector.Sql2000
|
|
SELECT v.name, CAST(c.value AS bigint), CAST(r.value AS bigint)
|
|
FROM master.dbo.spt_values v
|
|
JOIN master.dbo.sysconfigures c ON c.config = v.number
|
|
JOIN master.dbo.syscurconfigs r ON r.config = v.number
|
|
WHERE v.type = 'C'
|
|
GO
|