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.6 KiB
Transact-SQL
23 lines
1.6 KiB
Transact-SQL
-- ===================================================================================================================
|
|
-- Collector: SuspectPageCollector ("suspect-pages")
|
|
-- ===================================================================================================================
|
|
-- Hvad: Sider, SQL Server har registreret som korrupte (msdb.dbo.suspect_pages).
|
|
-- Fil: src/SQLInsight.Collectors/Instance/SuspectPageCollector.cs
|
|
-- Interval: 15 min som standard (SQLInsight:CollectorIntervals:suspect-pages)
|
|
-- Versioner: SQL Server 2005 og nyere
|
|
--
|
|
-- Rettigheder til agentens login (se db/permissions/grant-least-privilege.sql; [agent] = agentens login):
|
|
-- USE msdb; GRANT SELECT ON dbo.suspect_pages TO [agent];
|
|
--
|
|
-- Bruges af: SQLI-DB-010
|
|
-- 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: SuspectPageCollector.Sql
|
|
-- Kode: src/SQLInsight.Collectors/Instance/SuspectPageCollector.cs : SuspectPageCollector.Sql
|
|
SELECT ISNULL(DB_NAME(database_id), CAST(database_id AS nvarchar(20))), file_id, page_id, event_type, error_count, last_update_date
|
|
FROM msdb.dbo.suspect_pages
|
|
GO
|