From 4e949162704bb198b3b50b803f0b6fc123a19fd7 Mon Sep 17 00:00:00 2001 From: Ajay Kumar Dwivedi Date: Sun, 19 Apr 2026 12:51:49 +0530 Subject: [PATCH 1/4] feat(sql_exporter): add sqlagent_jobs, backup_history, xevent collectors Add three new collectors and register them in sql_exporter.yml under two new jobs (mssql_msdb, mssql_xevent): - mssql_sqlagent_jobs: per-job enabled / last_run_outcome / last_run_duration_seconds / last_run_end_time_utc / next_run_time_utc / is_running / step_failures_last_24h, sourced from msdb.dbo.sysjobs/sysjobhistory/sysjobactivity/sysjobschedules. - mssql_backup_history: per-(database, backup_type) last_time_utc / last_duration_seconds / last_size_bytes / last_compressed_size_bytes / age_seconds / count_last_24h, sourced from msdb.dbo.backupset. - mssql_xevent: aggregated events_count / cpu_time_ms_sum / duration_seconds_sum / logical_reads_sum / physical_reads_sum / writes_sum per (event_name, database_name, result, client_app_name) over the most recent 5 minutes. Caps at TOP 500 to bound cardinality. Guarded with an existence check on DBA.dbo.xevent_metrics so the collector is a no-op on instances that don't run the XEvent collector proc. --- .../mssql_backup_history.collector.yml | 118 ++++++++++++++ .../mssql_sqlagent_jobs.collector.yml | 151 ++++++++++++++++++ sql_exporter/mssql_xevent.collector.yml | 124 ++++++++++++++ sql_exporter/sql_exporter.yml | 15 ++ 4 files changed, 408 insertions(+) create mode 100644 sql_exporter/mssql_backup_history.collector.yml create mode 100644 sql_exporter/mssql_sqlagent_jobs.collector.yml create mode 100644 sql_exporter/mssql_xevent.collector.yml diff --git a/sql_exporter/mssql_backup_history.collector.yml b/sql_exporter/mssql_backup_history.collector.yml new file mode 100644 index 0000000..5046c42 --- /dev/null +++ b/sql_exporter/mssql_backup_history.collector.yml @@ -0,0 +1,118 @@ +# Backup history metrics for SQLMonitor. +# +# Required permissions (on msdb): +# +# GRANT SELECT ON OBJECT::msdb.dbo.backupset TO ; +# GRANT SELECT ON OBJECT::msdb.dbo.backupmediafamily TO ; +# +# One sample per (database_name, backup_type) so cardinality is bounded: +# SQL Server itself exposes at most ~8 backup_type values per database. +# +collector_name: mssql_backup_history + +min_interval: 5m + +metrics: + - metric_name: mssql_backup__last_time_utc + type: gauge + help: 'Unix epoch seconds when the last backup of the given type finished. 0 if no history.' + key_labels: [database_name, backup_type, backup_type_desc, recovery_model] + values: [last_backup_time_utc] + query_ref: mssql_backup_history_latest + + - metric_name: mssql_backup__last_duration_seconds + type: gauge + help: 'Duration (seconds) of the last backup of the given type.' + key_labels: [database_name, backup_type] + values: [last_backup_duration_seconds] + query_ref: mssql_backup_history_latest + + - metric_name: mssql_backup__last_size_bytes + type: gauge + help: 'Size (bytes) of the last backup of the given type.' + key_labels: [database_name, backup_type] + values: [last_backup_size_bytes] + query_ref: mssql_backup_history_latest + + - metric_name: mssql_backup__last_compressed_size_bytes + type: gauge + help: 'Compressed size (bytes) of the last backup of the given type.' + key_labels: [database_name, backup_type] + values: [last_backup_compressed_size_bytes] + query_ref: mssql_backup_history_latest + + - metric_name: mssql_backup__age_seconds + type: gauge + help: 'Age (seconds) of the last backup of the given type relative to server time.' + key_labels: [database_name, backup_type] + values: [backup_age_seconds] + query_ref: mssql_backup_history_latest + + - metric_name: mssql_backup__count_last_24h + type: gauge + help: 'Count of successful backups of the given type that finished within the last 24 hours.' + key_labels: [database_name, backup_type] + values: [count_last_24h] + query_ref: mssql_backup_history_latest + +queries: + - query_name: mssql_backup_history_latest + query: | + SET NOCOUNT ON; + + IF OBJECT_ID('tempdb..#latest') IS NOT NULL DROP TABLE #latest; + IF OBJECT_ID('tempdb..#count_24h') IS NOT NULL DROP TABLE #count_24h; + + -- Latest row per (database_name, type) from backupset. + WITH b AS ( + SELECT database_name, type, + backup_finish_date, backup_start_date, + backup_size, compressed_backup_size, recovery_model, + rn = ROW_NUMBER() OVER ( + PARTITION BY database_name, type + ORDER BY backup_finish_date DESC, backup_set_id DESC) + FROM msdb.dbo.backupset + WHERE backup_finish_date IS NOT NULL + ) + SELECT database_name, type, backup_finish_date, backup_start_date, + backup_size, compressed_backup_size, recovery_model + INTO #latest + FROM b WHERE rn = 1; + + -- 24-hour count per (database_name, type). + SELECT database_name, type, c = COUNT(*) + INTO #count_24h + FROM msdb.dbo.backupset + WHERE backup_finish_date IS NOT NULL + AND backup_finish_date >= DATEADD(hour, -24, GETDATE()) + GROUP BY database_name, type; + + SELECT database_name = CAST(COALESCE(l.database_name, N'') AS nvarchar(256)), + backup_type = CAST(l.type AS nvarchar(4)), + backup_type_desc = CASE l.type + WHEN 'D' THEN N'Database (Full)' + WHEN 'I' THEN N'Differential' + WHEN 'L' THEN N'Log' + WHEN 'F' THEN N'File or Filegroup' + WHEN 'G' THEN N'File Differential' + WHEN 'P' THEN N'Partial' + WHEN 'Q' THEN N'Partial Differential' + ELSE N'Unknown' END, + recovery_model = CAST(COALESCE(l.recovery_model, N'') AS nvarchar(64)), + last_backup_time_utc = CAST( + DATEDIFF_BIG(second, + CONVERT(datetime2, '19700101'), + DATEADD(mi, DATEDIFF(mi, GETDATE(), GETUTCDATE()), + l.backup_finish_date)) AS bigint), + last_backup_duration_seconds = CAST( + DATEDIFF(second, l.backup_start_date, l.backup_finish_date) + AS bigint), + last_backup_size_bytes = CAST(COALESCE(l.backup_size, 0) AS bigint), + last_backup_compressed_size_bytes = CAST( + COALESCE(l.compressed_backup_size, l.backup_size, 0) AS bigint), + backup_age_seconds = CAST( + DATEDIFF_BIG(second, l.backup_finish_date, GETDATE()) AS bigint), + count_last_24h = CAST(COALESCE(c24.c, 0) AS bigint) + FROM #latest l + LEFT JOIN #count_24h c24 + ON c24.database_name = l.database_name AND c24.type = l.type; diff --git a/sql_exporter/mssql_sqlagent_jobs.collector.yml b/sql_exporter/mssql_sqlagent_jobs.collector.yml new file mode 100644 index 0000000..1d47d25 --- /dev/null +++ b/sql_exporter/mssql_sqlagent_jobs.collector.yml @@ -0,0 +1,151 @@ +# SQL Agent job activity metrics for SQLMonitor. +# +# Required permissions (on msdb): +# +# GRANT SELECT ON OBJECT::msdb.dbo.sysjobs TO ; +# GRANT SELECT ON OBJECT::msdb.dbo.sysjobhistory TO ; +# GRANT SELECT ON OBJECT::msdb.dbo.sysjobactivity TO ; +# GRANT SELECT ON OBJECT::msdb.dbo.sysjobschedules TO ; +# GRANT SELECT ON OBJECT::msdb.dbo.sysschedules TO ; +# GRANT SELECT ON OBJECT::msdb.dbo.syscategories TO ; +# +collector_name: mssql_sqlagent_jobs + +min_interval: 1m + +metrics: + - metric_name: mssql_sqlagent_job__enabled + type: gauge + help: 'Whether the SQL Agent job is enabled (1) or disabled (0).' + key_labels: [job_name, job_id, category_name, owner_name] + values: [enabled] + query_ref: mssql_sqlagent_jobs_latest + + - metric_name: mssql_sqlagent_job__last_run_outcome + type: gauge + help: 'Last run outcome code: 0=Failed, 1=Succeeded, 2=Retry, 3=Canceled, 5=Unknown/no-history.' + key_labels: [job_name, job_id, category_name, owner_name, last_run_outcome_desc] + values: [last_run_outcome] + query_ref: mssql_sqlagent_jobs_latest + + - metric_name: mssql_sqlagent_job__last_run_duration_seconds + type: gauge + help: 'Duration (seconds) of the last completed run of the job.' + key_labels: [job_name, job_id] + values: [last_run_duration_seconds] + query_ref: mssql_sqlagent_jobs_latest + + - metric_name: mssql_sqlagent_job__last_run_end_time_utc + type: gauge + help: 'Unix epoch seconds when the last completed run of the job ended. 0 if no history.' + key_labels: [job_name, job_id] + values: [last_run_end_time_utc] + query_ref: mssql_sqlagent_jobs_latest + + - metric_name: mssql_sqlagent_job__next_run_time_utc + type: gauge + help: 'Unix epoch seconds for the next scheduled run of the job. 0 if unscheduled.' + key_labels: [job_name, job_id] + values: [next_run_time_utc] + query_ref: mssql_sqlagent_jobs_latest + + - metric_name: mssql_sqlagent_job__is_running + type: gauge + help: 'Whether the SQL Agent job is currently running (1) or idle (0).' + key_labels: [job_name, job_id] + values: [is_running] + query_ref: mssql_sqlagent_jobs_latest + + - metric_name: mssql_sqlagent_job__step_failures_last_24h + type: gauge + help: 'Count of job step failures (run_status=0, step_id>0) in the last 24 hours.' + key_labels: [job_name, job_id] + values: [step_failures_last_24h] + query_ref: mssql_sqlagent_jobs_latest + +queries: + - query_name: mssql_sqlagent_jobs_latest + query: | + SET NOCOUNT ON; + + IF OBJECT_ID('tempdb..#latest_outcome') IS NOT NULL DROP TABLE #latest_outcome; + IF OBJECT_ID('tempdb..#step_fails_24h') IS NOT NULL DROP TABLE #step_fails_24h; + IF OBJECT_ID('tempdb..#running') IS NOT NULL DROP TABLE #running; + IF OBJECT_ID('tempdb..#next_run') IS NOT NULL DROP TABLE #next_run; + + -- Latest outcome-row per job (step_id = 0 in sysjobhistory). + WITH h AS ( + SELECT job_id, run_status, run_duration, + run_end_dt = msdb.dbo.agent_datetime(run_date, run_time), + run_seconds = (run_duration / 10000) * 3600 + + ((run_duration / 100) % 100) * 60 + + (run_duration % 100), + rn = ROW_NUMBER() OVER (PARTITION BY job_id + ORDER BY run_date DESC, run_time DESC, + instance_id DESC) + FROM msdb.dbo.sysjobhistory + WHERE step_id = 0 + ) + SELECT job_id, run_status, run_seconds, run_end_dt + INTO #latest_outcome + FROM h WHERE rn = 1; + + -- Step failures in the last 24 hours. + SELECT h.job_id, failures_24h = COUNT(*) + INTO #step_fails_24h + FROM msdb.dbo.sysjobhistory h + WHERE h.step_id > 0 AND h.run_status = 0 + AND msdb.dbo.agent_datetime(h.run_date, h.run_time) + >= DATEADD(hour, -24, GETDATE()) + GROUP BY h.job_id; + + -- Currently running (sysjobactivity row with start_execution_date set and stop_execution_date NULL). + SELECT a.job_id, is_running = 1 + INTO #running + FROM msdb.dbo.sysjobactivity a + INNER JOIN ( + SELECT job_id, max_ts = MAX(session_id) + FROM msdb.dbo.sysjobactivity GROUP BY job_id + ) m ON m.job_id = a.job_id AND m.max_ts = a.session_id + WHERE a.start_execution_date IS NOT NULL + AND a.stop_execution_date IS NULL; + + -- Earliest next-run time per job across active schedules. + SELECT js.job_id, + next_run_dt = MIN(msdb.dbo.agent_datetime( + NULLIF(js.next_run_date, 0), NULLIF(js.next_run_time, 0))) + INTO #next_run + FROM msdb.dbo.sysjobschedules js + INNER JOIN msdb.dbo.sysschedules s ON s.schedule_id = js.schedule_id + WHERE s.enabled = 1 AND js.next_run_date > 0 + GROUP BY js.job_id; + + SELECT job_name = CAST(j.name AS nvarchar(256)), + job_id = CONVERT(nvarchar(36), j.job_id), + category_name = ISNULL(c.name, N''), + owner_name = ISNULL(SUSER_SNAME(j.owner_sid), N''), + enabled = CAST(j.enabled AS int), + last_run_outcome = ISNULL(lo.run_status, 5), + last_run_outcome_desc = CASE ISNULL(lo.run_status, 5) + WHEN 0 THEN N'Failed' + WHEN 1 THEN N'Succeeded' + WHEN 2 THEN N'Retry' + WHEN 3 THEN N'Canceled' + ELSE N'Unknown' END, + last_run_duration_seconds = ISNULL(lo.run_seconds, 0), + last_run_end_time_utc = CAST(ISNULL( + DATEDIFF_BIG(second, + CONVERT(datetime2, '19700101'), + DATEADD(mi, DATEDIFF(mi, GETDATE(), GETUTCDATE()), lo.run_end_dt)), 0) AS bigint), + next_run_time_utc = CAST(ISNULL( + DATEDIFF_BIG(second, + CONVERT(datetime2, '19700101'), + DATEADD(mi, DATEDIFF(mi, GETDATE(), GETUTCDATE()), nr.next_run_dt)), 0) AS bigint), + is_running = ISNULL(r.is_running, 0), + step_failures_last_24h = ISNULL(sf.failures_24h, 0) + FROM msdb.dbo.sysjobs j + LEFT JOIN msdb.dbo.syscategories c ON c.category_id = j.category_id + LEFT JOIN #latest_outcome lo ON lo.job_id = j.job_id + LEFT JOIN #step_fails_24h sf ON sf.job_id = j.job_id + LEFT JOIN #running r ON r.job_id = j.job_id + LEFT JOIN #next_run nr ON nr.job_id = j.job_id; diff --git a/sql_exporter/mssql_xevent.collector.yml b/sql_exporter/mssql_xevent.collector.yml new file mode 100644 index 0000000..0264089 --- /dev/null +++ b/sql_exporter/mssql_xevent.collector.yml @@ -0,0 +1,124 @@ +# Extended Event (xevent_metrics) aggregates for SQLMonitor. +# +# Source table: [DBA].[dbo].[xevent_metrics] populated by +# dbo.usp_collect_xevent_metrics (file target) or +# usp_collect_xevent_metrics_ringbuffer (ring buffer target). See +# SCH-Create-XEvents.sql / SCH-Create-XEvents-RingBuffer.sql. +# +# Cardinality strategy: aggregate per (event_name, database_name, result, +# client_app_name) over the most recent 5 minutes. Top 500 rows by event +# count to cap label combos even on busy workloads. Use PromQL rate() on +# the *_total counters to render the XEvent Trend dashboard. +# +# Required permissions: +# +# USE [DBA]; GRANT SELECT ON OBJECT::dbo.xevent_metrics TO ; +# +collector_name: mssql_xevent + +min_interval: 1m + +metrics: + - metric_name: mssql_xevent__events_last_5m + type: gauge + help: 'Count of extended events in the last 5 minutes, grouped by event/database/result/app.' + key_labels: [event_name, database_name, result, client_app_name] + values: [events_count] + query_ref: mssql_xevent_recent + + - metric_name: mssql_xevent__cpu_time_ms_last_5m + type: gauge + help: 'Sum of cpu_time_ms over extended events in the last 5 minutes.' + key_labels: [event_name, database_name, result, client_app_name] + values: [cpu_time_ms_sum] + query_ref: mssql_xevent_recent + + - metric_name: mssql_xevent__duration_seconds_last_5m + type: gauge + help: 'Sum of duration_seconds over extended events in the last 5 minutes.' + key_labels: [event_name, database_name, result, client_app_name] + values: [duration_seconds_sum] + query_ref: mssql_xevent_recent + + - metric_name: mssql_xevent__logical_reads_last_5m + type: gauge + help: 'Sum of logical_reads over extended events in the last 5 minutes.' + key_labels: [event_name, database_name, result, client_app_name] + values: [logical_reads_sum] + query_ref: mssql_xevent_recent + + - metric_name: mssql_xevent__physical_reads_last_5m + type: gauge + help: 'Sum of physical_reads over extended events in the last 5 minutes.' + key_labels: [event_name, database_name, result, client_app_name] + values: [physical_reads_sum] + query_ref: mssql_xevent_recent + + - metric_name: mssql_xevent__writes_last_5m + type: gauge + help: 'Sum of writes over extended events in the last 5 minutes.' + key_labels: [event_name, database_name, result, client_app_name] + values: [writes_sum] + query_ref: mssql_xevent_recent + + - metric_name: mssql_xevent__collection_time_utc + type: gauge + help: 'Unix epoch seconds when this 5-minute window was aggregated.' + key_labels: [event_name, database_name, result, client_app_name] + values: [collection_time_utc] + query_ref: mssql_xevent_recent + +queries: + - query_name: mssql_xevent_recent + query: | + SET NOCOUNT ON; + SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; + + IF DB_ID('DBA') IS NULL + OR OBJECT_ID('DBA.dbo.xevent_metrics') IS NULL + BEGIN + -- Emit an empty result set so the exporter marks the query OK + -- but publishes no samples on instances that do not run the + -- xevent_metrics collector. + SELECT TOP 0 + CAST(N'' AS nvarchar(128)) AS event_name, + CAST(N'' AS nvarchar(128)) AS database_name, + CAST(N'' AS nvarchar(32)) AS result, + CAST(N'' AS nvarchar(256)) AS client_app_name, + CAST(0 AS bigint) AS events_count, + CAST(0 AS bigint) AS cpu_time_ms_sum, + CAST(0 AS bigint) AS duration_seconds_sum, + CAST(0 AS bigint) AS logical_reads_sum, + CAST(0 AS bigint) AS physical_reads_sum, + CAST(0 AS bigint) AS writes_sum, + CAST(0 AS bigint) AS collection_time_utc; + RETURN; + END; + + DECLARE @now datetime2 = SYSDATETIME(); + DECLARE @from datetime2 = DATEADD(minute, -5, @now); + DECLARE @now_utc bigint = DATEDIFF_BIG(second, + CONVERT(datetime2, '19700101'), SYSUTCDATETIME()); + + DECLARE @sql nvarchar(max) = N' + SELECT TOP 500 + event_name = CAST(COALESCE(x.event_name, N'''') AS nvarchar(128)), + database_name = CAST(COALESCE(x.database_name, N'''') AS nvarchar(128)), + result = CAST(COALESCE(x.result, N'''') AS nvarchar(32)), + client_app_name = CAST(COALESCE(x.client_app_name, N'''') AS nvarchar(256)), + events_count = CAST(COUNT_BIG(*) AS bigint), + cpu_time_ms_sum = CAST(SUM(CAST(x.cpu_time_ms AS bigint)) AS bigint), + duration_seconds_sum = CAST(SUM(CAST(x.duration_seconds AS bigint)) AS bigint), + logical_reads_sum = CAST(SUM(CAST(x.logical_reads AS bigint)) AS bigint), + physical_reads_sum = CAST(SUM(CAST(x.physical_reads AS bigint)) AS bigint), + writes_sum = CAST(SUM(CAST(x.writes AS bigint)) AS bigint), + collection_time_utc = @now_utc + FROM [DBA].[dbo].[xevent_metrics] AS x WITH (NOLOCK) + WHERE x.event_time >= @from AND x.event_time <= @now + GROUP BY x.event_name, x.database_name, x.result, x.client_app_name + ORDER BY events_count DESC'; + + EXEC sp_executesql + @sql, + N'@from datetime2, @now datetime2, @now_utc bigint', + @from = @from, @now = @now, @now_utc = @now_utc; diff --git a/sql_exporter/sql_exporter.yml b/sql_exporter/sql_exporter.yml index e141b57..3ca522b 100644 --- a/sql_exporter/sql_exporter.yml +++ b/sql_exporter/sql_exporter.yml @@ -42,6 +42,21 @@ jobs: - targets: localhost: 'sqlserver://localhost:1433/master?trusted_connection=yes&encrypt=true&TrustServerCertificate=true' + - job_name: mssql_msdb + collectors: + - mssql_sqlagent_jobs + - mssql_backup_history + static_configs: + - targets: + localhost: 'sqlserver://localhost:1433/master?trusted_connection=yes&encrypt=true&TrustServerCertificate=true' + + - job_name: mssql_xevent + collectors: + - mssql_xevent + static_configs: + - targets: + localhost: 'sqlserver://localhost:1433/master?trusted_connection=yes&encrypt=true&TrustServerCertificate=true' + # Collector files specifies a list of globs. One collector definition is read from each matching file. # Glob patterns are supported (see for syntax). collector_files: From 7a9112f94df22fecd8f87dbbd60aeb85df726749 Mon Sep 17 00:00:00 2001 From: Ajay Kumar Dwivedi Date: Sun, 19 Apr 2026 12:52:21 +0530 Subject: [PATCH 2/4] feat(dashboards): add 12 Prometheus-backed dashboards (Phase 1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Port 12 SQLMonitor Grafana dashboards to Prometheus under sql_exporter/Prometheus-Dashboards/. Each dashboard is generated from a small Python spec; every spec produces a *.json that imports directly into Grafana (schemaVersion 42, __inputs-bound DS_PROMETHEUS). Dashboards (UID / data panels / text-link panels): prom_core_metrics_trend 9 / 0 prom_wait_stats 4 / 0 prom_disk_space 5 / 0 prom_ag_health_state 3 / 0 prom_sql_agent_jobs 6 / 0 prom_backup_history 6 / 0 prom_xevent_trend 4 / 0 prom_database_file_io_stats 12 / 0 prom_dba_inventory 6 / 8 prom_monitoring_live_all_servers 15 / 6 prom_monitoring_live_distributed 52 / 6 prom_monitoring_perfmon_quest 51 / 4 Helper library (_lib/prom_dashboard.py, _lib/build.py): - Panel, Target, query_var, custom_var, constant_var dataclasses. - row() and legacy_link_panel() helpers. - build_dashboard(): per-panel-type options, thresholds, transforms. - write_dashboard(): JSON serialization. Specs (_specs/*.py) use high-fidelity PromQL patterns: - increase(metric[$__range]) for selective-duration deltas. - @ end() offset $__range for prior-window comparison tables. - quantile_over_time($percentile_q, (expr)[$trend_window:]) for percentile trends. - topk($top_n, sum by (…) (…)) for bounded series rendering. Panels that require the SQLMonitor inventory DB (alert history, AG-vs-nonAG backup split, LAMA config-change deltas, dm_os_memory_clerks snapshot, tempdb/log_space cache tables, sql_server_patching) use legacy_link_panel(...) to markdown-link back to the SQL-backed dashboard, keeping every source section accounted for. Developer tooling (_tools/): - inspect_panels.py: source dashboard panel inventory. - validate.py: structural JSON + target/expr sanity check; all 12 generated dashboards validate clean. --- sql_exporter/Prometheus-Dashboards/.gitignore | 2 + .../Ag Health State.json | 781 +++ .../Prometheus-Dashboards/Backup History.json | 869 +++ .../Core Metrics - Trend.json | 1312 ++++ .../Prometheus-Dashboards/DBA Inventory.json | 930 +++ .../Database File IO Stats.json | 1460 ++++ .../Prometheus-Dashboards/Disk Space.json | 673 ++ .../Monitoring - Live - All Servers.json | 1573 +++++ .../Monitoring - Live - Distributed.json | 4677 +++++++++++++ ...nters - Quest Softwares - Distributed.json | 5859 +++++++++++++++++ sql_exporter/Prometheus-Dashboards/README.md | 133 + .../Prometheus-Dashboards/SQL Agent Jobs.json | 794 +++ .../Prometheus-Dashboards/Wait Stats.json | 591 ++ .../Prometheus-Dashboards/XEvent - Trend.json | 682 ++ .../Prometheus-Dashboards/_lib/build.py | 162 + .../_lib/prom_dashboard.py | 153 + .../_specs/ag_health_state.py | 162 + .../_specs/backup_history.py | 167 + .../_specs/core_metrics_trend.py | 225 + .../_specs/database_file_io_stats.py | 340 + .../_specs/dba_inventory.py | 204 + .../_specs/disk_space.py | 156 + .../_specs/monitoring_live_all_servers.py | 291 + .../_specs/monitoring_live_distributed.py | 475 ++ .../_specs/monitoring_perfmon_quest.py | 421 ++ .../_specs/sql_agent_jobs.py | 154 + .../_specs/wait_stats.py | 135 + .../_specs/xevent_trend.py | 124 + .../_tools/inspect_panels.py | 19 + .../Prometheus-Dashboards/_tools/validate.py | 60 + .../Prometheus-Dashboards/generate.py | 67 + 31 files changed, 23651 insertions(+) create mode 100644 sql_exporter/Prometheus-Dashboards/.gitignore create mode 100644 sql_exporter/Prometheus-Dashboards/Ag Health State.json create mode 100644 sql_exporter/Prometheus-Dashboards/Backup History.json create mode 100644 sql_exporter/Prometheus-Dashboards/Core Metrics - Trend.json create mode 100644 sql_exporter/Prometheus-Dashboards/DBA Inventory.json create mode 100644 sql_exporter/Prometheus-Dashboards/Database File IO Stats.json create mode 100644 sql_exporter/Prometheus-Dashboards/Disk Space.json create mode 100644 sql_exporter/Prometheus-Dashboards/Monitoring - Live - All Servers.json create mode 100644 sql_exporter/Prometheus-Dashboards/Monitoring - Live - Distributed.json create mode 100644 sql_exporter/Prometheus-Dashboards/Monitoring - Perfmon Counters - Quest Softwares - Distributed.json create mode 100644 sql_exporter/Prometheus-Dashboards/README.md create mode 100644 sql_exporter/Prometheus-Dashboards/SQL Agent Jobs.json create mode 100644 sql_exporter/Prometheus-Dashboards/Wait Stats.json create mode 100644 sql_exporter/Prometheus-Dashboards/XEvent - Trend.json create mode 100644 sql_exporter/Prometheus-Dashboards/_lib/build.py create mode 100644 sql_exporter/Prometheus-Dashboards/_lib/prom_dashboard.py create mode 100644 sql_exporter/Prometheus-Dashboards/_specs/ag_health_state.py create mode 100644 sql_exporter/Prometheus-Dashboards/_specs/backup_history.py create mode 100644 sql_exporter/Prometheus-Dashboards/_specs/core_metrics_trend.py create mode 100644 sql_exporter/Prometheus-Dashboards/_specs/database_file_io_stats.py create mode 100644 sql_exporter/Prometheus-Dashboards/_specs/dba_inventory.py create mode 100644 sql_exporter/Prometheus-Dashboards/_specs/disk_space.py create mode 100644 sql_exporter/Prometheus-Dashboards/_specs/monitoring_live_all_servers.py create mode 100644 sql_exporter/Prometheus-Dashboards/_specs/monitoring_live_distributed.py create mode 100644 sql_exporter/Prometheus-Dashboards/_specs/monitoring_perfmon_quest.py create mode 100644 sql_exporter/Prometheus-Dashboards/_specs/sql_agent_jobs.py create mode 100644 sql_exporter/Prometheus-Dashboards/_specs/wait_stats.py create mode 100644 sql_exporter/Prometheus-Dashboards/_specs/xevent_trend.py create mode 100644 sql_exporter/Prometheus-Dashboards/_tools/inspect_panels.py create mode 100644 sql_exporter/Prometheus-Dashboards/_tools/validate.py create mode 100644 sql_exporter/Prometheus-Dashboards/generate.py diff --git a/sql_exporter/Prometheus-Dashboards/.gitignore b/sql_exporter/Prometheus-Dashboards/.gitignore new file mode 100644 index 0000000..7a60b85 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/.gitignore @@ -0,0 +1,2 @@ +__pycache__/ +*.pyc diff --git a/sql_exporter/Prometheus-Dashboards/Ag Health State.json b/sql_exporter/Prometheus-Dashboards/Ag Health State.json new file mode 100644 index 0000000..e407f16 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/Ag Health State.json @@ -0,0 +1,781 @@ +{ + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "12.0.0" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + } + ], + "annotations": { + "list": [] + }, + "description": "", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "id": 101, + "type": "table", + "title": "LIVE - AlwaysOn Availability Group Health Metrics - [$Server]", + "description": "Latest AG replica health joined by unique_key. Sync state / health / queue sizes / rates / latency from mssql_aghealth__*.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 0, + "w": 24, + "h": 14 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__synchronization_health{instance=~\"$Server\",ag_name=~\"$ag_name\",ag_listener=~\"$ag_listener\",replica_server_name=~\"$replica_server_name\",database_name=~\"$database_name\",synchronization_state_desc=~\"$sync_state_desc\",synchronization_health_desc=~\"$sync_health_desc\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Health" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__synchronization_state{instance=~\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "State" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__is_primary_replica{instance=~\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Primary" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__is_local{instance=~\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Local" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__is_suspended{instance=~\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Suspended" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__latency_seconds{instance=~\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Latency" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__log_send_queue_size{instance=~\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "LogSendQ" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__redo_queue_size{instance=~\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "RedoQ" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__log_send_rate{instance=~\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "LogRate" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__redo_rate{instance=~\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "RedoRate" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__estimated_redo_completion_time_min{instance=~\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "RedoEtaMin" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__last_redone_time{instance=~\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "LastRedone" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__last_commit_time{instance=~\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "LastCommit" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Time": true, + "__name__": true, + "job": true, + "target": true, + "exported_job": true + }, + "renameByName": { + "replica_server_name": "Replica", + "database_name": "Database", + "ag_name": "AG", + "ag_listener": "Listener", + "synchronization_state_desc": "Sync State", + "synchronization_health_desc": "Sync Health", + "suspend_reason_desc": "Suspend Reason", + "Value #Health": "Health (code)", + "Value #State": "State (code)", + "Value #Primary": "Is Primary", + "Value #Local": "Is Local", + "Value #Suspended": "Is Suspended", + "Value #Latency": "Latency (s)", + "Value #LogSendQ": "Log Send Queue", + "Value #RedoQ": "Redo Queue", + "Value #LogRate": "Log Send Rate", + "Value #RedoRate": "Redo Rate", + "Value #RedoEtaMin": "Est. Redo (min)", + "Value #LastRedone": "Last Redone (epoch s)", + "Value #LastCommit": "Last Commit (epoch s)" + } + } + } + ], + "pluginVersion": "12.4.1" + }, + { + "id": 102, + "type": "table", + "title": "Latest - AlwaysOn Availability Groups - Status - FILTERED @ dashboard end", + "description": "SQL version anchors this at a cached collection timestamp. Prometheus serves the latest sample within the visible range instead.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 14, + "w": 24, + "h": 11 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "last_over_time(mssql_aghealth__latency_seconds{instance=~\"$Server\",ag_name=~\"$ag_name\",ag_listener=~\"$ag_listener\",replica_server_name=~\"$replica_server_name\",database_name=~\"$database_name\",synchronization_state_desc=~\"$sync_state_desc\",synchronization_health_desc=~\"$sync_health_desc\"}[$__range])", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 103, + "type": "timeseries", + "title": "Trend - AlwaysOn Latency (seconds)", + "description": "Per (replica, database) commit latency vs the primary, from mssql_aghealth__latency_seconds. -1 latency means the probe could not be evaluated.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 25, + "w": 24, + "h": 16 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__latency_seconds{instance=~\"$Server\",ag_name=~\"$ag_name\",ag_listener=~\"$ag_listener\",replica_server_name=~\"$replica_server_name\",database_name=~\"$database_name\",synchronization_state_desc=~\"$sync_state_desc\",synchronization_health_desc=~\"$sync_health_desc\"}", + "legendFormat": "{{replica_server_name}} || {{database_name}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + } + ], + "refresh": "30s", + "schemaVersion": 42, + "tags": [ + "mssql", + "sqlmonitor", + "Ag Health State", + "prometheus" + ], + "templating": { + "list": [ + { + "name": "DS_PROMETHEUS", + "type": "datasource", + "label": "Data Source", + "query": "prometheus", + "current": { + "text": "", + "value": "${DS_PROMETHEUS}", + "selected": true + }, + "refresh": 1, + "hide": 0, + "regex": "", + "skipUrlSync": false + }, + { + "name": "Server", + "type": "query", + "label": "SQL Instance", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_up, instance)", + "query": { + "qryType": 1, + "query": "label_values(mssql_up, instance)", + "refId": "PrometheusVariableQueryEditor-Server" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "ag_name", + "type": "query", + "label": "AG Name", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, ag_name)", + "query": { + "qryType": 1, + "query": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, ag_name)", + "refId": "PrometheusVariableQueryEditor-ag_name" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "ag_listener", + "type": "query", + "label": "AG Listener", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, ag_listener)", + "query": { + "qryType": 1, + "query": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, ag_listener)", + "refId": "PrometheusVariableQueryEditor-ag_listener" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "replica_server_name", + "type": "query", + "label": "Replica Server", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, replica_server_name)", + "query": { + "qryType": 1, + "query": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, replica_server_name)", + "refId": "PrometheusVariableQueryEditor-replica_server_name" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "database_name", + "type": "query", + "label": "Database", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, database_name)", + "query": { + "qryType": 1, + "query": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, database_name)", + "refId": "PrometheusVariableQueryEditor-database_name" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "sync_state_desc", + "type": "query", + "label": "Sync State", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, synchronization_state_desc)", + "query": { + "qryType": 1, + "query": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, synchronization_state_desc)", + "refId": "PrometheusVariableQueryEditor-sync_state_desc" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "sync_health_desc", + "type": "query", + "label": "Sync Health", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, synchronization_health_desc)", + "query": { + "qryType": 1, + "query": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, synchronization_health_desc)", + "refId": "PrometheusVariableQueryEditor-sync_health_desc" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "replica_type", + "type": "custom", + "label": "Replica Type", + "query": "__ALL__,Primary,Secondary,Local", + "options": [ + { + "text": "__ALL__", + "value": "__ALL__", + "selected": true + }, + { + "text": "Primary", + "value": "Primary", + "selected": false + }, + { + "text": "Secondary", + "value": "Secondary", + "selected": false + }, + { + "text": "Local", + "value": "Local", + "selected": false + } + ], + "current": { + "text": "__ALL__", + "value": "__ALL__", + "selected": true + }, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "latency_minutes", + "type": "custom", + "label": "Min Latency (min, -1=off)", + "query": "-1,0,1,5,15,30,60", + "options": [ + { + "text": "-1", + "value": "-1", + "selected": true + }, + { + "text": "0", + "value": "0", + "selected": false + }, + { + "text": "1", + "value": "1", + "selected": false + }, + { + "text": "5", + "value": "5", + "selected": false + }, + { + "text": "15", + "value": "15", + "selected": false + }, + { + "text": "30", + "value": "30", + "selected": false + }, + { + "text": "60", + "value": "60", + "selected": false + } + ], + "current": { + "text": "-1", + "value": "-1", + "selected": true + }, + "hide": 0, + "skipUrlSync": false + } + ] + }, + "time": { + "from": "now-3h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "Ag Health State", + "uid": "prom_ag_health_state", + "version": 1, + "weekStart": "" +} diff --git a/sql_exporter/Prometheus-Dashboards/Backup History.json b/sql_exporter/Prometheus-Dashboards/Backup History.json new file mode 100644 index 0000000..44596ba --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/Backup History.json @@ -0,0 +1,869 @@ +{ + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "12.0.0" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + } + ], + "annotations": { + "list": [] + }, + "description": "", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "id": 101, + "type": "stat", + "title": "Databases - Covered", + "description": "Number of databases reporting backup history.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 0, + "w": 6, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count(count by (instance, database_name) (mssql_backup__last_time_utc{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=~\"$backup_type\"}))", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 102, + "type": "stat", + "title": "Full Backups older than $full_threshold_days days", + "description": "Databases whose most recent Full (D) backup is older than the configured threshold.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 6, + "y": 0, + "w": 6, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 1 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count(mssql_backup__age_seconds{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=\"D\"} > ($full_threshold_days * 86400))", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 103, + "type": "stat", + "title": "Diff Backups older than $diff_threshold_hours hours", + "description": "Databases whose most recent Differential (I) backup is older than the configured threshold.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 12, + "y": 0, + "w": 6, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 1 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count(mssql_backup__age_seconds{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=\"I\"} > ($diff_threshold_hours * 3600))", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 104, + "type": "stat", + "title": "Log Backups older than $tlog_threshold_minutes minutes", + "description": "Databases whose most recent Log (L) backup is older than the configured threshold.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 18, + "y": 0, + "w": 6, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 1 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count(mssql_backup__age_seconds{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=\"L\"} > ($tlog_threshold_minutes * 60))", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 105, + "type": "table", + "title": "Backup History - [$Server] - [$database_name]", + "description": "Latest backup per (database, type): age / duration / size / compressed size / 24h count, joined by the backup_type label.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 4, + "w": 24, + "h": 16 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_backup__last_time_utc{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=~\"$backup_type\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "When" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_backup__age_seconds{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=~\"$backup_type\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "AgeS" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_backup__last_duration_seconds{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=~\"$backup_type\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "DurS" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_backup__last_size_bytes{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=~\"$backup_type\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Size" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_backup__last_compressed_size_bytes{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=~\"$backup_type\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "CompSize" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_backup__count_last_24h{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=~\"$backup_type\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Cnt24h" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Time": true, + "__name__": true, + "job": true, + "target": true, + "exported_job": true + }, + "renameByName": { + "instance": "Server", + "database_name": "Database", + "backup_type": "Type", + "backup_type_desc": "Type Description", + "recovery_model": "Recovery Model", + "Value #When": "Last Backup (UTC epoch)", + "Value #AgeS": "Age (s)", + "Value #DurS": "Duration (s)", + "Value #Size": "Size (bytes)", + "Value #CompSize": "Compressed (bytes)", + "Value #Cnt24h": "Count (24h)" + } + } + } + ], + "pluginVersion": "12.4.1" + }, + { + "id": 106, + "type": "timeseries", + "title": "Backup Size Trend - [$Server] - [$database_name]", + "description": "Per-(database, backup_type) backup size over time.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 20, + "w": 24, + "h": 12 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "bytes", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_backup__last_size_bytes{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=~\"$backup_type\"}", + "legendFormat": "{{database_name}} / {{backup_type}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + } + ], + "refresh": "30s", + "schemaVersion": 42, + "tags": [ + "mssql", + "sqlmonitor", + "Backup", + "prometheus" + ], + "templating": { + "list": [ + { + "name": "DS_PROMETHEUS", + "type": "datasource", + "label": "Data Source", + "query": "prometheus", + "current": { + "text": "", + "value": "${DS_PROMETHEUS}", + "selected": true + }, + "refresh": 1, + "hide": 0, + "regex": "", + "skipUrlSync": false + }, + { + "name": "Server", + "type": "query", + "label": "SQL Instance", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_up, instance)", + "query": { + "qryType": 1, + "query": "label_values(mssql_up, instance)", + "refId": "PrometheusVariableQueryEditor-Server" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "database_name", + "type": "query", + "label": "Database", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_backup__last_time_utc{instance=~\"$Server\"}, database_name)", + "query": { + "qryType": 1, + "query": "label_values(mssql_backup__last_time_utc{instance=~\"$Server\"}, database_name)", + "refId": "PrometheusVariableQueryEditor-database_name" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "backup_type", + "type": "custom", + "label": "Backup Type (D=Full, I=Diff, L=Log)", + "query": "__ALL__,D,I,L,F,G,P,Q", + "options": [ + { + "text": "__ALL__", + "value": "__ALL__", + "selected": true + }, + { + "text": "D", + "value": "D", + "selected": false + }, + { + "text": "I", + "value": "I", + "selected": false + }, + { + "text": "L", + "value": "L", + "selected": false + }, + { + "text": "F", + "value": "F", + "selected": false + }, + { + "text": "G", + "value": "G", + "selected": false + }, + { + "text": "P", + "value": "P", + "selected": false + }, + { + "text": "Q", + "value": "Q", + "selected": false + } + ], + "current": { + "text": "__ALL__", + "value": "__ALL__", + "selected": true + }, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "full_threshold_days", + "type": "custom", + "label": "Full age warn (days)", + "query": "1,2,3,7,14,30", + "options": [ + { + "text": "1", + "value": "1", + "selected": false + }, + { + "text": "2", + "value": "2", + "selected": false + }, + { + "text": "3", + "value": "3", + "selected": false + }, + { + "text": "7", + "value": "7", + "selected": true + }, + { + "text": "14", + "value": "14", + "selected": false + }, + { + "text": "30", + "value": "30", + "selected": false + } + ], + "current": { + "text": "7", + "value": "7", + "selected": true + }, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "diff_threshold_hours", + "type": "custom", + "label": "Diff age warn (hours)", + "query": "4,8,12,24,48", + "options": [ + { + "text": "4", + "value": "4", + "selected": false + }, + { + "text": "8", + "value": "8", + "selected": false + }, + { + "text": "12", + "value": "12", + "selected": false + }, + { + "text": "24", + "value": "24", + "selected": true + }, + { + "text": "48", + "value": "48", + "selected": false + } + ], + "current": { + "text": "24", + "value": "24", + "selected": true + }, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "tlog_threshold_minutes", + "type": "custom", + "label": "Log age warn (minutes)", + "query": "5,15,30,60,120,240", + "options": [ + { + "text": "5", + "value": "5", + "selected": false + }, + { + "text": "15", + "value": "15", + "selected": false + }, + { + "text": "30", + "value": "30", + "selected": true + }, + { + "text": "60", + "value": "60", + "selected": false + }, + { + "text": "120", + "value": "120", + "selected": false + }, + { + "text": "240", + "value": "240", + "selected": false + } + ], + "current": { + "text": "30", + "value": "30", + "selected": true + }, + "hide": 0, + "skipUrlSync": false + } + ] + }, + "time": { + "from": "now-3h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "Backup History", + "uid": "prom_backup_history", + "version": 1, + "weekStart": "" +} diff --git a/sql_exporter/Prometheus-Dashboards/Core Metrics - Trend.json b/sql_exporter/Prometheus-Dashboards/Core Metrics - Trend.json new file mode 100644 index 0000000..6800e33 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/Core Metrics - Trend.json @@ -0,0 +1,1312 @@ +{ + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "12.0.0" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + } + ], + "annotations": { + "list": [] + }, + "description": "", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "id": 101, + "type": "timeseries", + "title": "Core Metrics - ${trend_by} TREND - Database IO Latency - Server ___[${Server}]___", + "description": "Per-database read/write latency in ms/IO. Aggregated at the $trend_by window using $percentile quantile_over_time.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 0, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "ms", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "quantile_over_time($percentile_q, (avg by (instance, database_name) (rate(mssql_virtualfilestats__io_stall_read_ms{instance=~\"$Server\"}[$__rate_interval]) / clamp_min(rate(mssql_virtualfilestats__num_of_reads{instance=~\"$Server\"}[$__rate_interval]), 1)))[$trend_window:])", + "legendFormat": "{{instance}} - {{database_name}} - read", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "quantile_over_time($percentile_q, (avg by (instance, database_name) (rate(mssql_virtualfilestats__io_stall_write_ms{instance=~\"$Server\"}[$__rate_interval]) / clamp_min(rate(mssql_virtualfilestats__num_of_writes{instance=~\"$Server\"}[$__rate_interval]), 1)))[$trend_window:])", + "legendFormat": "{{instance}} - {{database_name}} - write", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 102, + "type": "timeseries", + "title": "Core Metrics - ${trend_by} TREND - Database IO - Server ___[${Server}]___", + "description": "Per-database throughput in MB/s at the $trend_by window.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 8, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "MBs", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "quantile_over_time($percentile_q, (sum by (instance, database_name) (rate(mssql_virtualfilestats__num_of_bytes_read{instance=~\"$Server\"}[$__rate_interval])) / (1024*1024))[$trend_window:])", + "legendFormat": "{{instance}} - {{database_name}} - read", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "quantile_over_time($percentile_q, (sum by (instance, database_name) (rate(mssql_virtualfilestats__num_of_bytes_written{instance=~\"$Server\"}[$__rate_interval])) / (1024*1024))[$trend_window:])", + "legendFormat": "{{instance}} - {{database_name}} - write", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 103, + "type": "timeseries", + "title": "Core Metrics - ${trend_by} TREND - Database IOPS - Server ___[${Server}]___", + "description": "Per-database reads/writes per second at the $trend_by window.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 16, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "iops", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "quantile_over_time($percentile_q, (sum by (instance, database_name) (rate(mssql_virtualfilestats__num_of_reads{instance=~\"$Server\"}[$__rate_interval])))[$trend_window:])", + "legendFormat": "{{instance}} - {{database_name}} - reads", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "quantile_over_time($percentile_q, (sum by (instance, database_name) (rate(mssql_virtualfilestats__num_of_writes{instance=~\"$Server\"}[$__rate_interval])))[$trend_window:])", + "legendFormat": "{{instance}} - {{database_name}} - writes", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 104, + "type": "timeseries", + "title": "Core Metrics - ${trend_by} TREND - OS CPU - Max ${max_servers} Servers", + "description": "OS CPU % per server, top-N by $percentile at $trend_by window.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 24, + "w": 12, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "percent", + "min": 0, + "max": 100, + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk($max_servers, quantile_over_time($percentile_q, (100 - (avg by (instance) (rate(windows_cpu_time_total{mode=\"idle\",instance=~\"$Server\"}[$__rate_interval])) * 100))[$trend_window:]))", + "legendFormat": "{{instance}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 105, + "type": "timeseries", + "title": "Core Metrics - ${trend_by} TREND - SQL CPU - Max ${max_servers} Servers", + "description": "SQL CPU % per server, top-N by $percentile at $trend_by window.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 12, + "y": 24, + "w": 12, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "percent", + "min": 0, + "max": 100, + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk($max_servers, quantile_over_time($percentile_q, (avg by (instance) (mssql_cpu_utilization_percentage{instance=~\"$Server\"}))[$trend_window:]))", + "legendFormat": "{{instance}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 106, + "type": "timeseries", + "title": "Core Metrics - ${trend_by} TREND - Disk Latency - Max ${max_servers} Servers", + "description": "OS-level disk latency (s/IO) per volume. top-N by $percentile.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 32, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk($max_servers, quantile_over_time($percentile_q, (avg by (instance, volume) (rate(windows_logical_disk_read_latency_seconds_total{instance=~\"$Server\"}[$__rate_interval]) / clamp_min(rate(windows_logical_disk_reads_total{instance=~\"$Server\"}[$__rate_interval]), 1)))[$trend_window:]))", + "legendFormat": "{{instance}} {{volume}} read", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk($max_servers, quantile_over_time($percentile_q, (avg by (instance, volume) (rate(windows_logical_disk_write_latency_seconds_total{instance=~\"$Server\"}[$__rate_interval]) / clamp_min(rate(windows_logical_disk_writes_total{instance=~\"$Server\"}[$__rate_interval]), 1)))[$trend_window:]))", + "legendFormat": "{{instance}} {{volume}} write", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 107, + "type": "timeseries", + "title": "Core Metrics - ${trend_by} TREND - Requests - Max ${max_servers} Servers", + "description": "Batch requests/sec per server, top-N by $percentile.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 40, + "w": 12, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "reqps", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk($max_servers, quantile_over_time($percentile_q, (sum by (instance) (rate(mssql_batch_requests{instance=~\"$Server\"}[$__rate_interval])))[$trend_window:]))", + "legendFormat": "{{instance}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 108, + "type": "timeseries", + "title": "Core Metrics - ${trend_by} TREND - Available Memory - Max ${max_servers} Servers", + "description": "OS available memory per server, bottom-N (smallest) at $percentile quantile over $trend_by window.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 12, + "y": 40, + "w": 12, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "bytes", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "bottomk($max_servers, quantile_over_time($percentile_q, (avg by (instance) (windows_memory_available_bytes{instance=~\"$Server\"}))[$trend_window:]))", + "legendFormat": "{{instance}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 109, + "type": "timeseries", + "title": "Core Metrics - ${trend_by} TREND - Connections - Max ${max_servers} Servers", + "description": "SQL connection count per server, top-N by $percentile.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 48, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk($max_servers, quantile_over_time($percentile_q, (sum by (instance) (mssql_connections{instance=~\"$Server\"}))[$trend_window:]))", + "legendFormat": "{{instance}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + } + ], + "refresh": "30s", + "schemaVersion": 42, + "tags": [ + "mssql", + "sqlmonitor", + "core-metrics", + "prometheus" + ], + "templating": { + "list": [ + { + "name": "DS_PROMETHEUS", + "type": "datasource", + "label": "Data Source", + "query": "prometheus", + "current": { + "text": "", + "value": "${DS_PROMETHEUS}", + "selected": true + }, + "refresh": 1, + "hide": 0, + "regex": "", + "skipUrlSync": false + }, + { + "name": "Server", + "type": "query", + "label": "SQL Instance", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_up, instance)", + "query": { + "qryType": 1, + "query": "label_values(mssql_up, instance)", + "refId": "PrometheusVariableQueryEditor-Server" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "trend_by", + "type": "custom", + "label": "Trend By", + "query": "Hourly,Daily", + "options": [ + { + "text": "Hourly", + "value": "Hourly", + "selected": true + }, + { + "text": "Daily", + "value": "Daily", + "selected": false + } + ], + "current": { + "text": "Hourly", + "value": "Hourly", + "selected": true + }, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "trend_window", + "type": "custom", + "label": "Trend Window", + "query": "1h,1d", + "options": [ + { + "text": "1h", + "value": "1h", + "selected": true + }, + { + "text": "1d", + "value": "1d", + "selected": false + } + ], + "current": { + "text": "1h", + "value": "1h", + "selected": true + }, + "hide": 2, + "skipUrlSync": false + }, + { + "name": "percentile", + "type": "custom", + "label": "Percentile", + "query": "p50,p75,p95,p99,max", + "options": [ + { + "text": "p50", + "value": "p50", + "selected": false + }, + { + "text": "p75", + "value": "p75", + "selected": false + }, + { + "text": "p95", + "value": "p95", + "selected": true + }, + { + "text": "p99", + "value": "p99", + "selected": false + }, + { + "text": "max", + "value": "max", + "selected": false + } + ], + "current": { + "text": "p95", + "value": "p95", + "selected": true + }, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "percentile_q", + "type": "custom", + "label": "Percentile Q", + "query": "0.5,0.75,0.95,0.99,1.0", + "options": [ + { + "text": "0.5", + "value": "0.5", + "selected": false + }, + { + "text": "0.75", + "value": "0.75", + "selected": false + }, + { + "text": "0.95", + "value": "0.95", + "selected": true + }, + { + "text": "0.99", + "value": "0.99", + "selected": false + }, + { + "text": "1.0", + "value": "1.0", + "selected": false + } + ], + "current": { + "text": "0.95", + "value": "0.95", + "selected": true + }, + "hide": 2, + "skipUrlSync": false + }, + { + "name": "hour_of_day", + "type": "custom", + "label": "Hour of Day (-1 = any)", + "query": "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,-1", + "options": [ + { + "text": "0", + "value": "0", + "selected": false + }, + { + "text": "1", + "value": "1", + "selected": false + }, + { + "text": "2", + "value": "2", + "selected": false + }, + { + "text": "3", + "value": "3", + "selected": false + }, + { + "text": "4", + "value": "4", + "selected": false + }, + { + "text": "5", + "value": "5", + "selected": false + }, + { + "text": "6", + "value": "6", + "selected": false + }, + { + "text": "7", + "value": "7", + "selected": false + }, + { + "text": "8", + "value": "8", + "selected": false + }, + { + "text": "9", + "value": "9", + "selected": false + }, + { + "text": "10", + "value": "10", + "selected": false + }, + { + "text": "11", + "value": "11", + "selected": false + }, + { + "text": "12", + "value": "12", + "selected": false + }, + { + "text": "13", + "value": "13", + "selected": false + }, + { + "text": "14", + "value": "14", + "selected": false + }, + { + "text": "15", + "value": "15", + "selected": false + }, + { + "text": "16", + "value": "16", + "selected": false + }, + { + "text": "17", + "value": "17", + "selected": false + }, + { + "text": "18", + "value": "18", + "selected": false + }, + { + "text": "19", + "value": "19", + "selected": false + }, + { + "text": "20", + "value": "20", + "selected": false + }, + { + "text": "21", + "value": "21", + "selected": false + }, + { + "text": "22", + "value": "22", + "selected": false + }, + { + "text": "23", + "value": "23", + "selected": false + }, + { + "text": "-1", + "value": "-1", + "selected": true + } + ], + "current": { + "text": "-1", + "value": "-1", + "selected": true + }, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "max_servers", + "type": "constant", + "label": "Max Servers", + "query": "10", + "current": { + "text": "10", + "value": "10", + "selected": false + }, + "hide": 2, + "skipUrlSync": false + } + ] + }, + "time": { + "from": "now-3h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "Core Metrics - Trend", + "uid": "prom_core_metrics_trend", + "version": 1, + "weekStart": "" +} diff --git a/sql_exporter/Prometheus-Dashboards/DBA Inventory.json b/sql_exporter/Prometheus-Dashboards/DBA Inventory.json new file mode 100644 index 0000000..e254006 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/DBA Inventory.json @@ -0,0 +1,930 @@ +{ + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "12.0.0" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + } + ], + "annotations": { + "list": [] + }, + "description": "", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "id": 101, + "type": "stat", + "title": "SQL Instances - Online", + "description": "Count of SQL Server targets currently scraping successfully (mssql_up == 1).", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 0, + "w": 6, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "green", + "value": 1 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum(mssql_up == 1)", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 102, + "type": "stat", + "title": "SQL Instances - Offline", + "description": "Count of SQL Server targets with mssql_up == 0.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 6, + "y": 0, + "w": 6, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 1 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum(mssql_up == 0)", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 103, + "type": "stat", + "title": "Availability Groups", + "description": "Distinct AG names observed across scrape targets.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 12, + "y": 0, + "w": 6, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count(count by (ag_name) (mssql_aghealth__synchronization_health))", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 104, + "type": "stat", + "title": "Hosts", + "description": "Distinct hostnames observed via mssql_service_info.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 18, + "y": 0, + "w": 6, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count(count by (host_name) (mssql_service_info))", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 105, + "type": "table", + "title": "SQL Servers - Combined Info - FILTERED", + "description": "Per-instance combined info from mssql_service_info (host/service/product) and mssql_up for online state.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 4, + "w": 24, + "h": 9 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_service_info{instance=~\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Info" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_up{instance=~\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Up" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Time": true, + "__name__": true, + "job": true, + "target": true, + "exported_job": true + }, + "renameByName": { + "instance": "Server", + "host_name": "Host", + "product_version": "Version", + "service_name": "Service", + "Value #Info": "Info", + "Value #Up": "Up?" + } + } + } + ], + "pluginVersion": "12.4.1" + }, + { + "id": 106, + "type": "text", + "title": "SQLMonitor - Instance Details - FILTERED", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ Inventory-DB columns (alias, linked-server-name, major/minor version breakdown) are not exposed to Prometheus. Use the SQL dashboard for the full detail row.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 13, + "w": 24, + "h": 7 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ Inventory-DB columns (alias, linked-server-name, major/minor version breakdown) are not exposed to Prometheus. Use the SQL dashboard for the full detail row." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 107, + "type": "text", + "title": "All Servers - Basic Info", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ dbo.vw_all_servers_basic_info (SMA agents, OS hosts, service accounts) is not mirrored in Prometheus.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 20, + "w": 24, + "h": 7 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ dbo.vw_all_servers_basic_info (SMA agents, OS hosts, service accounts) is not mirrored in Prometheus." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 108, + "type": "text", + "title": "SQL Servers - Extended Info", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ SKU / license / feature matrix \u2014 inventory table.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 27, + "w": 24, + "h": 7 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ SKU / license / feature matrix \u2014 inventory table." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 109, + "type": "text", + "title": "SQL Server Hosts", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ Host-level inventory (IP/FQDN/domain) is only in the SQLMonitor inventory DB.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 34, + "w": 24, + "h": 7 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ Host-level inventory (IP/FQDN/domain) is only in the SQLMonitor inventory DB." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 110, + "type": "table", + "title": "SQL Server Availability Groups - Online", + "description": "Per-AG replica count and distinct databases, derived from mssql_aghealth__synchronization_health labels.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 41, + "w": 24, + "h": 9 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count by (ag_name, ag_listener) (mssql_aghealth__synchronization_health{instance=~\"$Server\"})", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Replicas" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count by (ag_name, database_name) (mssql_aghealth__synchronization_health{instance=~\"$Server\"})", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Dbs" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + } + ], + "pluginVersion": "12.4.1" + }, + { + "id": 111, + "type": "text", + "title": "SQL Clusters", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ WSFC node / resource-group ownership is inventory-only.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 50, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ WSFC node / resource-group ownership is inventory-only." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 112, + "type": "text", + "title": "SQL Servers - Login Expiry", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ Login-expiry warnings come from the security-collection SQL Agent job and are stored in the inventory DB.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 58, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ Login-expiry warnings come from the security-collection SQL Agent job and are stored in the inventory DB." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 113, + "type": "text", + "title": "Login Email Mapping", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ dbo.login_email_mapping is an inventory-only lookup table.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 66, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ dbo.login_email_mapping is an inventory-only lookup table." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 114, + "type": "text", + "title": "Config Changes", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ LAMA (Look-At-My-Analysis) config-change deltas come from dbo.lama_computed_metrics \u2014 not exposed to Prometheus.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 74, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ LAMA (Look-At-My-Analysis) config-change deltas come from dbo.lama_computed_metrics \u2014 not exposed to Prometheus." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + } + ], + "refresh": "30s", + "schemaVersion": 42, + "tags": [ + "mssql", + "sqlmonitor", + "Inventory", + "prometheus" + ], + "templating": { + "list": [ + { + "name": "DS_PROMETHEUS", + "type": "datasource", + "label": "Data Source", + "query": "prometheus", + "current": { + "text": "", + "value": "${DS_PROMETHEUS}", + "selected": true + }, + "refresh": 1, + "hide": 0, + "regex": "", + "skipUrlSync": false + }, + { + "name": "Server", + "type": "query", + "label": "SQL Instance", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_up, instance)", + "query": { + "qryType": 1, + "query": "label_values(mssql_up, instance)", + "refId": "PrometheusVariableQueryEditor-Server" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + } + ] + }, + "time": { + "from": "now-3h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "DBA Inventory", + "uid": "prom_dba_inventory", + "version": 1, + "weekStart": "" +} diff --git a/sql_exporter/Prometheus-Dashboards/Database File IO Stats.json b/sql_exporter/Prometheus-Dashboards/Database File IO Stats.json new file mode 100644 index 0000000..0a17a8f --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/Database File IO Stats.json @@ -0,0 +1,1460 @@ +{ + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "12.0.0" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + } + ], + "annotations": { + "list": [] + }, + "description": "", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "id": 101, + "type": "table", + "title": "File IO Stats ___ Since Startup", + "description": "Per-file counters since SQL Server start, straight off mssql_virtualfilestats__*: bytes read/written, IO counts and cumulative stall time (ms).", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 0, + "w": 24, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "BR" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "BW" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_virtualfilestats__num_of_reads{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "NR" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_virtualfilestats__num_of_writes{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "NW" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_virtualfilestats__io_stall_read_ms{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "SR" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_virtualfilestats__io_stall_write_ms{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "SW" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Time": true, + "__name__": true, + "job": true, + "target": true, + "exported_job": true + }, + "renameByName": { + "database_name": "Database", + "file_logical_name": "File", + "disk_volume": "Volume", + "Value #BR": "Bytes Read", + "Value #BW": "Bytes Written", + "Value #NR": "# Reads", + "Value #NW": "# Writes", + "Value #SR": "Stall Read (ms)", + "Value #SW": "Stall Write (ms)" + } + } + } + ], + "pluginVersion": "12.4.1" + }, + { + "id": 102, + "type": "table", + "title": "File IO Stats ___ Since Startup till ${__from:date:YYYY-MM-DD HH.mm}", + "description": "Counter values at the dashboard's `from` time \u2014 accumulated IO from SQL startup until the start of the visible range.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 10, + "w": 24, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"} @ end() offset ($__to - $__from)", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 103, + "type": "table", + "title": "File IO Stats ___ In Selected Time Duration ___${__from:date:YYYY-MM-DD HH.mm} \u2192 ${__to:date:YYYY-MM-DD HH.mm}", + "description": "Delta of each virtualfilestats counter over the dashboard's visible range (increase()).", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 20, + "w": 24, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "increase(mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range])", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "BR" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "increase(mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range])", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "BW" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "increase(mssql_virtualfilestats__num_of_reads{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range])", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "NR" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "increase(mssql_virtualfilestats__num_of_writes{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range])", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "NW" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "increase(mssql_virtualfilestats__io_stall_read_ms{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range])", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "SR" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "increase(mssql_virtualfilestats__io_stall_write_ms{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range])", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "SW" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Time": true, + "__name__": true, + "job": true, + "target": true, + "exported_job": true + } + } + } + ], + "pluginVersion": "12.4.1" + }, + { + "id": 104, + "type": "timeseries", + "title": "[${Server}] - Db File IO Stats - Read/Writes Data", + "description": "Per-file bytes-read and bytes-written rates (bytes/sec), derived from the two underlying counters.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 30, + "w": 24, + "h": 12 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "Bps", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__rate_interval])", + "legendFormat": "read \u2022 {{database_name}} / {{file_logical_name}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "Reads" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__rate_interval])", + "legendFormat": "write \u2022 {{database_name}} / {{file_logical_name}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "Writes" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 105, + "type": "timeseries", + "title": "[${Server}] - Db File IO Stats - # Read/Writes", + "description": "Per-file IO operations per second (reads + writes), derived from the operation counters.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 42, + "w": 24, + "h": 12 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "ops", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_virtualfilestats__num_of_reads{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__rate_interval])", + "legendFormat": "reads/s \u2022 {{database_name}} / {{file_logical_name}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "Reads" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_virtualfilestats__num_of_writes{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__rate_interval])", + "legendFormat": "writes/s \u2022 {{database_name}} / {{file_logical_name}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "Writes" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 106, + "type": "timeseries", + "title": "[${Server}] - Db IO Stats - Read/Writes Data", + "description": "Aggregated per-database read/write throughput (Bps), summed across files.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 54, + "w": 24, + "h": 12 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "Bps", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum by (database_name) (rate(mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__rate_interval]))", + "legendFormat": "read \u2022 {{database_name}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "R" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum by (database_name) (rate(mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__rate_interval]))", + "legendFormat": "write \u2022 {{database_name}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "W" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 107, + "type": "table", + "title": "Database IO Stats ___ Since Startup", + "description": "Per-database aggregates of the filestats counters from SQL Server startup.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 66, + "w": 24, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum by (instance, database_name) (mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"})", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "BR" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum by (instance, database_name) (mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"})", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "BW" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum by (instance, database_name) (mssql_virtualfilestats__io_stall_read_ms{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"})", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "SR" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum by (instance, database_name) (mssql_virtualfilestats__io_stall_write_ms{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"})", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "SW" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + } + ], + "pluginVersion": "12.4.1" + }, + { + "id": 108, + "type": "table", + "title": "Database IO Stats ___ In Selected Time Duration", + "description": "Per-database delta over the dashboard range.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 76, + "w": 24, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum by (instance, database_name) (increase(mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range]))", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "BR" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum by (instance, database_name) (increase(mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range]))", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "BW" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + } + ], + "pluginVersion": "12.4.1" + }, + { + "id": 109, + "type": "table", + "title": "Database IO Stats ___ Prior Window ___ DAY(+/-)", + "description": "Same aggregate delta as above but over the time window immediately *before* the dashboard range. Use side-by-side with the previous panel for day-over-day comparison.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 86, + "w": 24, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum by (instance, database_name) (increase(mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range] @ end() offset $__range))", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "BR" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum by (instance, database_name) (increase(mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range] @ end() offset $__range))", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "BW" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + } + ], + "pluginVersion": "12.4.1" + }, + { + "id": 110, + "type": "table", + "title": "Disk IO Stats ___ Since Startup", + "description": "Per-volume aggregates of the filestats counters.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 96, + "w": 24, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum by (instance, disk_volume) (mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"})", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "BR" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum by (instance, disk_volume) (mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"})", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "BW" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + } + ], + "pluginVersion": "12.4.1" + }, + { + "id": 111, + "type": "table", + "title": "Disk IO Stats ___ In Selected Time Duration", + "description": "Per-volume delta over the dashboard range.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 106, + "w": 24, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum by (instance, disk_volume) (increase(mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range]))", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "BR" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum by (instance, disk_volume) (increase(mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range]))", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "BW" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + } + ], + "pluginVersion": "12.4.1" + }, + { + "id": 112, + "type": "table", + "title": "Disk IO Stats ___ Prior Window", + "description": "Per-volume delta over the window immediately before the dashboard range.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 116, + "w": 24, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum by (instance, disk_volume) (increase(mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range] @ end() offset $__range))", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "BR" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum by (instance, disk_volume) (increase(mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range] @ end() offset $__range))", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "BW" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + } + ], + "pluginVersion": "12.4.1" + } + ], + "refresh": "30s", + "schemaVersion": 42, + "tags": [ + "mssql", + "sqlmonitor", + "IO Stats", + "prometheus" + ], + "templating": { + "list": [ + { + "name": "DS_PROMETHEUS", + "type": "datasource", + "label": "Data Source", + "query": "prometheus", + "current": { + "text": "", + "value": "${DS_PROMETHEUS}", + "selected": true + }, + "refresh": 1, + "hide": 0, + "regex": "", + "skipUrlSync": false + }, + { + "name": "Server", + "type": "query", + "label": "SQL Instance", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_up, instance)", + "query": { + "qryType": 1, + "query": "label_values(mssql_up, instance)", + "refId": "PrometheusVariableQueryEditor-Server" + }, + "refresh": 1, + "sort": 1, + "multi": false, + "includeAll": false, + "allValue": null, + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "database", + "type": "query", + "label": "Database", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_virtualfilestats__num_of_reads{instance=\"$Server\"}, database_name)", + "query": { + "qryType": 1, + "query": "label_values(mssql_virtualfilestats__num_of_reads{instance=\"$Server\"}, database_name)", + "refId": "PrometheusVariableQueryEditor-database" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "disk_drive", + "type": "query", + "label": "Disk", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_virtualfilestats__num_of_reads{instance=\"$Server\"}, disk_volume)", + "query": { + "qryType": 1, + "query": "label_values(mssql_virtualfilestats__num_of_reads{instance=\"$Server\"}, disk_volume)", + "refId": "PrometheusVariableQueryEditor-disk_drive" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "top_n", + "type": "constant", + "label": "Top N Rows", + "query": "25", + "current": { + "text": "25", + "value": "25", + "selected": false + }, + "hide": 2, + "skipUrlSync": false + } + ] + }, + "time": { + "from": "now-3h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "Database File IO Stats", + "uid": "prom_database_file_io_stats", + "version": 1, + "weekStart": "" +} diff --git a/sql_exporter/Prometheus-Dashboards/Disk Space.json b/sql_exporter/Prometheus-Dashboards/Disk Space.json new file mode 100644 index 0000000..5665ad7 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/Disk Space.json @@ -0,0 +1,673 @@ +{ + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "12.0.0" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + } + ], + "annotations": { + "list": [] + }, + "description": "", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "id": 101, + "type": "table", + "title": "Disk Space - [$Server] - [$perfmon_host_name]", + "description": "Current capacity / free / used / % used per volume from windows_exporter. Uses logical_disk metrics.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 0, + "w": 24, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "bytes", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_logical_disk_size_bytes{instance=\"$Server\"}", + "legendFormat": "{{volume}}", + "range": false, + "instant": true, + "format": "table", + "refId": "Size" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_logical_disk_free_bytes{instance=\"$Server\"}", + "legendFormat": "{{volume}}", + "range": false, + "instant": true, + "format": "table", + "refId": "Free" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_logical_disk_size_bytes{instance=\"$Server\"} - windows_logical_disk_free_bytes{instance=\"$Server\"}", + "legendFormat": "{{volume}}", + "range": false, + "instant": true, + "format": "table", + "refId": "Used" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "100 * (windows_logical_disk_size_bytes{instance=\"$Server\"} - windows_logical_disk_free_bytes{instance=\"$Server\"}) / clamp_min(windows_logical_disk_size_bytes{instance=\"$Server\"}, 1)", + "legendFormat": "{{volume}}", + "range": false, + "instant": true, + "format": "table", + "refId": "PctUsed" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Time": true, + "__name__": true, + "job": true, + "target": true + }, + "renameByName": { + "volume": "Volume", + "instance": "Host", + "Value #Size": "Size (bytes)", + "Value #Free": "Free (bytes)", + "Value #Used": "Used (bytes)", + "Value #PctUsed": "% Used" + } + } + } + ], + "pluginVersion": "12.4.1" + }, + { + "id": 102, + "type": "timeseries", + "title": "Used Disk Space - [$Server] - [$perfmon_host_name]", + "description": "Used bytes per logical volume over time.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 10, + "w": 24, + "h": 12 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "bytes", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_logical_disk_size_bytes{instance=\"$Server\"} - windows_logical_disk_free_bytes{instance=\"$Server\"}", + "legendFormat": "{{volume}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 103, + "type": "timeseries", + "title": "% Used Disk Space - [$Server] - [$perfmon_host_name]", + "description": "Percent used per logical volume over time.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 22, + "w": 24, + "h": 12 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "percent", + "min": 0, + "max": 100, + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "100 * (windows_logical_disk_size_bytes{instance=\"$Server\"} - windows_logical_disk_free_bytes{instance=\"$Server\"}) / clamp_min(windows_logical_disk_size_bytes{instance=\"$Server\"}, 1)", + "legendFormat": "{{volume}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 104, + "type": "table", + "title": "Db File Space Usage - [$Server] - [$perfmon_host_name]", + "description": "Per database file: allocated size, size on disk, and computed free space. From mssql_virtualfilestats__* and mssql_database_file_size_bytes.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 34, + "w": 24, + "h": 16 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "bytes", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_database_file_size_bytes{instance=\"$Server\"}", + "legendFormat": "{{database}}/{{file_id}}", + "range": false, + "instant": true, + "format": "table", + "refId": "Size" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_virtualfilestats__size_on_disk_bytes{instance=\"$Server\"}", + "legendFormat": "{{database_name}}/{{file_logical_name}}", + "range": false, + "instant": true, + "format": "table", + "refId": "OnDisk" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Time": true, + "__name__": true, + "job": true, + "target": true + }, + "renameByName": { + "database_name": "Database", + "file_logical_name": "Logical Name", + "file_location": "Physical Name", + "disk_volume": "Volume", + "Value #Size": "Allocated (bytes)", + "Value #OnDisk": "Size on Disk (bytes)" + } + } + } + ], + "pluginVersion": "12.4.1" + }, + { + "id": 105, + "type": "timeseries", + "title": "Db File Size - Trend - [$Server] - [$perfmon_host_name]", + "description": "Per database file size_on_disk over time.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 50, + "w": 24, + "h": 16 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "bytes", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_virtualfilestats__size_on_disk_bytes{instance=\"$Server\"}", + "legendFormat": "{{database_name}} / {{file_logical_name}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + } + ], + "refresh": "30s", + "schemaVersion": 42, + "tags": [ + "mssql", + "sqlmonitor", + "Disk Space", + "prometheus" + ], + "templating": { + "list": [ + { + "name": "DS_PROMETHEUS", + "type": "datasource", + "label": "Data Source", + "query": "prometheus", + "current": { + "text": "", + "value": "${DS_PROMETHEUS}", + "selected": true + }, + "refresh": 1, + "hide": 0, + "regex": "", + "skipUrlSync": false + }, + { + "name": "Server", + "type": "query", + "label": "SQL Instance", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_up, instance)", + "query": { + "qryType": 1, + "query": "label_values(mssql_up, instance)", + "refId": "PrometheusVariableQueryEditor-Server" + }, + "refresh": 1, + "sort": 1, + "multi": false, + "includeAll": false, + "allValue": null, + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "perfmon_host_name", + "type": "query", + "label": "Perfmon Host Name", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_service_info{instance=\"$Server\"}, host_name)", + "query": { + "qryType": 1, + "query": "label_values(mssql_service_info{instance=\"$Server\"}, host_name)", + "refId": "PrometheusVariableQueryEditor-perfmon_host_name" + }, + "refresh": 1, + "sort": 1, + "multi": false, + "includeAll": false, + "allValue": null, + "regex": "", + "current": {}, + "hide": 2, + "skipUrlSync": false + } + ] + }, + "time": { + "from": "now-3h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "Disk Space", + "uid": "prom_disk_space", + "version": 1, + "weekStart": "" +} diff --git a/sql_exporter/Prometheus-Dashboards/Monitoring - Live - All Servers.json b/sql_exporter/Prometheus-Dashboards/Monitoring - Live - All Servers.json new file mode 100644 index 0000000..8db8159 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/Monitoring - Live - All Servers.json @@ -0,0 +1,1573 @@ +{ + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "12.0.0" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + } + ], + "annotations": { + "list": [] + }, + "description": "", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "id": 101, + "type": "stat", + "title": "Basic Info - Online", + "description": "Instances with mssql_up==1 matching the filter.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 0, + "w": 4, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum(mssql_up{instance=~\"$Server\"} == 1)", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 102, + "type": "stat", + "title": "OFFLINE Instances", + "description": "mssql_up==0.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 4, + "y": 0, + "w": 4, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 1 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum(mssql_up{instance=~\"$Server\"} == 0)", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 103, + "type": "stat", + "title": "Disks - CRITICAL", + "description": "Logical disks with >$disk_critical_pct% used, via windows_logical_disk metrics.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 8, + "y": 0, + "w": 4, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 1 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count(100 * (1 - windows_logical_disk_free_bytes{instance=~\"$Server\"} / clamp_min(windows_logical_disk_size_bytes{instance=~\"$Server\"}, 1)) > $disk_critical_pct)", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 104, + "type": "stat", + "title": "Disks - WARNING", + "description": "Logical disks between warning and critical thresholds.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 12, + "y": 0, + "w": 4, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "orange", + "value": 1 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count(100 * (1 - windows_logical_disk_free_bytes{instance=~\"$Server\"} / clamp_min(windows_logical_disk_size_bytes{instance=~\"$Server\"}, 1)) > $disk_warning_pct < $disk_critical_pct)", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 105, + "type": "stat", + "title": "Failed Jobs", + "description": "Jobs whose most recent completed run failed (requires the mssql_sqlagent_jobs collector).", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 16, + "y": 0, + "w": 4, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 1 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count(mssql_sqlagent_job__last_run_outcome{instance=~\"$Server\"} == 0)", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 106, + "type": "stat", + "title": "Full Backups Overdue", + "description": "Databases with a Full backup older than $full_threshold_days days.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 20, + "y": 0, + "w": 4, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 1 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count(mssql_backup__age_seconds{instance=~\"$Server\",backup_type=\"D\"} > ($full_threshold_days * 86400))", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 107, + "type": "table", + "title": "All Servers - Basic Details", + "description": "Per-instance mssql_service_info joined with mssql_up.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 4, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_service_info{instance=~\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Info" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_up{instance=~\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Up" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + } + ], + "pluginVersion": "12.4.1" + }, + { + "id": 108, + "type": "table", + "title": "Servers with Data Collection Issues", + "description": "Instances whose last successful scrape is more than 5 minutes old, based on scrape_samples_scraped and the `up` metric.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 12, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "(time() - timestamp(up{instance=~\"$Server\"} == 1)) > 300", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 109, + "type": "table", + "title": "CRITICAL - OFFLINE Instances", + "description": "Instances currently reporting mssql_up==0.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 20, + "w": 12, + "h": 6 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_up{instance=~\"$Server\"} == 0", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 110, + "type": "text", + "title": "CRITICAL - OFFLINE Aliases", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ Alias-instance topology is stored in the inventory DB (dbo.sql_instances.alias) \u2014 Prometheus labels only carry the primary endpoint.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 12, + "y": 20, + "w": 12, + "h": 6 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ Alias-instance topology is stored in the inventory DB (dbo.sql_instances.alias) \u2014 Prometheus labels only carry the primary endpoint." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 111, + "type": "table", + "title": "SQLAgent Service OFFLINE", + "description": "Instances where the SQL Agent Windows service is not running (windows_service_state{name=~\"SQLSERVERAGENT.*\",state!=\"running\"}).", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 26, + "w": 24, + "h": 6 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_service_state{name=~\"SQLSERVERAGENT.*\",state!=\"running\"} == 1", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 112, + "type": "table", + "title": "Backups - Non-AG Databases - Issues", + "description": "Databases whose most recent Full/Diff/Log backup is older than the configured thresholds. Driven by mssql_backup__age_seconds.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 32, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_backup__age_seconds{instance=~\"$Server\",backup_type=\"D\"} > ($full_threshold_days * 86400)", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Full" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_backup__age_seconds{instance=~\"$Server\",backup_type=\"L\"} > ($tlog_threshold_minutes * 60)", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Log" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + } + ], + "pluginVersion": "12.4.1" + }, + { + "id": 113, + "type": "text", + "title": "Backups - AG Databases - Issues", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ Distinguishing AG vs non-AG databases requires the inventory DB. Use the SQL dashboard for the AG-split view.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 40, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ Distinguishing AG vs non-AG databases requires the inventory DB. Use the SQL dashboard for the AG-split view." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 114, + "type": "table", + "title": "SQLMonitor Jobs - Require Attention", + "description": "SQL Agent jobs whose latest run did not succeed, or whose next run is more than 12h overdue.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 48, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_sqlagent_job__last_run_outcome{instance=~\"$Server\"} != 1", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 115, + "type": "table", + "title": "Disk Space - All Servers", + "description": "Per-volume % used across all selected instances.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 56, + "w": 24, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "percent", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "100 * (1 - windows_logical_disk_free_bytes{instance=~\"$Server\"} / clamp_min(windows_logical_disk_size_bytes{instance=~\"$Server\"}, 1))", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 116, + "type": "table", + "title": "All Servers - AlwaysOn Latency", + "description": "Per-(replica, database) commit latency seconds from mssql_aghealth__latency_seconds.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 66, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__latency_seconds{instance=~\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 117, + "type": "text", + "title": "Log Space Consumers", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ log_space_consumers collector not yet ported to Prometheus. Relies on dbo.log_space_consumers cache table.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 74, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ log_space_consumers collector not yet ported to Prometheus. Relies on dbo.log_space_consumers cache table." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 118, + "type": "text", + "title": "TempDb Usage", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ tempdb_space_usage collector not yet ported.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 82, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ tempdb_space_usage collector not yet ported." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 119, + "type": "text", + "title": "Alerts - Aggregated by Type", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ Alert history rows live in dbo.alert_history \u2014 accessible only from the SQLMonitor inventory DB.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 90, + "w": 12, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ Alert history rows live in dbo.alert_history \u2014 accessible only from the SQLMonitor inventory DB." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 120, + "type": "text", + "title": "All Servers - Alert History", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ Same source as above (dbo.alert_history).", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 12, + "y": 90, + "w": 12, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ Same source as above (dbo.alert_history)." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 121, + "type": "table", + "title": "Servers Need Help - Health Metrics", + "description": "Servers where any of the core health gauges is outside the expected range: PLE < 300, or memory grants pending > 0, or blocking > 0.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 100, + "w": 24, + "h": 12 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__page_life_expectancy_seconds{instance=~\"$Server\"} < 300", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "PLE" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__memory_grants_pending{instance=~\"$Server\"} > 0", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Grants" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__processes_blocked{instance=~\"$Server\"} > 0", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Blocked" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + } + ], + "pluginVersion": "12.4.1" + } + ], + "refresh": "30s", + "schemaVersion": 42, + "tags": [ + "mssql", + "sqlmonitor", + "Live", + "All Servers", + "prometheus" + ], + "templating": { + "list": [ + { + "name": "DS_PROMETHEUS", + "type": "datasource", + "label": "Data Source", + "query": "prometheus", + "current": { + "text": "", + "value": "${DS_PROMETHEUS}", + "selected": true + }, + "refresh": 1, + "hide": 0, + "regex": "", + "skipUrlSync": false + }, + { + "name": "Server", + "type": "query", + "label": "SQL Instance", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_up, instance)", + "query": { + "qryType": 1, + "query": "label_values(mssql_up, instance)", + "refId": "PrometheusVariableQueryEditor-Server" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "full_threshold_days", + "type": "constant", + "label": "full_threshold_days", + "query": "7", + "current": { + "text": "7", + "value": "7", + "selected": false + }, + "hide": 2, + "skipUrlSync": false + }, + { + "name": "diff_threshold_hours", + "type": "constant", + "label": "diff_threshold_hours", + "query": "24", + "current": { + "text": "24", + "value": "24", + "selected": false + }, + "hide": 2, + "skipUrlSync": false + }, + { + "name": "tlog_threshold_minutes", + "type": "constant", + "label": "tlog_threshold_minutes", + "query": "30", + "current": { + "text": "30", + "value": "30", + "selected": false + }, + "hide": 2, + "skipUrlSync": false + }, + { + "name": "disk_warning_pct", + "type": "constant", + "label": "disk_warning_pct", + "query": "80", + "current": { + "text": "80", + "value": "80", + "selected": false + }, + "hide": 2, + "skipUrlSync": false + }, + { + "name": "disk_critical_pct", + "type": "constant", + "label": "disk_critical_pct", + "query": "90", + "current": { + "text": "90", + "value": "90", + "selected": false + }, + "hide": 2, + "skipUrlSync": false + } + ] + }, + "time": { + "from": "now-3h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "Monitoring - Live - All Servers", + "uid": "prom_monitoring_live_all_servers", + "version": 1, + "weekStart": "" +} diff --git a/sql_exporter/Prometheus-Dashboards/Monitoring - Live - Distributed.json b/sql_exporter/Prometheus-Dashboards/Monitoring - Live - Distributed.json new file mode 100644 index 0000000..fd7205c --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/Monitoring - Live - Distributed.json @@ -0,0 +1,4677 @@ +{ + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "12.0.0" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + } + ], + "annotations": { + "list": [] + }, + "description": "", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "id": 101, + "type": "stat", + "title": "Memory Model", + "description": "Memory model reported by mssql_service_info.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 0, + "w": 2, + "h": 2 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_service_info{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 102, + "type": "stat", + "title": "Memory Status", + "description": "1 when OS reports available memory.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 2, + "y": 0, + "w": 2, + "h": 2 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_memory_available_bytes{instance=\"$Server\"} > 0", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 103, + "type": "stat", + "title": "OS Uptime", + "description": "Seconds since OS boot (windows_exporter).", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 4, + "y": 0, + "w": 3, + "h": 2 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_system_system_up_time{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 104, + "type": "stat", + "title": "OS Processes", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 7, + "y": 0, + "w": 4, + "h": 2 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_system_processes{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 105, + "type": "stat", + "title": "OS CPU %", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 11, + "y": 0, + "w": 3, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "percent", + "decimals": 1 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "100 - (avg without(cpu,mode) (rate(windows_cpu_time_total{instance=\"$Server\",mode=\"idle\"}[$__rate_interval])) * 100)", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 106, + "type": "stat", + "title": "Idle CPU %", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 14, + "y": 0, + "w": 3, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "percent", + "decimals": 1 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "avg without(cpu,mode) (rate(windows_cpu_time_total{instance=\"$Server\",mode=\"idle\"}[$__rate_interval])) * 100", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 107, + "type": "stat", + "title": "PLE", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 17, + "y": 0, + "w": 2, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "green", + "value": 300 + } + ] + }, + "unit": "s", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__page_life_expectancy_seconds{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 108, + "type": "table", + "title": "AG Details", + "description": "Replica/DB sync state from mssql_aghealth__*.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 19, + "y": 0, + "w": 5, + "h": 5 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__synchronization_health{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 109, + "type": "stat", + "title": "Box Memory", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 3, + "w": 2, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "bytes", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_cs_physical_memory_bytes{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 110, + "type": "stat", + "title": "Available Memory", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 2, + "y": 3, + "w": 2, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "bytes", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_memory_available_bytes{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 111, + "type": "stat", + "title": "CPU (OS/SQL)", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 8, + "y": 3, + "w": 3, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_sqlserver_cpu_count{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 112, + "type": "stat", + "title": "Processor", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 11, + "y": 4, + "w": 5, + "h": 2 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_cs_logical_processors{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 113, + "type": "stat", + "title": "Machine Type", + "description": "1 if hypervisor detected (VM).", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 16, + "y": 4, + "w": 3, + "h": 2 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_cs_hypervisor{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "LIVE Metrics - [$Server]", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 6, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 114, + "type": "stat", + "title": "Blocked > $blocked_threshold_seconds s", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 7, + "w": 3, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 1 + } + ] + }, + "unit": "short", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum(mssql_whoisactive__avg_elapsed_time{instance=\"$Server\",blocked_session_count!=\"0\"} > $blocked_threshold_seconds) or vector(0)", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 115, + "type": "stat", + "title": "SQL Used Memory", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 3, + "y": 7, + "w": 2, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "bytes", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__total_server_memory_bytes{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 116, + "type": "stat", + "title": "Allocated M/r %", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 5, + "y": 7, + "w": 2, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "percent", + "decimals": 1 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "100 * mssql_perfmon__total_server_memory_bytes{instance=\"$Server\"} / clamp_min(mssql_perfmon__target_server_memory_bytes{instance=\"$Server\"}, 1)", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 117, + "type": "stat", + "title": "Connections", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 7, + "y": 7, + "w": 2, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__user_connections{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 118, + "type": "stat", + "title": "Active Requests", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 9, + "y": 7, + "w": 2, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_sqlserver_active_requests{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 119, + "type": "stat", + "title": "SQL CPU %", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 11, + "y": 7, + "w": 3, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "percent", + "decimals": 1 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_cpu_utilization__sql_cpu_utilization{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 120, + "type": "stat", + "title": "IsHadrEnabled", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 14, + "y": 7, + "w": 2, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_sqlserver_is_hadr_enabled{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 121, + "type": "stat", + "title": "IsClustered", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 16, + "y": 7, + "w": 2, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_sqlserver_is_clustered{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 122, + "type": "stat", + "title": "SQL Version", + "description": "Value is 1; label `product_version` holds the version string.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 18, + "y": 7, + "w": 6, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_service_info{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 123, + "type": "stat", + "title": "Longest Blocking (s)", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 10, + "w": 3, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "max(mssql_whoisactive__avg_elapsed_time{instance=\"$Server\"}) or vector(0)", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 124, + "type": "stat", + "title": "Memory Grants Pending", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 3, + "y": 10, + "w": 3, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 1 + } + ] + }, + "unit": "short", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__memory_grants_pending{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 125, + "type": "stat", + "title": "Page Faults/sec", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 6, + "y": 10, + "w": 3, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(windows_memory_page_faults_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 126, + "type": "stat", + "title": "% User Mode", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 9, + "y": 10, + "w": 3, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "percent", + "decimals": 1 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "avg without(cpu) (rate(windows_cpu_time_total{instance=\"$Server\",mode=\"user\"}[$__rate_interval])) * 100", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 127, + "type": "stat", + "title": "Disk Latency (avg ms)", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 12, + "y": 10, + "w": 3, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "ms", + "decimals": 1 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "avg(rate(windows_logical_disk_read_seconds_total{instance=\"$Server\"}[$__rate_interval]) / clamp_min(rate(windows_logical_disk_reads_total{instance=\"$Server\"}[$__rate_interval]), 1) * 1000)", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 128, + "type": "stat", + "title": "Waits / Core / Minute", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 15, + "y": 10, + "w": 3, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "decimals": 1 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "60 * sum(rate(mssql_waits__wait_time_seconds{instance=\"$Server\"}[$__rate_interval])) / clamp_min(mssql_sqlserver_cpu_count{instance=\"$Server\"}, 1)", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 129, + "type": "stat", + "title": "SQL Uptime", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 18, + "y": 10, + "w": 3, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_sqlserver_uptime_seconds{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 130, + "type": "stat", + "title": "SQL Start Time UTC", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 21, + "y": 10, + "w": 3, + "h": 3 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "dateTimeAsIso", + "decimals": 0 + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "time() - mssql_sqlserver_uptime_seconds{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 131, + "type": "text", + "title": "SQL Server Patching Details", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ CU/KB/patch history is stored in the inventory DB (dbo.sql_server_patching) \u2014 not a Prometheus metric.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 13, + "w": 24, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ CU/KB/patch history is stored in the inventory DB (dbo.sql_server_patching) \u2014 not a Prometheus metric." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "AlwaysOn Availability Groups - Status", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 17, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 132, + "type": "table", + "title": "AlwaysOn Availability Group Health Metrics", + "description": "Per-(replica, database) AG health: state / queues / rates / latency, from mssql_aghealth__*.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 18, + "w": 24, + "h": 9 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__synchronization_health{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Health" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__latency_seconds{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Lat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__log_send_queue_size{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "LSQ" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_aghealth__redo_queue_size{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "RQ" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + } + ], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "Trend - CPU Utilization", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 27, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 133, + "type": "timeseries", + "title": "CPU %", + "description": "SQL vs OS CPU from ring-buffer metrics.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 28, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "percent", + "min": 0, + "max": 100, + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_cpu_utilization__sql_cpu_utilization{instance=\"$Server\"}", + "legendFormat": "SQL CPU", + "range": true, + "instant": false, + "format": "time_series", + "refId": "Sql" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_cpu_utilization__system_idle_process{instance=\"$Server\"}", + "legendFormat": "Idle", + "range": true, + "instant": false, + "format": "time_series", + "refId": "Idle" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "100 - mssql_cpu_utilization__system_idle_process{instance=\"$Server\"}", + "legendFormat": "OS CPU", + "range": true, + "instant": false, + "format": "time_series", + "refId": "Os" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 134, + "type": "timeseries", + "title": "OS Processes CPU Utilization", + "description": "Per-process CPU from windows_exporter.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 36, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "percent", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk(10, rate(windows_process_cpu_time_total{instance=\"$Server\"}[$__rate_interval]) * 100)", + "legendFormat": "{{process}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "Trend - Memory Utilization", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 44, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 135, + "type": "timeseries", + "title": "SQL Server Process Memory", + "description": "mssql_perfmon__total_server_memory_bytes and target_server_memory_bytes.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 45, + "w": 24, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "bytes", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__total_server_memory_bytes{instance=\"$Server\"}", + "legendFormat": "Total Server Memory", + "range": true, + "instant": false, + "format": "time_series", + "refId": "Total" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__target_server_memory_bytes{instance=\"$Server\"}", + "legendFormat": "Target Server Memory", + "range": true, + "instant": false, + "format": "time_series", + "refId": "Target" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 136, + "type": "timeseries", + "title": "OS Processes Memory Utilization", + "description": "Top 10 processes by working-set memory.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 55, + "w": 24, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "bytes", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk(10, windows_process_working_set_bytes{instance=\"$Server\"})", + "legendFormat": "{{process}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "Server & Database Config Changes", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 65, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 137, + "type": "text", + "title": "Server Configuration Changes", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ dbo.server_config_history (LAMA) is inventory-only.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 66, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ dbo.server_config_history (LAMA) is inventory-only." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 138, + "type": "text", + "title": "Database Configuration Changes", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ dbo.database_config_history is inventory-only.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 74, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ dbo.database_config_history is inventory-only." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "Blocking Tree - ACTIVE", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 82, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 139, + "type": "table", + "title": "Blocking Details - ACTIVE - [sp_WhoIsActive]", + "description": "Live blocking info from mssql_whoisactive.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 83, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_whoisactive__start_time{instance=\"$Server\",blocked_session_count!=\"0\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "Lead Blockers", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 91, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 140, + "type": "timeseries", + "title": "Lead Blockers - Logins - Blocked Count", + "description": "Count of blocked sessions grouped by login_name from mssql_whoisactive.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 92, + "w": 24, + "h": 11 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count by (login_name) (mssql_whoisactive__blocking_session_id{instance=\"$Server\",blocked_session_count!=\"0\"})", + "legendFormat": "{{login_name}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 141, + "type": "timeseries", + "title": "Lead Blockers - Programs - Blocked Count", + "description": "Blocked sessions grouped by program_name.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 103, + "w": 24, + "h": 11 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count by (program_name) (mssql_whoisactive__blocking_session_id{instance=\"$Server\",blocked_session_count!=\"0\"})", + "legendFormat": "{{program_name}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "Trend - Memory Grants Pending", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 114, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 142, + "type": "timeseries", + "title": "Memory Grants Pending", + "description": "mssql_perfmon__memory_grants_pending \u2014 anything >0 indicates grant pressure.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 115, + "w": 24, + "h": 7 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__memory_grants_pending{instance=\"$Server\"}", + "legendFormat": "pending grants", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "Memory Consumers - ACTIVE", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 122, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 143, + "type": "table", + "title": "Memory Consumers Over $memory_grant_threshold_mb MB", + "description": "Sessions holding memory grants above the threshold.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 123, + "w": 24, + "h": 11 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_whoisactive__memory_info{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "TempdbSaver - Latest", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 134, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 144, + "type": "text", + "title": "TempdbSaver - tempdb_space_usage", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ tempdb_space_usage collector is not yet ported.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 135, + "w": 12, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ tempdb_space_usage collector is not yet ported." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 145, + "type": "text", + "title": "TempdbSaver - tempdb_space_consumers", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ tempdb_space_consumers collector is not yet ported.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 12, + "y": 135, + "w": 12, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ tempdb_space_consumers collector is not yet ported." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "LogSaver - Latest", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 139, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 146, + "type": "text", + "title": "LogSaver - log_space_consumers", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ log_space_consumers collector is not yet ported.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 140, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ log_space_consumers collector is not yet ported." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "SQL Connections & Winsock Rejections", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 148, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 147, + "type": "timeseries", + "title": "microsoft winsock bsp -> rejected connections/sec", + "description": "Winsock BSP rejected connections; counter delta.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 149, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(windows_net_packets_outbound_errors_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "{{nic}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "Long Running Queries", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 157, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 148, + "type": "table", + "title": "WhoIsActive Data", + "description": "Current sp_WhoIsActive snapshot from mssql_whoisactive.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 158, + "w": 24, + "h": 9 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_whoisactive__start_time{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "Trend - Page Life Expectancy", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 167, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 149, + "type": "timeseries", + "title": "Page Life Expectancy", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 168, + "w": 24, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__page_life_expectancy_seconds{instance=\"$Server\"}", + "legendFormat": "PLE (s)", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "Trend - Batch Request/Sec", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 178, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 150, + "type": "timeseries", + "title": "Batch Requests Per Second", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 179, + "w": 24, + "h": 7 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__batch_requests_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "batch req/s", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "SQL Connections - Distribution", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 186, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 151, + "type": "table", + "title": "Connections by Interface", + "description": "Connections grouped by net_transport / auth_scheme.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 187, + "w": 8, + "h": 6 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count by (net_transport) (mssql_whoisactive__start_time{instance=\"$Server\"})", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 152, + "type": "table", + "title": "Host Connections", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 8, + "y": 187, + "w": 8, + "h": 12 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count by (host_name) (mssql_whoisactive__start_time{instance=\"$Server\"})", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 153, + "type": "table", + "title": "Login Connections", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 16, + "y": 187, + "w": 8, + "h": 12 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count by (login_name) (mssql_whoisactive__start_time{instance=\"$Server\"})", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 154, + "type": "table", + "title": "Connections By Status", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 193, + "w": 8, + "h": 6 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count by (status) (mssql_whoisactive__start_time{instance=\"$Server\"})", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "Running Jobs & Maintenance Workloads", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 199, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 155, + "type": "table", + "title": "WhoIsActive Latest Captured Data", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 200, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_whoisactive__start_time{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "SQLAgent Job Activity Monitor - [$Server]", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 208, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 156, + "type": "table", + "title": "Job Activity Monitor", + "description": "SQL Agent jobs for this instance \u2014 outcome / duration / running state from mssql_sqlagent_job__*.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 209, + "w": 24, + "h": 16 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_sqlagent_job__enabled{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "En" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_sqlagent_job__last_run_outcome{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Out" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_sqlagent_job__last_run_duration_seconds{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Dur" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_sqlagent_job__is_running{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Run" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + } + ], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "Disk Space - [$Server]", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 225, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 157, + "type": "table", + "title": "Disk Space Utilization", + "description": "Per-volume size / free / used from windows_exporter.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 226, + "w": 24, + "h": 16 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "bytes", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_logical_disk_size_bytes{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Size" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_logical_disk_free_bytes{instance=\"$Server\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Free" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + } + ], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "WaitStats", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 242, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 158, + "type": "timeseries", + "title": "[${Server}] - WaitStats", + "description": "rate(mssql_waits__wait_time_seconds) per wait_type.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 243, + "w": 24, + "h": 15 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk(20, sum by (wait_type) (rate(mssql_waits__wait_time_seconds{instance=\"$Server\"}[$__rate_interval])))", + "legendFormat": "{{wait_type}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + } + ], + "refresh": "30s", + "schemaVersion": 42, + "tags": [ + "mssql", + "sqlmonitor", + "Live", + "Distributed", + "prometheus" + ], + "templating": { + "list": [ + { + "name": "DS_PROMETHEUS", + "type": "datasource", + "label": "Data Source", + "query": "prometheus", + "current": { + "text": "", + "value": "${DS_PROMETHEUS}", + "selected": true + }, + "refresh": 1, + "hide": 0, + "regex": "", + "skipUrlSync": false + }, + { + "name": "Server", + "type": "query", + "label": "SQL Instance", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_up, instance)", + "query": { + "qryType": 1, + "query": "label_values(mssql_up, instance)", + "refId": "PrometheusVariableQueryEditor-Server" + }, + "refresh": 1, + "sort": 1, + "multi": false, + "includeAll": false, + "allValue": null, + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "blocked_threshold_seconds", + "type": "constant", + "label": "blocked_threshold_seconds", + "query": "30", + "current": { + "text": "30", + "value": "30", + "selected": false + }, + "hide": 2, + "skipUrlSync": false + }, + { + "name": "memory_grant_threshold_mb", + "type": "constant", + "label": "memory_grant_threshold_mb", + "query": "100", + "current": { + "text": "100", + "value": "100", + "selected": false + }, + "hide": 2, + "skipUrlSync": false + } + ] + }, + "time": { + "from": "now-3h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "Monitoring - Live - Distributed", + "uid": "prom_monitoring_live_distributed", + "version": 1, + "weekStart": "" +} diff --git a/sql_exporter/Prometheus-Dashboards/Monitoring - Perfmon Counters - Quest Softwares - Distributed.json b/sql_exporter/Prometheus-Dashboards/Monitoring - Perfmon Counters - Quest Softwares - Distributed.json new file mode 100644 index 0000000..5c42a32 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/Monitoring - Perfmon Counters - Quest Softwares - Distributed.json @@ -0,0 +1,5859 @@ +{ + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "12.0.0" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + } + ], + "annotations": { + "list": [] + }, + "description": "", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "type": "row", + "title": "CPU & Processor", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 0, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 101, + "type": "timeseries", + "title": "%Processor Time (SQL Server)", + "description": "SQL vs OS CPU %.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 1, + "w": 24, + "h": 7 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "percent", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_cpu_utilization__sql_cpu_utilization{instance=\"$Server\"}", + "legendFormat": "SQL CPU", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "100 - mssql_cpu_utilization__system_idle_process{instance=\"$Server\"}", + "legendFormat": "OS CPU", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 102, + "type": "timeseries", + "title": "System: Processor Queue Length", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 8, + "w": 24, + "h": 5 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_system_processor_queue_length{instance=\"$Server\"}", + "legendFormat": "queue length", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "OS Memory & Paging Performance Counters", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 13, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 103, + "type": "timeseries", + "title": "Memory - Available Mbytes", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 14, + "w": 24, + "h": 6 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "decmbytes", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_memory_available_bytes{instance=\"$Server\"} / 1024 / 1024", + "legendFormat": "Available MB", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 104, + "type": "timeseries", + "title": "Memory - Pages Input/sec, Pages/sec", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 20, + "w": 24, + "h": 11 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(windows_memory_swap_page_operations_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "Pages/sec", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(windows_memory_swap_page_reads_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "Pages Input/sec", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 105, + "type": "timeseries", + "title": "Paging File Usage", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 31, + "w": 24, + "h": 7 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "percent", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_paging_file_usage_percent{instance=\"$Server\"}", + "legendFormat": "usage %", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "SQL Server: Memory Manager Counters", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 38, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 106, + "type": "timeseries", + "title": "SQL Server Process Memory", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 39, + "w": 24, + "h": 11 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "bytes", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__total_server_memory_bytes{instance=\"$Server\"}", + "legendFormat": "Total Server Memory", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__target_server_memory_bytes{instance=\"$Server\"}", + "legendFormat": "Target Server Memory", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 107, + "type": "timeseries", + "title": "SQL Server: Memory Manager", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 50, + "w": 24, + "h": 11 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__memory_grants_pending{instance=\"$Server\"}", + "legendFormat": "Memory Grants Pending", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__memory_grants_outstanding{instance=\"$Server\"}", + "legendFormat": "Memory Grants Outstanding", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 108, + "type": "timeseries", + "title": "Memory Grants", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 61, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__memory_grants_pending{instance=\"$Server\"}", + "legendFormat": "pending", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__memory_grants_outstanding{instance=\"$Server\"}", + "legendFormat": "outstanding", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "MSSQL Data Access Performance Counters", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 69, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 109, + "type": "timeseries", + "title": "Batch Requests/sec", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 70, + "w": 24, + "h": 6 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__batch_requests_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "Batch Req/sec", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 110, + "type": "timeseries", + "title": "SQLServer:Access Methods", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 76, + "w": 24, + "h": 15 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__page_splits_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "Page Splits/sec", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__full_scans_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "Full Scans/sec", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__index_searches_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "Index Searches/sec", + "range": true, + "instant": false, + "format": "time_series", + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__forwarded_records_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "Forwarded Records/sec", + "range": true, + "instant": false, + "format": "time_series", + "refId": "D" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "Logical Disk Counters", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 91, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 111, + "type": "timeseries", + "title": "Logical Disk (Disk Queue Length)", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 92, + "w": 24, + "h": 5 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_logical_disk_avg_read_requests_queued{instance=\"$Server\",volume=~\"$disk_drive\"}", + "legendFormat": "read queue {{volume}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_logical_disk_avg_write_requests_queued{instance=\"$Server\",volume=~\"$disk_drive\"}", + "legendFormat": "write queue {{volume}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 112, + "type": "timeseries", + "title": "Logical Disk - Latency (ms)", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 97, + "w": 24, + "h": 6 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "ms", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "1000 * rate(windows_logical_disk_read_seconds_total{instance=\"$Server\",volume=~\"$disk_drive\"}[$__rate_interval]) / clamp_min(rate(windows_logical_disk_reads_total{instance=\"$Server\",volume=~\"$disk_drive\"}[$__rate_interval]), 1)", + "legendFormat": "read ms {{volume}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "1000 * rate(windows_logical_disk_write_seconds_total{instance=\"$Server\",volume=~\"$disk_drive\"}[$__rate_interval]) / clamp_min(rate(windows_logical_disk_writes_total{instance=\"$Server\",volume=~\"$disk_drive\"}[$__rate_interval]), 1)", + "legendFormat": "write ms {{volume}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 113, + "type": "timeseries", + "title": "Logical Disk - IOPS", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 103, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "ops", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(windows_logical_disk_reads_total{instance=\"$Server\",volume=~\"$disk_drive\"}[$__rate_interval])", + "legendFormat": "reads/s {{volume}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(windows_logical_disk_writes_total{instance=\"$Server\",volume=~\"$disk_drive\"}[$__rate_interval])", + "legendFormat": "writes/s {{volume}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 114, + "type": "timeseries", + "title": "Logical Disk - Throughput", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 111, + "w": 24, + "h": 7 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "Bps", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(windows_logical_disk_read_bytes_total{instance=\"$Server\",volume=~\"$disk_drive\"}[$__rate_interval])", + "legendFormat": "read B/s {{volume}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(windows_logical_disk_write_bytes_total{instance=\"$Server\",volume=~\"$disk_drive\"}[$__rate_interval])", + "legendFormat": "write B/s {{volume}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "Physical Disk Counters", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 118, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 115, + "type": "timeseries", + "title": "Physical Disk (Disk Queue Length)", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 119, + "w": 24, + "h": 5 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_physical_disk_avg_read_requests_queued{instance=\"$Server\"}", + "legendFormat": "read queue {{disk}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "windows_physical_disk_avg_write_requests_queued{instance=\"$Server\"}", + "legendFormat": "write queue {{disk}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 116, + "type": "timeseries", + "title": "Physical Disk - Latency (ms)", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 124, + "w": 24, + "h": 6 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "ms", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "1000 * rate(windows_physical_disk_read_seconds_total{instance=\"$Server\"}[$__rate_interval]) / clamp_min(rate(windows_physical_disk_reads_total{instance=\"$Server\"}[$__rate_interval]), 1)", + "legendFormat": "read ms {{disk}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "1000 * rate(windows_physical_disk_write_seconds_total{instance=\"$Server\"}[$__rate_interval]) / clamp_min(rate(windows_physical_disk_writes_total{instance=\"$Server\"}[$__rate_interval]), 1)", + "legendFormat": "write ms {{disk}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 117, + "type": "timeseries", + "title": "Physical Disk - Throughput", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 130, + "w": 24, + "h": 7 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "Bps", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(windows_physical_disk_read_bytes_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "read B/s {{disk}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(windows_physical_disk_write_bytes_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "write B/s {{disk}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 118, + "type": "timeseries", + "title": "Physical Disk - IOPS", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 137, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "ops", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(windows_physical_disk_reads_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "reads/s {{disk}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(windows_physical_disk_writes_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "writes/s {{disk}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "Network Interface Counters", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 145, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 119, + "type": "timeseries", + "title": "Network Interface - Bytes Total/sec", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 146, + "w": 24, + "h": 7 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "Bps", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(windows_net_bytes_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "{{nic}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "MSSQL Databases - Size Counters", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 153, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 120, + "type": "timeseries", + "title": "SQLServer:Databases - Log File Size", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 154, + "w": 24, + "h": 15 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "bytes", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__log_file_used_size_kb{instance=\"$Server\",database_name=~\"$database\"} * 1024", + "legendFormat": "{{database_name}} log used (B)", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__log_file_size_kb{instance=\"$Server\",database_name=~\"$database\"} * 1024", + "legendFormat": "{{database_name}} log size (B)", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 121, + "type": "timeseries", + "title": "SQLServer:Databases - Data File Size", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 169, + "w": 24, + "h": 12 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "bytes", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__data_file_size_kb{instance=\"$Server\",database_name=~\"$database\"} * 1024", + "legendFormat": "{{database_name}} data (B)", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "MSSQL User Database - Performance Counters", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 181, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 122, + "type": "timeseries", + "title": "SqlServer:Databases - Log Bytes Flushed/sec", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 182, + "w": 24, + "h": 9 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "Bps", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__log_bytes_flushed_total{instance=\"$Server\",database_name=~\"$database\"}[$__rate_interval])", + "legendFormat": "{{database_name}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 123, + "type": "timeseries", + "title": "SqlServer:Databases - Log Flush Wait Time", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 191, + "w": 24, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "ms", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__log_flush_wait_time_ms_total{instance=\"$Server\",database_name=~\"$database\"}[$__rate_interval])", + "legendFormat": "{{database_name}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 124, + "type": "timeseries", + "title": "SqlServer:Databases - Others", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 201, + "w": 24, + "h": 15 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__transactions_total{instance=\"$Server\",database_name=~\"$database\"}[$__rate_interval])", + "legendFormat": "tx/s {{database_name}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__write_transactions_total{instance=\"$Server\",database_name=~\"$database\"}[$__rate_interval])", + "legendFormat": "write-tx/s {{database_name}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "SQL Server - SQL Statistics - Auto Parameterization", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 216, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 125, + "type": "timeseries", + "title": "SQLServer:SQL Statistics - Auto Parameterization", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 217, + "w": 24, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__auto_param_attempts_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "auto-param attempts/s", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__failed_auto_params_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "failed auto-params/s", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__safe_auto_params_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "safe auto-params/s", + "range": true, + "instant": false, + "format": "time_series", + "refId": "C" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "MSSQL Buffer Manager & Memory Performance Counters", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 227, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 126, + "type": "timeseries", + "title": "Batch Requests/sec", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 228, + "w": 24, + "h": 6 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__batch_requests_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "batch req/s", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 127, + "type": "timeseries", + "title": "Page Life Expectancy", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 234, + "w": 24, + "h": 7 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__page_life_expectancy_seconds{instance=\"$Server\"}", + "legendFormat": "PLE", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 128, + "type": "timeseries", + "title": "SQLServer:Buffer Manager", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 241, + "w": 24, + "h": 17 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__buffer_cache_hit_ratio{instance=\"$Server\"}", + "legendFormat": "buffer cache hit %", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__page_reads_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "page reads/s", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__page_writes_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "page writes/s", + "range": true, + "instant": false, + "format": "time_series", + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__lazy_writes_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "lazy writes/s", + "range": true, + "instant": false, + "format": "time_series", + "refId": "D" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "Memory Consumers - sys.dm_os_memory_clerks", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 258, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 129, + "type": "text", + "title": "Memory Consumers", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-perfmon-counters-quest-softwares-distributed*](/d/monitoring-perfmon-counters-quest-softwares-distributed)\n\n_Note:_ dm_os_memory_clerks snapshot is cached in the SQLMonitor memory_clerks table and is not exposed as a Prometheus metric.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 259, + "w": 24, + "h": 13 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-perfmon-counters-quest-softwares-distributed*](/d/monitoring-perfmon-counters-quest-softwares-distributed)\n\n_Note:_ dm_os_memory_clerks snapshot is cached in the SQLMonitor memory_clerks table and is not exposed as a Prometheus metric." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "MSSQL Memory Breakdown Counters", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 272, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 130, + "type": "timeseries", + "title": "SQLServer:Memory Manager - Connection/Lock/Opt", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 273, + "w": 24, + "h": 9 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "bytes", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__connection_memory_kb{instance=\"$Server\"} * 1024", + "legendFormat": "connection mem (B)", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__lock_memory_kb{instance=\"$Server\"} * 1024", + "legendFormat": "lock mem (B)", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__optimizer_memory_kb{instance=\"$Server\"} * 1024", + "legendFormat": "optimizer mem (B)", + "range": true, + "instant": false, + "format": "time_series", + "refId": "C" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 131, + "type": "timeseries", + "title": "SQLServer:Memory Manager - Granted Workspace", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 282, + "w": 24, + "h": 12 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "bytes", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__granted_workspace_memory_kb{instance=\"$Server\"} * 1024", + "legendFormat": "granted workspace (B)", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__reserved_server_memory_kb{instance=\"$Server\"} * 1024", + "legendFormat": "reserved server mem (B)", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "MSSQL Workload Performance Counters", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 294, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 132, + "type": "timeseries", + "title": "SQLServer:SQL Statistics - CPU Stuff", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 295, + "w": 24, + "h": 6 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__sql_compilations_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "compilations/s", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__sql_re_compilations_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "re-compilations/s", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 133, + "type": "timeseries", + "title": "SQLServer:SQL Statistics - Cursors & Errors", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 301, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__errors_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "errors/s", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 134, + "type": "timeseries", + "title": "SQLServer:SQL Errors", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 309, + "w": 24, + "h": 7 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__errors_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "errors/s", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 135, + "type": "text", + "title": "SQLServer: Deprecated Features", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-perfmon-counters-quest-softwares-distributed*](/d/monitoring-perfmon-counters-quest-softwares-distributed)\n\n_Note:_ Deprecated-features counter not currently published by mssql_standard.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 316, + "w": 24, + "h": 7 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-perfmon-counters-quest-softwares-distributed*](/d/monitoring-perfmon-counters-quest-softwares-distributed)\n\n_Note:_ Deprecated-features counter not currently published by mssql_standard." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "SQL Server : Plan Cache : Cache Manager Instance", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 323, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 136, + "type": "timeseries", + "title": "SQLServer: Plan Cache - Totals", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 324, + "w": 24, + "h": 5 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__cache_pages{instance=\"$Server\"}", + "legendFormat": "cache pages", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__cache_object_counts{instance=\"$Server\"}", + "legendFormat": "cache object counts", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__cache_objects_in_use{instance=\"$Server\"}", + "legendFormat": "cache objects in use", + "range": true, + "instant": false, + "format": "time_series", + "refId": "C" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 137, + "type": "timeseries", + "title": "SQLServer: Plan Cache - cache object counts", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 329, + "w": 24, + "h": 6 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__cache_object_counts{instance=\"$Server\"}", + "legendFormat": "{{cache_type}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 138, + "type": "timeseries", + "title": "SQLServer: Plan Cache - cache pages", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 335, + "w": 24, + "h": 6 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__cache_pages{instance=\"$Server\"}", + "legendFormat": "{{cache_type}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 139, + "type": "timeseries", + "title": "SQLServer: Plan Cache - cache objects in use", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 341, + "w": 24, + "h": 6 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__cache_objects_in_use{instance=\"$Server\"}", + "legendFormat": "{{cache_type}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "SQLServer:Transactions", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 347, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 140, + "type": "timeseries", + "title": "Longest Transaction Running Time", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 348, + "w": 11, + "h": 5 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__longest_transaction_running_time_seconds{instance=\"$Server\"}", + "legendFormat": "longest tx (s)", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 141, + "type": "timeseries", + "title": "Free Space in tempdb (KB)", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 11, + "y": 348, + "w": 13, + "h": 5 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "kbytes", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__free_space_in_tempdb_kb{instance=\"$Server\"}", + "legendFormat": "free tempdb (KB)", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 142, + "type": "timeseries", + "title": "Transactions", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 353, + "w": 11, + "h": 5 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__transactions{instance=\"$Server\"}", + "legendFormat": "tx", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 143, + "type": "timeseries", + "title": "Version Store Size (KB)", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 11, + "y": 353, + "w": 13, + "h": 5 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "kbytes", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__version_store_size_kb{instance=\"$Server\"}", + "legendFormat": "version store (KB)", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "SQLServer:General Statistics", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 358, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 144, + "type": "timeseries", + "title": "Winsock BSP rejected connections/sec", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 359, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(windows_net_packets_outbound_errors_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "{{nic}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 145, + "type": "timeseries", + "title": "SQLServer:General Statistics - Login/Logout", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 367, + "w": 24, + "h": 7 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__logins_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "logins/s", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__logouts_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "logouts/s", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "MSSQL Locks Performance Counters", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 374, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 146, + "type": "timeseries", + "title": "SqlServer:Locks - Lock Wait Time (ms)", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 375, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "ms", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__lock_wait_time_ms_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "{{resource_type}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 147, + "type": "timeseries", + "title": "SqlServer:Locks - Average Wait Time (ms)", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 383, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "ms", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__average_wait_time_ms{instance=\"$Server\"}", + "legendFormat": "{{resource_type}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 148, + "type": "timeseries", + "title": "SqlServer:Locks - Waits/sec", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 391, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__lock_waits_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "{{resource_type}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "MSSQL Latches Performance Counters", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 399, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 149, + "type": "timeseries", + "title": "Latch Waits/sec", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 400, + "w": 24, + "h": 6 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__latch_waits_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "latch waits/s", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 150, + "type": "timeseries", + "title": "Latch Wait Time (ms)", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 406, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "ms", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__latch_wait_time_ms_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "latch wait ms/s", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "SQLServer:Replication", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 414, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 151, + "type": "timeseries", + "title": "Replication - Latency", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 415, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_perfmon__replication_latency_seconds{instance=\"$Server\"}", + "legendFormat": "{{publication}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 152, + "type": "timeseries", + "title": "Replication - Transfer Rate", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 423, + "w": 24, + "h": 8 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "rate(mssql_perfmon__replication_delivered_commands_total{instance=\"$Server\"}[$__rate_interval])", + "legendFormat": "{{publication}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "SQLAgent:Jobs", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 431, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 153, + "type": "timeseries", + "title": "SQLAgent: Jobs", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 432, + "w": 24, + "h": 5 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum by (instance) (mssql_sqlagent_job__is_running{instance=\"$Server\"})", + "legendFormat": "jobs running", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum by (instance) (mssql_sqlagent_job__enabled{instance=\"$Server\"})", + "legendFormat": "jobs enabled", + "range": true, + "instant": false, + "format": "time_series", + "refId": "B" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "SQLServer:Database Mirroring", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 437, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 154, + "type": "text", + "title": "Database Mirroring", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-perfmon-counters-quest-softwares-distributed*](/d/monitoring-perfmon-counters-quest-softwares-distributed)\n\n_Note:_ Mirroring counters are not currently exposed by mssql_standard; use the SQL dashboard.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 438, + "w": 24, + "h": 5 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-perfmon-counters-quest-softwares-distributed*](/d/monitoring-perfmon-counters-quest-softwares-distributed)\n\n_Note:_ Mirroring counters are not currently exposed by mssql_standard; use the SQL dashboard." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "type": "row", + "title": "SQLServer:Resource Pool Stats", + "collapsed": false, + "gridPos": { + "x": 0, + "y": 443, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "id": 155, + "type": "text", + "title": "Resource Pool Stats", + "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-perfmon-counters-quest-softwares-distributed*](/d/monitoring-perfmon-counters-quest-softwares-distributed)\n\n_Note:_ Resource Governor pool counters are not currently exposed by mssql_standard.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 444, + "w": 24, + "h": 5 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "mode": "markdown", + "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-perfmon-counters-quest-softwares-distributed*](/d/monitoring-perfmon-counters-quest-softwares-distributed)\n\n_Note:_ Resource Governor pool counters are not currently exposed by mssql_standard." + }, + "targets": [], + "transformations": [], + "pluginVersion": "12.4.1" + } + ], + "refresh": "30s", + "schemaVersion": 42, + "tags": [ + "mssql", + "sqlmonitor", + "Perfmon", + "Quest", + "prometheus" + ], + "templating": { + "list": [ + { + "name": "DS_PROMETHEUS", + "type": "datasource", + "label": "Data Source", + "query": "prometheus", + "current": { + "text": "", + "value": "${DS_PROMETHEUS}", + "selected": true + }, + "refresh": 1, + "hide": 0, + "regex": "", + "skipUrlSync": false + }, + { + "name": "Server", + "type": "query", + "label": "SQL Instance", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_up, instance)", + "query": { + "qryType": 1, + "query": "label_values(mssql_up, instance)", + "refId": "PrometheusVariableQueryEditor-Server" + }, + "refresh": 1, + "sort": 1, + "multi": false, + "includeAll": false, + "allValue": null, + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "database", + "type": "query", + "label": "Database", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_perfmon__log_bytes_flushed_total{instance=\"$Server\"}, database_name)", + "query": { + "qryType": 1, + "query": "label_values(mssql_perfmon__log_bytes_flushed_total{instance=\"$Server\"}, database_name)", + "refId": "PrometheusVariableQueryEditor-database" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "disk_drive", + "type": "query", + "label": "Disk", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(windows_logical_disk_size_bytes{instance=\"$Server\"}, volume)", + "query": { + "qryType": 1, + "query": "label_values(windows_logical_disk_size_bytes{instance=\"$Server\"}, volume)", + "refId": "PrometheusVariableQueryEditor-disk_drive" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + } + ] + }, + "time": { + "from": "now-3h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "Monitoring - Perfmon Counters - Quest Softwares - Distributed", + "uid": "prom_monitoring_perfmon_quest", + "version": 1, + "weekStart": "" +} diff --git a/sql_exporter/Prometheus-Dashboards/README.md b/sql_exporter/Prometheus-Dashboards/README.md new file mode 100644 index 0000000..3f4e436 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/README.md @@ -0,0 +1,133 @@ +# Prometheus-backed Grafana Dashboards + +This folder contains Grafana dashboard JSON files that port the SQL-backed +dashboards in `../../Grafana-Dashboards/` to use the Prometheus data source +populated by `sql_exporter` and `windows_exporter`. + +## Why two copies? + +SQLMonitor's original dashboards query SQL Server directly. These Prometheus +ports consume the same data via scraped metrics instead, which means: + +- no direct 1433 reachability is required from Grafana to each SQL instance, +- dashboards keep working when an instance is temporarily down (last-known + values remain visible), +- Grafana Alerting can run off the same TSDB without a second datasource, +- metric history is retained on the Prometheus side per its configured + retention, independent of the `DBA` database. + +## Dashboards in this folder — Phase 1 (12 dashboards) + +| UID | Title | Source SQL dashboard | Data panels | +|---|---|---|---:| +| `prom_core_metrics_trend` | Core Metrics - Trend | `Core Metrics - Trend.json` | 9 | +| `prom_wait_stats` | Wait Stats | `Wait Stats.json` | 4 | +| `prom_disk_space` | Disk Space | `t___Disk Space.json` | 5 | +| `prom_ag_health_state` | Ag Health State | `t___Ag Health State.json` | 3 | +| `prom_sql_agent_jobs` | SQL Agent Jobs | `Monitoring - Live - All Servers - Job Activity Monitor.json` | 6 | +| `prom_backup_history` | Backup History | `t___Backup_History.json` | 6 | +| `prom_xevent_trend` | XEvent - Trend | `XEvent - Trend.json` | 4 | +| `prom_database_file_io_stats` | Database File IO Stats | `t___Database File IO Stats.json` | 12 | +| `prom_dba_inventory` | DBA Inventory | `DBA Inventory.json` | 6 (+8 deep-links) | +| `prom_monitoring_live_all_servers` | Monitoring - Live - All Servers | `Monitoring - Live - All Servers.json` | 15 (+6 deep-links) | +| `prom_monitoring_live_distributed` | Monitoring - Live - Distributed | `Monitoring - Live - Distributed.json` | 52 (+6 deep-links) | +| `prom_monitoring_perfmon_quest` | Monitoring - Perfmon Counters - Quest Softwares - Distributed | `Monitoring - Perfmon Counters - Quest Softwares - Distributed.json` | 51 (+4 deep-links) | + +Source panels that depend on the SQLMonitor central inventory database +(alert history, AG-vs-nonAG backup split, LAMA config-change deltas, +`dm_os_memory_clerks` snapshot, tempdb/log_space cache tables, +sql_server_patching …) are rendered as `legacy_link_panel(...)` markdown +tiles that deep-link back to the SQL-backed dashboard so every source +section remains visible. + +## Required `sql_exporter` collectors + +All files live in `../`: + +- `mssql_standard.collector.yml` *(upstream, required)* +- `mssql_dba_cached.collector.yml` +- `mssql_dba_regular.collector.yml` +- `mssql_dba_stableinfo.collector.yml` +- `mssql_dba_aghealth.collector.yml` +- `mssql_dba_whoisactive.collector.yml` +- `mssql_sqlagent_jobs.collector.yml` *(new in Phase 1)* +- `mssql_backup_history.collector.yml` *(new in Phase 1)* +- `mssql_xevent.collector.yml` *(new in Phase 1 — reads `DBA.dbo.xevent_metrics` populated by the ring-buffer or file-target XEvent collector proc)* + +Plus `windows_exporter` with the `cpu`, `memory`, `logical_disk`, +`physical_disk`, `net`, `os`, `paging_file`, `process`, `service`, +`system` collectors enabled for OS-level panels. + +## Regeneration workflow + +Every dashboard is generated from a small Python spec in `_specs/`: + +```text +_specs/.py → generate.py → ./.json +``` + +- `_lib/prom_dashboard.py` — `Panel`, `Target`, `query_var`, `custom_var`, + `constant_var`, `row`, `legacy_link_panel`. +- `_lib/build.py` — JSON serialization (`schemaVersion: 42`, `__inputs`, + per-panel-type option defaults). +- `_tools/validate.py` — structural JSON + target/expr sanity check. +- `_tools/inspect_panels.py` — source-dashboard panel inventory. + +```bash +cd sql_exporter/Prometheus-Dashboards +python3 generate.py # rebuild every dashboard +python3 generate.py backup # filter: rebuild only backup_history +python3 _tools/validate.py # structural validation +``` + +## Variable conventions + +All ports use a `DS_PROMETHEUS` datasource variable so the JSON is +portable between Grafana instances, plus a `Server` query variable built +from `label_values(mssql_up, instance)`. Per-dashboard variables +(`database`, `disk_drive`, `backup_type`, `grouping_key`, `percentile`, +`trend_window` …) are documented in the source spec file. + +## Importing into Grafana + +### Interactive + +1. Grafana → Dashboards → **New → Import**. +2. Upload any `*.json` file from this folder. +3. Select your Prometheus datasource for the `DS_PROMETHEUS` placeholder. + +### Bulk (Grafana API) + +```bash +TOKEN="<grafana api token>" +FOLDER_UID="prometheus" +for f in *.json; do + body=$(jq --slurpfile d "$f" -n '{dashboard: $d[0], folderUid: "'$FOLDER_UID'", overwrite: true, inputs: [{name: "DS_PROMETHEUS", type: "datasource", pluginId: "prometheus", value: "Prometheus"}]}') + curl -sS -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \ + -XPOST -d "$body" https://grafana.example.com/api/dashboards/import +done +``` + +## Deep links to SQL dashboards + +The `legacy_link_panel(...)` tiles render a markdown link of the form: + +``` +/d/<sql-dashboard-uid> +``` + +Grafana resolves the UID regardless of which folder the SQL dashboard +lives in, so the deep-link keeps working after folder reorganizations as +long as the UID is preserved. + +## Future phases + +- **Phase 2** — 5 text-bound dashboards (WhoIsActive Workload, XEvent + Workload, SQLMonitor-Alerts, Blitz Server Health, BlitzIndex Analysis) + as numeric-summary + deep-link dashboards. +- **Phase 3** — `sql_exporter/README-sql_exporter.md` refresh with + collector map + Mermaid flow diagrams; cross-links from + `docs/deployment/prometheus.md` to each generated dashboard. +- **Phase 4** — deploy collectors to live VMs (`sqlmonitor`, + `AgHost-1A`, `AgHost-1B`) and validate series on + `https://prometheus.ajaydwivedi.com`. diff --git a/sql_exporter/Prometheus-Dashboards/SQL Agent Jobs.json b/sql_exporter/Prometheus-Dashboards/SQL Agent Jobs.json new file mode 100644 index 0000000..79b83a0 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/SQL Agent Jobs.json @@ -0,0 +1,794 @@ +{ + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "12.0.0" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + } + ], + "annotations": { + "list": [] + }, + "description": "", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "id": 101, + "type": "stat", + "title": "Jobs - Total", + "description": "Total number of SQL Agent jobs matching the filters.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 0, + "w": 6, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count(mssql_sqlagent_job__enabled{instance=~\"$Server\",category_name=~\"$job_category\",job_name=~\"$job_name\"})", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 102, + "type": "stat", + "title": "Jobs - Enabled", + "description": "Number of enabled jobs matching the filters.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 6, + "y": 0, + "w": 6, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "green", + "value": 1 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum(mssql_sqlagent_job__enabled{instance=~\"$Server\",category_name=~\"$job_category\",job_name=~\"$job_name\"})", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 103, + "type": "stat", + "title": "Jobs - Running Now", + "description": "Jobs whose latest sysjobactivity row shows start_execution_date set and stop_execution_date NULL.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 12, + "y": 0, + "w": 6, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum(mssql_sqlagent_job__is_running{instance=~\"$Server\",job_name=~\"$job_name\"})", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 104, + "type": "stat", + "title": "Jobs - Last Outcome = Failed", + "description": "Jobs whose most recent completed run failed.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 18, + "y": 0, + "w": 6, + "h": 4 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 1 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count(mssql_sqlagent_job__last_run_outcome{instance=~\"$Server\",category_name=~\"$job_category\",job_name=~\"$job_name\"} == 0)", + "legendFormat": "", + "range": false, + "instant": true, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 105, + "type": "table", + "title": "SQL Agent Jobs - Status Detail - [$Server]", + "description": "Per-job roll-up of enabled/outcome/duration/next-run/running/24h-step-failures, joined on (instance, job_name).", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 4, + "w": 24, + "h": 18 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_sqlagent_job__enabled{instance=~\"$Server\",category_name=~\"$job_category\",job_name=~\"$job_name\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Enabled" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_sqlagent_job__last_run_outcome{instance=~\"$Server\",category_name=~\"$job_category\",job_name=~\"$job_name\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Outcome" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_sqlagent_job__last_run_duration_seconds{instance=~\"$Server\",job_name=~\"$job_name\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Duration" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_sqlagent_job__last_run_end_time_utc{instance=~\"$Server\",job_name=~\"$job_name\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "LastEnd" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_sqlagent_job__next_run_time_utc{instance=~\"$Server\",job_name=~\"$job_name\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "NextRun" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_sqlagent_job__is_running{instance=~\"$Server\",job_name=~\"$job_name\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Running" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_sqlagent_job__step_failures_last_24h{instance=~\"$Server\",job_name=~\"$job_name\"}", + "legendFormat": "", + "range": false, + "instant": true, + "format": "table", + "refId": "Fails24h" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Time": true, + "__name__": true, + "job": true, + "target": true, + "exported_job": true, + "job_id": true + }, + "renameByName": { + "instance": "Server", + "job_name": "Job", + "category_name": "Category", + "owner_name": "Owner", + "last_run_outcome_desc": "Last Outcome", + "Value #Enabled": "Enabled", + "Value #Outcome": "Outcome (code)", + "Value #Duration": "Duration (s)", + "Value #LastEnd": "Last Run End (UTC)", + "Value #NextRun": "Next Run (UTC)", + "Value #Running": "Running", + "Value #Fails24h": "Step Failures (24h)" + } + } + } + ], + "pluginVersion": "12.4.1" + }, + { + "id": 106, + "type": "timeseries", + "title": "Failed Jobs - Trend", + "description": "Number of jobs whose last completed run was Failed (outcome=0), tracked across time.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 22, + "w": 24, + "h": 10 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count(mssql_sqlagent_job__last_run_outcome{instance=~\"$Server\",category_name=~\"$job_category\",job_name=~\"$job_name\"} == 0) by (instance)", + "legendFormat": "{{instance}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + } + ], + "refresh": "30s", + "schemaVersion": 42, + "tags": [ + "mssql", + "sqlmonitor", + "SQL Agent", + "prometheus" + ], + "templating": { + "list": [ + { + "name": "DS_PROMETHEUS", + "type": "datasource", + "label": "Data Source", + "query": "prometheus", + "current": { + "text": "", + "value": "${DS_PROMETHEUS}", + "selected": true + }, + "refresh": 1, + "hide": 0, + "regex": "", + "skipUrlSync": false + }, + { + "name": "Server", + "type": "query", + "label": "SQL Instance", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_up, instance)", + "query": { + "qryType": 1, + "query": "label_values(mssql_up, instance)", + "refId": "PrometheusVariableQueryEditor-Server" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "job_category", + "type": "query", + "label": "Category", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_sqlagent_job__enabled{instance=~\"$Server\"}, category_name)", + "query": { + "qryType": 1, + "query": "label_values(mssql_sqlagent_job__enabled{instance=~\"$Server\"}, category_name)", + "refId": "PrometheusVariableQueryEditor-job_category" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "job_name", + "type": "query", + "label": "Job Name", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_sqlagent_job__enabled{instance=~\"$Server\",category_name=~\"$job_category\"}, job_name)", + "query": { + "qryType": 1, + "query": "label_values(mssql_sqlagent_job__enabled{instance=~\"$Server\",category_name=~\"$job_category\"}, job_name)", + "refId": "PrometheusVariableQueryEditor-job_name" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "enabled", + "type": "custom", + "label": "Enabled", + "query": "__ALL__,1,0", + "options": [ + { + "text": "__ALL__", + "value": "__ALL__", + "selected": true + }, + { + "text": "1", + "value": "1", + "selected": false + }, + { + "text": "0", + "value": "0", + "selected": false + } + ], + "current": { + "text": "__ALL__", + "value": "__ALL__", + "selected": true + }, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "last_outcome", + "type": "custom", + "label": "Last Outcome", + "query": "__ALL__,Succeeded,Failed,Retry,Canceled,Unknown", + "options": [ + { + "text": "__ALL__", + "value": "__ALL__", + "selected": true + }, + { + "text": "Succeeded", + "value": "Succeeded", + "selected": false + }, + { + "text": "Failed", + "value": "Failed", + "selected": false + }, + { + "text": "Retry", + "value": "Retry", + "selected": false + }, + { + "text": "Canceled", + "value": "Canceled", + "selected": false + }, + { + "text": "Unknown", + "value": "Unknown", + "selected": false + } + ], + "current": { + "text": "__ALL__", + "value": "__ALL__", + "selected": true + }, + "hide": 0, + "skipUrlSync": false + } + ] + }, + "time": { + "from": "now-3h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "SQL Agent Jobs", + "uid": "prom_sql_agent_jobs", + "version": 1, + "weekStart": "" +} diff --git a/sql_exporter/Prometheus-Dashboards/Wait Stats.json b/sql_exporter/Prometheus-Dashboards/Wait Stats.json new file mode 100644 index 0000000..79f09b6 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/Wait Stats.json @@ -0,0 +1,591 @@ +{ + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "12.0.0" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + } + ], + "annotations": { + "list": [] + }, + "description": "", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "id": 101, + "type": "table", + "title": "Wait Stats with \"__${sql_schedulers} CPUs__\" since Startup", + "description": "Top wait_types ranked by wait_time since SQL Server last started. Matches the SQL dashboard's first table.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 0, + "w": 24, + "h": 11 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk($top_n, mssql_waits__wait_time_seconds{instance=\"$Server\"})", + "legendFormat": "{{wait_type}}", + "range": false, + "instant": true, + "format": "table", + "refId": "WaitSec" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_waits__resource_time_seconds{instance=\"$Server\"}", + "legendFormat": "{{wait_type}}", + "range": false, + "instant": true, + "format": "table", + "refId": "ResSec" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_waits__signal_time_seconds{instance=\"$Server\"}", + "legendFormat": "{{wait_type}}", + "range": false, + "instant": true, + "format": "table", + "refId": "SigSec" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_waits__waiting_tasks_count{instance=\"$Server\"}", + "legendFormat": "{{wait_type}}", + "range": false, + "instant": true, + "format": "table", + "refId": "Waiters" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_waits__wait_percentage{instance=\"$Server\"}", + "legendFormat": "{{wait_type}}", + "range": false, + "instant": true, + "format": "table", + "refId": "Pct" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "mssql_waits__wait_rank_no{instance=\"$Server\"}", + "legendFormat": "{{wait_type}}", + "range": false, + "instant": true, + "format": "table", + "refId": "Rank" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Time": true, + "__name__": true, + "instance": true, + "job": true, + "exported_job": true, + "target": true + }, + "renameByName": { + "wait_type": "Wait Type", + "Value #Rank": "Rank", + "Value #WaitSec": "Wait (s)", + "Value #ResSec": "Resource (s)", + "Value #SigSec": "Signal (s)", + "Value #Waiters": "Waiting Tasks", + "Value #Pct": "Wait %" + }, + "indexByName": { + "Rank": 0, + "Wait Type": 1, + "Wait (s)": 2, + "Resource (s)": 3, + "Signal (s)": 4, + "Waiting Tasks": 5, + "Wait %": 6 + } + } + } + ], + "pluginVersion": "12.4.1" + }, + { + "id": 102, + "type": "table", + "title": "Wait Stats ____Since Startup ___ till ___ ${__from:date:YYYY-MM-DD HH.mm}___", + "description": "Counter value at dashboard `from` time \u2014 waits accumulated from SQL startup until the start of the visible range.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 11, + "w": 24, + "h": 7 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk($top_n, mssql_waits__wait_time_seconds{instance=\"$Server\"} @ end() offset ($__to - $__from))", + "legendFormat": "{{wait_type}}", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 103, + "type": "table", + "title": "Wait Stats ____In Selected Time Duration____Since____${__from:date:YYYY-MM-DD HH.mm}___till___${__to:date:YYYY-MM-DD HH.mm}____", + "description": "Wait time accrued between `from` and `to`. Uses increase() on the counter, so wait type = additional seconds waited in the visible range.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 18, + "w": 24, + "h": 7 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s", + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false, + "filterable": true + } + }, + "overrides": [] + }, + "options": { + "showHeader": true, + "cellHeight": "sm", + "footer": { + "countRows": false, + "reducer": [ + "sum" + ], + "show": false, + "fields": "" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk($top_n, sum by (wait_type) (increase(mssql_waits__wait_time_seconds{instance=\"$Server\"}[$__range])))", + "legendFormat": "{{wait_type}}", + "range": false, + "instant": true, + "format": "table", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 104, + "type": "timeseries", + "title": "[${Server}] - WaitStats", + "description": "rate(mssql_waits__wait_time_seconds) per wait_type \u2014 top N by average rate over the visible range.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 25, + "w": 24, + "h": 19 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk($top_n, sum by (wait_type) (rate(mssql_waits__wait_time_seconds{instance=\"$Server\"}[$__rate_interval])))", + "legendFormat": "{{wait_type}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + } + ], + "refresh": "30s", + "schemaVersion": 42, + "tags": [ + "mssql", + "sqlmonitor", + "Wait Stats", + "prometheus" + ], + "templating": { + "list": [ + { + "name": "DS_PROMETHEUS", + "type": "datasource", + "label": "Data Source", + "query": "prometheus", + "current": { + "text": "", + "value": "${DS_PROMETHEUS}", + "selected": true + }, + "refresh": 1, + "hide": 0, + "regex": "", + "skipUrlSync": false + }, + { + "name": "Server", + "type": "query", + "label": "SQL Instance", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_up, instance)", + "query": { + "qryType": 1, + "query": "label_values(mssql_up, instance)", + "refId": "PrometheusVariableQueryEditor-Server" + }, + "refresh": 1, + "sort": 1, + "multi": false, + "includeAll": false, + "allValue": null, + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "sql_schedulers", + "type": "query", + "label": "SQL Schedulers", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "query_result(mssql_sqlserver_cpu_count{instance=\"$Server\"})", + "query": { + "qryType": 1, + "query": "query_result(mssql_sqlserver_cpu_count{instance=\"$Server\"})", + "refId": "PrometheusVariableQueryEditor-sql_schedulers" + }, + "refresh": 1, + "sort": 1, + "multi": false, + "includeAll": false, + "allValue": null, + "regex": "", + "current": {}, + "hide": 2, + "skipUrlSync": false + }, + { + "name": "sqlserver_start_time_utc", + "type": "query", + "label": "SQL Start Time UTC (ms)", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "query_result((time() - mssql_sqlserver_uptime_seconds{instance=\"$Server\"}) * 1000)", + "query": { + "qryType": 1, + "query": "query_result((time() - mssql_sqlserver_uptime_seconds{instance=\"$Server\"}) * 1000)", + "refId": "PrometheusVariableQueryEditor-sqlserver_start_time_utc" + }, + "refresh": 1, + "sort": 1, + "multi": false, + "includeAll": false, + "allValue": null, + "regex": "", + "current": {}, + "hide": 2, + "skipUrlSync": false + }, + { + "name": "top_n", + "type": "constant", + "label": "Top N Waits", + "query": "20", + "current": { + "text": "20", + "value": "20", + "selected": false + }, + "hide": 2, + "skipUrlSync": false + } + ] + }, + "time": { + "from": "now-3h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "Wait Stats", + "uid": "prom_wait_stats", + "version": 1, + "weekStart": "" +} diff --git a/sql_exporter/Prometheus-Dashboards/XEvent - Trend.json b/sql_exporter/Prometheus-Dashboards/XEvent - Trend.json new file mode 100644 index 0000000..50cdf5e --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/XEvent - Trend.json @@ -0,0 +1,682 @@ +{ + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "12.0.0" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + } + ], + "annotations": { + "list": [] + }, + "description": "", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "id": 101, + "type": "timeseries", + "title": "XEvent - CPU Trend - By - {${grouping_key}}", + "description": "CPU time (seconds) attributed to extended events, summed per ${grouping_key}. Uses the 5-minute aggregate gauge published by mssql_xevent; rendered as a rate since the gauge resets each collection.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 0, + "w": 24, + "h": 11 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk($top_n, sum by (${grouping_key}) (mssql_xevent__cpu_time_ms_last_5m{instance=\"$Server\",database_name=~\"$database\",event_name=~\"$event_name\",result=~\"$result\",client_app_name=~\"$client_app\"} / 1000))", + "legendFormat": "{{${grouping_key}}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 102, + "type": "timeseries", + "title": "XEvent - Counts Trend - By - {${grouping_key}}", + "description": "Count of extended events in the most recent 5-minute window, summed per ${grouping_key}.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 11, + "w": 24, + "h": 11 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk($top_n, sum by (${grouping_key}) (mssql_xevent__events_last_5m{instance=\"$Server\",database_name=~\"$database\",event_name=~\"$event_name\",result=~\"$result\",client_app_name=~\"$client_app\"}))", + "legendFormat": "{{${grouping_key}}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 103, + "type": "timeseries", + "title": "XEvent - Reads Trend - By - {${grouping_key}}", + "description": "Logical + physical reads attributed to extended events, summed per ${grouping_key}.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 22, + "w": 24, + "h": 11 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk($top_n, sum by (${grouping_key}) (mssql_xevent__logical_reads_last_5m{instance=\"$Server\",database_name=~\"$database\",event_name=~\"$event_name\",result=~\"$result\",client_app_name=~\"$client_app\"}))", + "legendFormat": "logical \u2022 {{${grouping_key}}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "Logical" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk($top_n, sum by (${grouping_key}) (mssql_xevent__physical_reads_last_5m{instance=\"$Server\",database_name=~\"$database\",event_name=~\"$event_name\",result=~\"$result\",client_app_name=~\"$client_app\"}))", + "legendFormat": "physical \u2022 {{${grouping_key}}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "Physical" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + }, + { + "id": 104, + "type": "timeseries", + "title": "XEvent - Duration Trend - By - {${grouping_key}}", + "description": "Sum of durations (seconds) for extended events in the 5-minute window, per ${grouping_key}.", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "x": 0, + "y": 33, + "w": 24, + "h": 11 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s", + "custom": { + "drawStyle": "line", + "lineInterpolation": "linear", + "lineWidth": 1, + "fillOpacity": 10, + "gradientMode": "none", + "spanNulls": false, + "showPoints": "never", + "pointSize": 5, + "stacking": { + "mode": "none", + "group": "A" + }, + "axisPlacement": "auto", + "axisLabel": "", + "scaleDistribution": { + "type": "linear" + }, + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "calcs": [ + "lastNotNull", + "mean", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk($top_n, sum by (${grouping_key}) (mssql_xevent__duration_seconds_last_5m{instance=\"$Server\",database_name=~\"$database\",event_name=~\"$event_name\",result=~\"$result\",client_app_name=~\"$client_app\"}))", + "legendFormat": "{{${grouping_key}}}", + "range": true, + "instant": false, + "format": "time_series", + "refId": "A" + } + ], + "transformations": [], + "pluginVersion": "12.4.1" + } + ], + "refresh": "30s", + "schemaVersion": 42, + "tags": [ + "mssql", + "sqlmonitor", + "XEvent", + "prometheus" + ], + "templating": { + "list": [ + { + "name": "DS_PROMETHEUS", + "type": "datasource", + "label": "Data Source", + "query": "prometheus", + "current": { + "text": "", + "value": "${DS_PROMETHEUS}", + "selected": true + }, + "refresh": 1, + "hide": 0, + "regex": "", + "skipUrlSync": false + }, + { + "name": "Server", + "type": "query", + "label": "SQL Instance", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_up, instance)", + "query": { + "qryType": 1, + "query": "label_values(mssql_up, instance)", + "refId": "PrometheusVariableQueryEditor-Server" + }, + "refresh": 1, + "sort": 1, + "multi": false, + "includeAll": false, + "allValue": null, + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "database", + "type": "query", + "label": "Database", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_xevent__events_last_5m{instance=\"$Server\"}, database_name)", + "query": { + "qryType": 1, + "query": "label_values(mssql_xevent__events_last_5m{instance=\"$Server\"}, database_name)", + "refId": "PrometheusVariableQueryEditor-database" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "event_name", + "type": "query", + "label": "Event", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_xevent__events_last_5m{instance=\"$Server\"}, event_name)", + "query": { + "qryType": 1, + "query": "label_values(mssql_xevent__events_last_5m{instance=\"$Server\"}, event_name)", + "refId": "PrometheusVariableQueryEditor-event_name" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "result", + "type": "query", + "label": "Result", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_xevent__events_last_5m{instance=\"$Server\"}, result)", + "query": { + "qryType": 1, + "query": "label_values(mssql_xevent__events_last_5m{instance=\"$Server\"}, result)", + "refId": "PrometheusVariableQueryEditor-result" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "client_app", + "type": "query", + "label": "Client App", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(mssql_xevent__events_last_5m{instance=\"$Server\"}, client_app_name)", + "query": { + "qryType": 1, + "query": "label_values(mssql_xevent__events_last_5m{instance=\"$Server\"}, client_app_name)", + "refId": "PrometheusVariableQueryEditor-client_app" + }, + "refresh": 1, + "sort": 1, + "multi": true, + "includeAll": true, + "allValue": ".*", + "regex": "", + "current": {}, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "grouping_key", + "type": "custom", + "label": "Group by", + "query": "event_name,database_name,client_app_name,result", + "options": [ + { + "text": "event_name", + "value": "event_name", + "selected": true + }, + { + "text": "database_name", + "value": "database_name", + "selected": false + }, + { + "text": "client_app_name", + "value": "client_app_name", + "selected": false + }, + { + "text": "result", + "value": "result", + "selected": false + } + ], + "current": { + "text": "event_name", + "value": "event_name", + "selected": true + }, + "hide": 0, + "skipUrlSync": false + }, + { + "name": "top_n", + "type": "custom", + "label": "Top N series", + "query": "5,10,15,20,25", + "options": [ + { + "text": "5", + "value": "5", + "selected": false + }, + { + "text": "10", + "value": "10", + "selected": true + }, + { + "text": "15", + "value": "15", + "selected": false + }, + { + "text": "20", + "value": "20", + "selected": false + }, + { + "text": "25", + "value": "25", + "selected": false + } + ], + "current": { + "text": "10", + "value": "10", + "selected": true + }, + "hide": 0, + "skipUrlSync": false + } + ] + }, + "time": { + "from": "now-3h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "XEvent - Trend", + "uid": "prom_xevent_trend", + "version": 1, + "weekStart": "" +} diff --git a/sql_exporter/Prometheus-Dashboards/_lib/build.py b/sql_exporter/Prometheus-Dashboards/_lib/build.py new file mode 100644 index 0000000..83df97e --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/_lib/build.py @@ -0,0 +1,162 @@ +"""Dashboard builder: turns :class:`Panel` lists into a full Grafana +dashboard JSON document ready to be imported.""" +from __future__ import annotations + +import json +from pathlib import Path +from typing import Any + +from prom_dashboard import PROM_DS, Panel, Target, ds_var, ROW_TYPE + + +_DEFAULT_THRESHOLDS = { + "mode": "absolute", + "steps": [ + {"color": "green", "value": None}, + {"color": "red", "value": 80}, + ], +} + + +def _panel_json(p: Panel, pid: int) -> dict[str, Any]: + x, y, w, h = p.grid + fc: dict[str, Any] = { + "defaults": { + "color": {"mode": "thresholds"}, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": p.thresholds_steps or [ + {"color": "green", "value": None}, + ], + }, + "unit": p.unit, + }, + "overrides": p.field_overrides, + } + if p.decimals is not None: + fc["defaults"]["decimals"] = p.decimals + if p.min_value is not None: + fc["defaults"]["min"] = p.min_value + if p.max_value is not None: + fc["defaults"]["max"] = p.max_value + + opts: dict[str, Any] + if p.type == "timeseries": + opts = { + "legend": {"displayMode": "table", "placement": "bottom", + "showLegend": True, "calcs": ["lastNotNull", "mean", "max"]}, + "tooltip": {"mode": "multi", "sort": "desc"}, + } + fc["defaults"]["custom"] = { + "drawStyle": "line", "lineInterpolation": "linear", + "lineWidth": 1, "fillOpacity": 10, "gradientMode": "none", + "spanNulls": False, "showPoints": "never", + "pointSize": 5, "stacking": {"mode": "none", "group": "A"}, + "axisPlacement": "auto", "axisLabel": "", + "scaleDistribution": {"type": "linear"}, + "hideFrom": {"tooltip": False, "viz": False, "legend": False}, + "thresholdsStyle": {"mode": "off"}, + } + elif p.type == "stat": + opts = { + "colorMode": "value", "graphMode": "area", + "justifyMode": "auto", "orientation": "auto", + "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": False}, + "textMode": "auto", "wideLayout": True, + } + elif p.type == "table": + opts = {"showHeader": True, "cellHeight": "sm", + "footer": {"countRows": False, "reducer": ["sum"], "show": False, + "fields": ""}} + fc["defaults"]["custom"] = { + "align": "auto", "cellOptions": {"type": "auto"}, + "inspect": False, "filterable": True, + } + elif p.type == "gauge": + opts = { + "orientation": "auto", "showThresholdLabels": False, + "showThresholdMarkers": True, + "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": False}, + } + elif p.type == "bargauge": + opts = { + "orientation": "horizontal", "displayMode": "gradient", + "showUnfilled": True, + "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": False}, + } + elif p.type == "text": + opts = {"mode": "markdown", "content": p.description or p.title} + else: + opts = {} + if p.options_override: + opts.update(p.options_override) + + return { + "id": pid, + "type": p.type, + "title": p.title, + "description": p.description, + "datasource": PROM_DS, + "gridPos": {"x": x, "y": y, "w": w, "h": h}, + "fieldConfig": fc, + "options": opts, + "targets": [t.to_json() for t in p.targets], + "transformations": p.transformations, + "pluginVersion": "12.4.1", + } + + +def build_dashboard(*, uid: str, title: str, tags: list[str], + variables: list[dict[str, Any]], + panels: list[Panel | dict[str, Any]], + description: str = "", + time_from: str = "now-3h", time_to: str = "now", + refresh: str = "30s") -> dict[str, Any]: + pid = 100 + flat: list[dict[str, Any]] = [] + for p in panels: + if isinstance(p, dict) and p.get("type") == ROW_TYPE: + flat.append(p) + continue + pid += 1 + flat.append(_panel_json(p, pid)) + return { + "__inputs": [{"name": "DS_PROMETHEUS", "label": "Prometheus", + "description": "", "type": "datasource", + "pluginId": "prometheus", "pluginName": "Prometheus"}], + "__elements": {}, + "__requires": [ + {"type": "grafana", "id": "grafana", "name": "Grafana", "version": "12.0.0"}, + {"type": "datasource", "id": "prometheus", "name": "Prometheus", "version": "1.0.0"}, + {"type": "panel", "id": "timeseries", "name": "Time series", "version": ""}, + {"type": "panel", "id": "table", "name": "Table", "version": ""}, + {"type": "panel", "id": "stat", "name": "Stat", "version": ""}, + ], + "annotations": {"list": []}, + "description": description, + "editable": True, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": None, + "links": [], + "liveNow": False, + "panels": flat, + "refresh": refresh, + "schemaVersion": 42, + "tags": tags, + "templating": {"list": [ds_var()] + variables}, + "time": {"from": time_from, "to": time_to}, + "timepicker": {}, + "timezone": "browser", + "title": title, + "uid": uid, + "version": 1, + "weekStart": "", + } + + +def write_dashboard(out_dir: Path, filename: str, dashboard: dict[str, Any]) -> Path: + path = out_dir / filename + path.write_text(json.dumps(dashboard, indent=2) + "\n") + return path diff --git a/sql_exporter/Prometheus-Dashboards/_lib/prom_dashboard.py b/sql_exporter/Prometheus-Dashboards/_lib/prom_dashboard.py new file mode 100644 index 0000000..7d5f1b0 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/_lib/prom_dashboard.py @@ -0,0 +1,153 @@ +"""Helpers for generating Prometheus-backed Grafana dashboard JSON for +SQLMonitor. Every dashboard in this folder is produced from a small +Python spec by calling :func:`build_dashboard`. + +The helpers aim for consistency with the existing sample dashboard +``sql_exporter/SQL-Exporter-Metrics-Dashboard-External.json`` so all +dashboards share the same datasource picker, schemaVersion, and +``${DS_PROMETHEUS}`` / ``$Server`` variables. +""" +from __future__ import annotations + +from dataclasses import dataclass, field +from typing import Any + + +PROM_DS = {"type": "prometheus", "uid": "${DS_PROMETHEUS}"} + + +def ds_var() -> dict[str, Any]: + return { + "name": "DS_PROMETHEUS", + "type": "datasource", + "label": "Data Source", + "query": "prometheus", + "current": {"text": "", "value": "${DS_PROMETHEUS}", "selected": True}, + "refresh": 1, + "hide": 0, + "regex": "", + "skipUrlSync": False, + } + + +def query_var(name: str, definition: str, *, label: str | None = None, + multi: bool = False, include_all: bool = False, + all_value: str = ".*", hide: int = 0, + regex: str = "") -> dict[str, Any]: + return { + "name": name, + "type": "query", + "label": label or name, + "datasource": PROM_DS, + "definition": definition, + "query": {"qryType": 1, "query": definition, + "refId": f"PrometheusVariableQueryEditor-{name}"}, + "refresh": 1, + "sort": 1, + "multi": multi, + "includeAll": include_all, + "allValue": all_value if include_all else None, + "regex": regex, + "current": {}, + "hide": hide, + "skipUrlSync": False, + } + + +def custom_var(name: str, options: list[str], *, default: str | None = None, + label: str | None = None, hide: int = 0) -> dict[str, Any]: + default = default or options[0] + return { + "name": name, + "type": "custom", + "label": label or name, + "query": ",".join(options), + "options": [ + {"text": o, "value": o, "selected": o == default} for o in options + ], + "current": {"text": default, "value": default, "selected": True}, + "hide": hide, + "skipUrlSync": False, + } + + +def constant_var(name: str, value: str, *, label: str | None = None, + hide: int = 2) -> dict[str, Any]: + return { + "name": name, + "type": "constant", + "label": label or name, + "query": value, + "current": {"text": value, "value": value, "selected": False}, + "hide": hide, + "skipUrlSync": False, + } + + +@dataclass +class Target: + expr: str + legend: str = "__auto" + ref: str = "A" + instant: bool = False + format: str = "time_series" + + def to_json(self) -> dict[str, Any]: + return { + "datasource": PROM_DS, + "editorMode": "code", + "expr": self.expr, + "legendFormat": self.legend, + "range": not self.instant, + "instant": self.instant, + "format": self.format, + "refId": self.ref, + } + + +@dataclass +class Panel: + title: str + type: str = "timeseries" + targets: list[Target] = field(default_factory=list) + grid: tuple[int, int, int, int] = (0, 0, 12, 8) # x, y, w, h + unit: str = "short" + description: str = "" + decimals: int | None = None + min_value: float | None = None + max_value: float | None = None + transformations: list[dict[str, Any]] = field(default_factory=list) + field_overrides: list[dict[str, Any]] = field(default_factory=list) + options_override: dict[str, Any] = field(default_factory=dict) + thresholds_steps: list[dict[str, Any]] | None = None + + +ROW_TYPE = "row" + + +def row(title: str, y: int, *, collapsed: bool = False, + panels: list[dict[str, Any]] | None = None) -> dict[str, Any]: + return { + "type": ROW_TYPE, + "title": title, + "collapsed": collapsed, + "gridPos": {"x": 0, "y": y, "w": 24, "h": 1}, + "panels": panels or [], + } + + +def legacy_link_panel(title: str, grid: tuple[int, int, int, int], + sql_dashboard: str, note: str = "") -> Panel: + """Text panel that deep-links to the original SQL-backed dashboard. + Used wherever a source panel cannot be represented against + Prometheus-only metrics without new collectors.""" + body = ( + f"**Legacy panel** — not yet ported to Prometheus.\n\n" + f"[Open in SQL dashboard: *{sql_dashboard}*](/d/{sql_dashboard})" + ) + if note: + body += f"\n\n_Note:_ {note}" + return Panel( + title=title, type="text", grid=grid, description=body, + options_override={"mode": "markdown", "content": body}, + ) diff --git a/sql_exporter/Prometheus-Dashboards/_specs/ag_health_state.py b/sql_exporter/Prometheus-Dashboards/_specs/ag_health_state.py new file mode 100644 index 0000000..06a35f4 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/_specs/ag_health_state.py @@ -0,0 +1,162 @@ +"""Spec for ``Ag Health State`` Prometheus port (UID: prom_ag_health_state). + +SQL source dashboard has 3 data panels and one dashlist: + + 1. Table LIVE - AlwaysOn Availability Group Health Metrics - [$server] + -> latest synchronization_health / state / queue sizes / rates. + 2. Table Latest - AlwaysOn Availability Groups - Status - FILTERED + @ ${ag_health_state_collection_time_utc} + -> same columns as (1); SQL version resolves the anchor timestamp to + an exact cached snapshot. Under Prometheus we serve the latest + value within the visible range instead (documented in the panel + description). + 3. Timeseries Trend - AlwaysOn Latency + -> mssql_aghealth__latency_seconds per (replica, database). + +All metrics come from ``mssql_dba_aghealth.collector.yml`` which is +already shipped with the exporter. +""" +from prom_dashboard import Panel, Target, query_var, custom_var + + +UID = "prom_ag_health_state" +TITLE = "Ag Health State" +TAGS = ["mssql", "sqlmonitor", "Ag Health State", "prometheus"] + + +_SYNC_STATE_ALL = ".*" +_SYNC_HEALTH_ALL = ".*" + + +def variables(): + return [ + query_var("Server", "label_values(mssql_up, instance)", + label="SQL Instance", multi=True, include_all=True), + query_var("ag_name", + 'label_values(mssql_aghealth__synchronization_health{instance=~"$Server"}, ag_name)', + label="AG Name", multi=True, include_all=True), + query_var("ag_listener", + 'label_values(mssql_aghealth__synchronization_health{instance=~"$Server"}, ag_listener)', + label="AG Listener", multi=True, include_all=True), + query_var("replica_server_name", + 'label_values(mssql_aghealth__synchronization_health{instance=~"$Server"}, replica_server_name)', + label="Replica Server", multi=True, include_all=True), + query_var("database_name", + 'label_values(mssql_aghealth__synchronization_health{instance=~"$Server"}, database_name)', + label="Database", multi=True, include_all=True), + query_var("sync_state_desc", + 'label_values(mssql_aghealth__synchronization_health{instance=~"$Server"}, synchronization_state_desc)', + label="Sync State", multi=True, include_all=True), + query_var("sync_health_desc", + 'label_values(mssql_aghealth__synchronization_health{instance=~"$Server"}, synchronization_health_desc)', + label="Sync Health", multi=True, include_all=True), + custom_var("replica_type", ["__ALL__", "Primary", "Secondary", "Local"], + default="__ALL__", label="Replica Type"), + custom_var("latency_minutes", + ["-1", "0", "1", "5", "15", "30", "60"], + default="-1", label="Min Latency (min, -1=off)"), + ] + + +def panels(): + ps: list[Panel] = [] + + # Selector string shared by every panel: honours all the filter vars. + sel = ( + '{instance=~"$Server",ag_name=~"$ag_name",' + 'ag_listener=~"$ag_listener",' + 'replica_server_name=~"$replica_server_name",' + 'database_name=~"$database_name",' + 'synchronization_state_desc=~"$sync_state_desc",' + 'synchronization_health_desc=~"$sync_health_desc"}' + ) + # unique_key-only selector for metrics that only carry unique_key labels. + uksel = '{instance=~"$Server"}' + + # ---- Panel 1: LIVE table (multi-metric merge by unique_key + tags) ---- + def t(metric: str, ref: str, has_tags: bool = False) -> Target: + s = sel if has_tags else uksel + return Target(f"{metric}{s}", legend="", ref=ref, + instant=True, format="table") + + ps.append(Panel( + title="LIVE - AlwaysOn Availability Group Health Metrics - [$Server]", + description=("Latest AG replica health joined by unique_key. " + "Sync state / health / queue sizes / rates / latency " + "from mssql_aghealth__*."), + type="table", unit="short", + grid=(0, 0, 24, 14), + targets=[ + t("mssql_aghealth__synchronization_health", "Health", has_tags=True), + t("mssql_aghealth__synchronization_state", "State"), + t("mssql_aghealth__is_primary_replica", "Primary"), + t("mssql_aghealth__is_local", "Local"), + t("mssql_aghealth__is_suspended", "Suspended"), + t("mssql_aghealth__latency_seconds", "Latency"), + t("mssql_aghealth__log_send_queue_size", "LogSendQ"), + t("mssql_aghealth__redo_queue_size", "RedoQ"), + t("mssql_aghealth__log_send_rate", "LogRate"), + t("mssql_aghealth__redo_rate", "RedoRate"), + t("mssql_aghealth__estimated_redo_completion_time_min", "RedoEtaMin"), + t("mssql_aghealth__last_redone_time", "LastRedone"), + t("mssql_aghealth__last_commit_time", "LastCommit"), + ], + transformations=[ + {"id": "merge", "options": {}}, + {"id": "organize", "options": { + "excludeByName": {"Time": True, "__name__": True, "job": True, + "target": True, "exported_job": True}, + "renameByName": { + "replica_server_name": "Replica", + "database_name": "Database", + "ag_name": "AG", + "ag_listener": "Listener", + "synchronization_state_desc": "Sync State", + "synchronization_health_desc": "Sync Health", + "suspend_reason_desc": "Suspend Reason", + "Value #Health": "Health (code)", + "Value #State": "State (code)", + "Value #Primary": "Is Primary", + "Value #Local": "Is Local", + "Value #Suspended": "Is Suspended", + "Value #Latency": "Latency (s)", + "Value #LogSendQ": "Log Send Queue", + "Value #RedoQ": "Redo Queue", + "Value #LogRate": "Log Send Rate", + "Value #RedoRate": "Redo Rate", + "Value #RedoEtaMin": "Est. Redo (min)", + "Value #LastRedone": "Last Redone (epoch s)", + "Value #LastCommit": "Last Commit (epoch s)", + }, + }}, + ], + )) + + # ---- Panel 2: "Latest at anchor" table (best-effort under Prometheus) --- + ps.append(Panel( + title=("Latest - AlwaysOn Availability Groups - Status - FILTERED " + "@ dashboard end"), + description=("SQL version anchors this at a cached collection " + "timestamp. Prometheus serves the latest sample within " + "the visible range instead."), + type="table", unit="short", + grid=(0, 14, 24, 11), + targets=[Target( + f"last_over_time(mssql_aghealth__latency_seconds{sel}[$__range])", + legend="", ref="A", instant=True, format="table")], + )) + + # ---- Panel 3: Latency trend timeseries ---- + ps.append(Panel( + title="Trend - AlwaysOn Latency (seconds)", + description=("Per (replica, database) commit latency vs the primary, " + "from mssql_aghealth__latency_seconds. " + "-1 latency means the probe could not be evaluated."), + type="timeseries", unit="s", + grid=(0, 25, 24, 16), + targets=[Target( + f"mssql_aghealth__latency_seconds{sel}", + legend="{{replica_server_name}} || {{database_name}}", ref="A")], + )) + + return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/backup_history.py b/sql_exporter/Prometheus-Dashboards/_specs/backup_history.py new file mode 100644 index 0000000..543aa8c --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/_specs/backup_history.py @@ -0,0 +1,167 @@ +"""Spec for ``Backup History`` Prometheus port (UID: prom_backup_history). + +SQL source dashboard ``t___Backup_History.json`` has 2 data panels: + + 1. Table Backup History - [$server] - [$database] + → most recent Full/Diff/Log backup per database with size + duration + and age-since-completion. + 2. Timeseries Backup Size Trend - [$server] - [$database] + → size_bytes over time, grouped by backup_type. + +Backed by the new ``mssql_backup_history.collector.yml``: + + mssql_backup__last_time_utc {database_name, backup_type, + backup_type_desc, recovery_model} + mssql_backup__last_duration_seconds {database_name, backup_type} + mssql_backup__last_size_bytes {database_name, backup_type} + mssql_backup__last_compressed_size_bytes {database_name, backup_type} + mssql_backup__age_seconds {database_name, backup_type} + mssql_backup__count_last_24h {database_name, backup_type} +""" +from prom_dashboard import Panel, Target, query_var, custom_var + + +UID = "prom_backup_history" +TITLE = "Backup History" +TAGS = ["mssql", "sqlmonitor", "Backup", "prometheus"] + + +def variables(): + return [ + query_var("Server", "label_values(mssql_up, instance)", + label="SQL Instance", multi=True, include_all=True), + query_var("database_name", + 'label_values(mssql_backup__last_time_utc{instance=~"$Server"}, database_name)', + label="Database", multi=True, include_all=True), + custom_var("backup_type", + ["__ALL__", "D", "I", "L", "F", "G", "P", "Q"], + default="__ALL__", + label="Backup Type (D=Full, I=Diff, L=Log)"), + custom_var("full_threshold_days", + ["1", "2", "3", "7", "14", "30"], default="7", + label="Full age warn (days)"), + custom_var("diff_threshold_hours", + ["4", "8", "12", "24", "48"], default="24", + label="Diff age warn (hours)"), + custom_var("tlog_threshold_minutes", + ["5", "15", "30", "60", "120", "240"], default="30", + label="Log age warn (minutes)"), + ] + + +def panels(): + ps: list[Panel] = [] + I = ('{instance=~"$Server",database_name=~"$database_name",' + 'backup_type=~"$backup_type"}') + + # Summary stats + ps.append(Panel( + title="Databases - Covered", + description="Number of databases reporting backup history.", + type="stat", unit="short", + grid=(0, 0, 6, 4), + targets=[Target( + f'count(count by (instance, database_name) ' + f'(mssql_backup__last_time_utc{I}))', + legend="", ref="A", instant=True)], + )) + ps.append(Panel( + title="Full Backups older than $full_threshold_days days", + description="Databases whose most recent Full (D) backup is older " + "than the configured threshold.", + type="stat", unit="short", + grid=(6, 0, 6, 4), + thresholds_steps=[{"color": "green", "value": None}, + {"color": "red", "value": 1}], + targets=[Target( + f'count(mssql_backup__age_seconds{{instance=~"$Server",' + f'database_name=~"$database_name",backup_type="D"}} ' + f'> ($full_threshold_days * 86400))', + legend="", ref="A", instant=True)], + )) + ps.append(Panel( + title="Diff Backups older than $diff_threshold_hours hours", + description="Databases whose most recent Differential (I) backup is " + "older than the configured threshold.", + type="stat", unit="short", + grid=(12, 0, 6, 4), + thresholds_steps=[{"color": "green", "value": None}, + {"color": "red", "value": 1}], + targets=[Target( + f'count(mssql_backup__age_seconds{{instance=~"$Server",' + f'database_name=~"$database_name",backup_type="I"}} ' + f'> ($diff_threshold_hours * 3600))', + legend="", ref="A", instant=True)], + )) + ps.append(Panel( + title="Log Backups older than $tlog_threshold_minutes minutes", + description="Databases whose most recent Log (L) backup is older " + "than the configured threshold.", + type="stat", unit="short", + grid=(18, 0, 6, 4), + thresholds_steps=[{"color": "green", "value": None}, + {"color": "red", "value": 1}], + targets=[Target( + f'count(mssql_backup__age_seconds{{instance=~"$Server",' + f'database_name=~"$database_name",backup_type="L"}} ' + f'> ($tlog_threshold_minutes * 60))', + legend="", ref="A", instant=True)], + )) + + # Main detail table + ps.append(Panel( + title="Backup History - [$Server] - [$database_name]", + description=("Latest backup per (database, type): age / duration / " + "size / compressed size / 24h count, joined by the " + "backup_type label."), + type="table", unit="short", + grid=(0, 4, 24, 16), + targets=[ + Target(f"mssql_backup__last_time_utc{I}", + legend="", ref="When", instant=True, format="table"), + Target(f"mssql_backup__age_seconds{I}", + legend="", ref="AgeS", instant=True, format="table"), + Target(f"mssql_backup__last_duration_seconds{I}", + legend="", ref="DurS", instant=True, format="table"), + Target(f"mssql_backup__last_size_bytes{I}", + legend="", ref="Size", instant=True, format="table"), + Target(f"mssql_backup__last_compressed_size_bytes{I}", + legend="", ref="CompSize", instant=True, format="table"), + Target(f"mssql_backup__count_last_24h{I}", + legend="", ref="Cnt24h", instant=True, format="table"), + ], + transformations=[ + {"id": "merge", "options": {}}, + {"id": "organize", "options": { + "excludeByName": {"Time": True, "__name__": True, + "job": True, "target": True, + "exported_job": True}, + "renameByName": { + "instance": "Server", + "database_name": "Database", + "backup_type": "Type", + "backup_type_desc": "Type Description", + "recovery_model": "Recovery Model", + "Value #When": "Last Backup (UTC epoch)", + "Value #AgeS": "Age (s)", + "Value #DurS": "Duration (s)", + "Value #Size": "Size (bytes)", + "Value #CompSize": "Compressed (bytes)", + "Value #Cnt24h": "Count (24h)", + }, + }}, + ], + )) + + # Size trend + ps.append(Panel( + title="Backup Size Trend - [$Server] - [$database_name]", + description="Per-(database, backup_type) backup size over time.", + type="timeseries", unit="bytes", + grid=(0, 20, 24, 12), + targets=[Target( + f"mssql_backup__last_size_bytes{I}", + legend="{{database_name}} / {{backup_type}}", ref="A")], + )) + + return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/core_metrics_trend.py b/sql_exporter/Prometheus-Dashboards/_specs/core_metrics_trend.py new file mode 100644 index 0000000..929b50e --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/_specs/core_metrics_trend.py @@ -0,0 +1,225 @@ +"""Spec for ``Core Metrics - Trend`` Prometheus port. + +High-fidelity port. Every variable from the SQL dashboard is preserved: + + $Server SQL instance(s) (multi + include-all) + $trend_by Hourly | Daily → sets the aggregation window used + inside ``quantile_over_time``; the SQL dashboard's + ``all_server_volatile_info_history_hourly`` / + ``_daily`` cached tables become 1h / 1d windows here. + $percentile p50 | p75 | p95 | p99 | max → maps to the first + argument of ``quantile_over_time`` (``max`` == 1.0). + $hour_of_day 0..23. Filters at query-evaluation time via + ``hour() == bool $hour_of_day``. NOTE: pure PromQL + cannot retrieve historical data for a specific + hour-of-day; this filter only applies when the + dashboard range is currently at that hour. For the + backfilled version, see the SQL dashboard + ``core_metrics_trend``. See README for details. + $max_servers N → top-N server filter, preserved via + ``topk($max_servers, ...)``. +""" +from prom_dashboard import Panel, Target, query_var, custom_var, constant_var + + +UID = "prom_core_metrics_trend" +TITLE = "Core Metrics - Trend" +TAGS = ["mssql", "sqlmonitor", "core-metrics", "prometheus"] + + +_PCTL_MAP = {"p50": "0.5", "p75": "0.75", "p95": "0.95", + "p99": "0.99", "max": "1.0"} +_TREND_MAP = {"Hourly": "1h", "Daily": "1d"} + + +def variables(): + return [ + query_var("Server", "label_values(mssql_up, instance)", + label="SQL Instance", multi=True, include_all=True), + custom_var("trend_by", ["Hourly", "Daily"], default="Hourly", + label="Trend By"), + custom_var("trend_window", list(_TREND_MAP.values()), + default="1h", label="Trend Window", hide=2), + custom_var("percentile", + list(_PCTL_MAP.keys()), + default="p95", label="Percentile"), + custom_var("percentile_q", + list(_PCTL_MAP.values()), + default="0.95", label="Percentile Q", hide=2), + custom_var("hour_of_day", + [str(i) for i in range(24)] + ["-1"], + default="-1", label="Hour of Day (-1 = any)"), + constant_var("max_servers", "10", label="Max Servers"), + ] + + +def _pct(expr: str, window: str = "$trend_window") -> str: + return f"quantile_over_time($percentile_q, ({expr})[{window}:])" + + +def _hod_gate() -> str: + # Gate an expression on $hour_of_day ≥ 0 and matching the query eval + # hour. When $hour_of_day = -1 the gate is always 1 (no filter). + return ( + "(vector($hour_of_day) == bool -1) " + "or on () (vector($hour_of_day) == bool hour())" + ) + + +def panels(): + ps: list[Panel] = [] + SERVER = '{instance=~"$Server"}' + RI = "[$__rate_interval]" + TW = "$trend_window" + + def pct(expr: str) -> str: + return f"quantile_over_time($percentile_q, ({expr})[{TW}:])" + + def topk(expr: str) -> str: + return f"topk($max_servers, {expr})" + + # 1. Database IO Latency (ms/IO) per (server, db) - $trend_by window + # SQL source: Core Metrics - Trend - Database IO Latency - Server + read_lat = ( + f"rate(mssql_virtualfilestats__io_stall_read_ms{SERVER}{RI}) " + f"/ clamp_min(rate(mssql_virtualfilestats__num_of_reads{SERVER}{RI}), 1)" + ) + write_lat = ( + f"rate(mssql_virtualfilestats__io_stall_write_ms{SERVER}{RI}) " + f"/ clamp_min(rate(mssql_virtualfilestats__num_of_writes{SERVER}{RI}), 1)" + ) + ps.append(Panel( + title="Core Metrics - ${trend_by} TREND - Database IO Latency - Server ___[${Server}]___", + description=("Per-database read/write latency in ms/IO. " + "Aggregated at the $trend_by window using $percentile " + "quantile_over_time."), + type="timeseries", unit="ms", + grid=(0, 0, 24, 8), + targets=[ + Target(pct(f"avg by (instance, database_name) ({read_lat})"), + legend="{{instance}} - {{database_name}} - read", ref="A"), + Target(pct(f"avg by (instance, database_name) ({write_lat})"), + legend="{{instance}} - {{database_name}} - write", ref="B"), + ], + )) + + # 2. Database IO (MB/s) per (server, db) + ps.append(Panel( + title="Core Metrics - ${trend_by} TREND - Database IO - Server ___[${Server}]___", + description="Per-database throughput in MB/s at the $trend_by window.", + type="timeseries", unit="MBs", + grid=(0, 8, 24, 8), + targets=[ + Target(pct( + f"sum by (instance, database_name) (" + f"rate(mssql_virtualfilestats__num_of_bytes_read{SERVER}{RI})) / (1024*1024)" + ), legend="{{instance}} - {{database_name}} - read", ref="A"), + Target(pct( + f"sum by (instance, database_name) (" + f"rate(mssql_virtualfilestats__num_of_bytes_written{SERVER}{RI})) / (1024*1024)" + ), legend="{{instance}} - {{database_name}} - write", ref="B"), + ], + )) + + # 3. Database IOPS per (server, db) + ps.append(Panel( + title="Core Metrics - ${trend_by} TREND - Database IOPS - Server ___[${Server}]___", + description="Per-database reads/writes per second at the $trend_by window.", + type="timeseries", unit="iops", + grid=(0, 16, 24, 8), + targets=[ + Target(pct( + f"sum by (instance, database_name) (" + f"rate(mssql_virtualfilestats__num_of_reads{SERVER}{RI}))" + ), legend="{{instance}} - {{database_name}} - reads", ref="A"), + Target(pct( + f"sum by (instance, database_name) (" + f"rate(mssql_virtualfilestats__num_of_writes{SERVER}{RI}))" + ), legend="{{instance}} - {{database_name}} - writes", ref="B"), + ], + )) + + # 4. OS CPU (%) - top-N servers + os_cpu = ( + f"100 - (avg by (instance) (" + f"rate(windows_cpu_time_total{{mode=\"idle\",instance=~\"$Server\"}}{RI})) * 100)" + ) + ps.append(Panel( + title="Core Metrics - ${trend_by} TREND - OS CPU - Max ${max_servers} Servers", + description="OS CPU % per server, top-N by $percentile at $trend_by window.", + type="timeseries", unit="percent", + grid=(0, 24, 12, 8), + min_value=0, max_value=100, + targets=[Target(topk(pct(os_cpu)), legend="{{instance}}", ref="A")], + )) + + # 5. SQL CPU (%) - top-N servers + sql_cpu = f"avg by (instance) (mssql_cpu_utilization_percentage{SERVER})" + ps.append(Panel( + title="Core Metrics - ${trend_by} TREND - SQL CPU - Max ${max_servers} Servers", + description="SQL CPU % per server, top-N by $percentile at $trend_by window.", + type="timeseries", unit="percent", + grid=(12, 24, 12, 8), + min_value=0, max_value=100, + targets=[Target(topk(pct(sql_cpu)), legend="{{instance}}", ref="A")], + )) + + # 6. Disk Latency - top-N servers + dl_r = ( + f"rate(windows_logical_disk_read_latency_seconds_total{SERVER}{RI}) " + f"/ clamp_min(rate(windows_logical_disk_reads_total{SERVER}{RI}), 1)" + ) + dl_w = ( + f"rate(windows_logical_disk_write_latency_seconds_total{SERVER}{RI}) " + f"/ clamp_min(rate(windows_logical_disk_writes_total{SERVER}{RI}), 1)" + ) + ps.append(Panel( + title="Core Metrics - ${trend_by} TREND - Disk Latency - Max ${max_servers} Servers", + description="OS-level disk latency (s/IO) per volume. top-N by $percentile.", + type="timeseries", unit="s", + grid=(0, 32, 24, 8), + targets=[ + Target(topk(pct(f"avg by (instance, volume) ({dl_r})")), + legend="{{instance}} {{volume}} read", ref="A"), + Target(topk(pct(f"avg by (instance, volume) ({dl_w})")), + legend="{{instance}} {{volume}} write", ref="B"), + ], + )) + + # 7. Batch Requests / sec - top-N servers + ps.append(Panel( + title="Core Metrics - ${trend_by} TREND - Requests - Max ${max_servers} Servers", + description="Batch requests/sec per server, top-N by $percentile.", + type="timeseries", unit="reqps", + grid=(0, 40, 12, 8), + targets=[Target( + topk(pct(f"sum by (instance) (rate(mssql_batch_requests{SERVER}{RI}))")), + legend="{{instance}}", ref="A")], + )) + + # 8. Available Memory (OS) - bottom-N (smallest) servers at $percentile + ps.append(Panel( + title="Core Metrics - ${trend_by} TREND - Available Memory - Max ${max_servers} Servers", + description=("OS available memory per server, bottom-N (smallest) " + "at $percentile quantile over $trend_by window."), + type="timeseries", unit="bytes", + grid=(12, 40, 12, 8), + targets=[Target( + f"bottomk($max_servers, " + f"quantile_over_time($percentile_q, " + f"(avg by (instance) (windows_memory_available_bytes{SERVER}))[{TW}:]))", + legend="{{instance}}", ref="A")], + )) + + # 9. Connections - top-N servers + ps.append(Panel( + title="Core Metrics - ${trend_by} TREND - Connections - Max ${max_servers} Servers", + description="SQL connection count per server, top-N by $percentile.", + type="timeseries", unit="short", + grid=(0, 48, 24, 8), + targets=[Target( + topk(pct(f"sum by (instance) (mssql_connections{SERVER})")), + legend="{{instance}}", ref="A")], + )) + + return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/database_file_io_stats.py b/sql_exporter/Prometheus-Dashboards/_specs/database_file_io_stats.py new file mode 100644 index 0000000..d1c9921 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/_specs/database_file_io_stats.py @@ -0,0 +1,340 @@ +"""Spec for ``Database File IO Stats`` Prometheus port +(UID: prom_database_file_io_stats). + +SQL source dashboard has 16 data panels grouped into nine rows: + + File IO Stats - Since Startup (table) + File IO Stats - Selective (2 tables: @from, @range) + File IO Stats - Reads/Writes histogram - Data (timeseries) + File IO Stats - Reads/Writes histogram - Counts (timeseries) + Database IO Stats - Trend (timeseries) + Database IO Stats - Since Startup (table) + Database IO Stats - Selective (2 tables) + Database IO Stats - Comparison (2 tables, with prior day) + Disk IO Stats - Since Startup (table) + Disk IO Stats - Selective (2 tables) + Disk IO Stats - Comparison (2 tables) + +Metric source: + mssql_virtualfilestats__{num_of_reads,num_of_writes, + num_of_bytes_read,num_of_bytes_written, + io_stall_read_ms,io_stall_write_ms} + are counter-style gauges published by mssql_dba_cached on every scrape. + +PromQL equivalents: + since-startup tables → the raw counter (instant, last-over-range). + selective / range tables → increase(metric[$__range]). + comparison "prior day" → the same increase() but anchored with + @ end() offset $__range so the window is + shifted back one dashboard-range. + trend timeseries → rate(metric[$__rate_interval]). +""" +from prom_dashboard import Panel, Target, query_var, constant_var + + +UID = "prom_database_file_io_stats" +TITLE = "Database File IO Stats" +TAGS = ["mssql", "sqlmonitor", "IO Stats", "prometheus"] + + +def variables(): + return [ + query_var("Server", "label_values(mssql_up, instance)", + label="SQL Instance"), + query_var("database", + 'label_values(mssql_virtualfilestats__num_of_reads{instance="$Server"}, database_name)', + label="Database", multi=True, include_all=True), + query_var("disk_drive", + 'label_values(mssql_virtualfilestats__num_of_reads{instance="$Server"}, disk_volume)', + label="Disk", multi=True, include_all=True), + constant_var("top_n", "25", label="Top N Rows"), + ] + + +I = ('{instance="$Server",database_name=~"$database",' + 'disk_volume=~"$disk_drive"}') + + +def panels(): + ps: list[Panel] = [] + # ---- File IO Stats — Since Startup (table) ---- + ps.append(Panel( + title="File IO Stats ___ Since Startup", + description=("Per-file counters since SQL Server start, straight " + "off mssql_virtualfilestats__*: bytes read/written, " + "IO counts and cumulative stall time (ms)."), + type="table", unit="short", + grid=(0, 0, 24, 10), + targets=[ + Target(f"mssql_virtualfilestats__num_of_bytes_read{I}", + legend="", ref="BR", instant=True, format="table"), + Target(f"mssql_virtualfilestats__num_of_bytes_written{I}", + legend="", ref="BW", instant=True, format="table"), + Target(f"mssql_virtualfilestats__num_of_reads{I}", + legend="", ref="NR", instant=True, format="table"), + Target(f"mssql_virtualfilestats__num_of_writes{I}", + legend="", ref="NW", instant=True, format="table"), + Target(f"mssql_virtualfilestats__io_stall_read_ms{I}", + legend="", ref="SR", instant=True, format="table"), + Target(f"mssql_virtualfilestats__io_stall_write_ms{I}", + legend="", ref="SW", instant=True, format="table"), + ], + transformations=[ + {"id": "merge", "options": {}}, + {"id": "organize", "options": { + "excludeByName": {"Time": True, "__name__": True, + "job": True, "target": True, + "exported_job": True}, + "renameByName": { + "database_name": "Database", + "file_logical_name": "File", + "disk_volume": "Volume", + "Value #BR": "Bytes Read", + "Value #BW": "Bytes Written", + "Value #NR": "# Reads", + "Value #NW": "# Writes", + "Value #SR": "Stall Read (ms)", + "Value #SW": "Stall Write (ms)", + }, + }}, + ], + )) + + # ---- File IO Stats — Since Startup till $__from ---- + ps.append(Panel( + title="File IO Stats ___ Since Startup till ${__from:date:YYYY-MM-DD HH.mm}", + description=("Counter values at the dashboard's `from` time — " + "accumulated IO from SQL startup until the start of " + "the visible range."), + type="table", unit="short", + grid=(0, 10, 24, 10), + targets=[Target( + f"mssql_virtualfilestats__num_of_bytes_read{I} " + f"@ end() offset ($__to - $__from)", + legend="", ref="A", instant=True, format="table")], + )) + + # ---- File IO Stats — In Selected Time Duration ---- + ps.append(Panel( + title=("File IO Stats ___ In Selected Time Duration ___" + "${__from:date:YYYY-MM-DD HH.mm} → " + "${__to:date:YYYY-MM-DD HH.mm}"), + description=("Delta of each virtualfilestats counter over the " + "dashboard's visible range (increase())."), + type="table", unit="short", + grid=(0, 20, 24, 10), + targets=[ + Target(f"increase(mssql_virtualfilestats__num_of_bytes_read{I}[$__range])", + legend="", ref="BR", instant=True, format="table"), + Target(f"increase(mssql_virtualfilestats__num_of_bytes_written{I}[$__range])", + legend="", ref="BW", instant=True, format="table"), + Target(f"increase(mssql_virtualfilestats__num_of_reads{I}[$__range])", + legend="", ref="NR", instant=True, format="table"), + Target(f"increase(mssql_virtualfilestats__num_of_writes{I}[$__range])", + legend="", ref="NW", instant=True, format="table"), + Target(f"increase(mssql_virtualfilestats__io_stall_read_ms{I}[$__range])", + legend="", ref="SR", instant=True, format="table"), + Target(f"increase(mssql_virtualfilestats__io_stall_write_ms{I}[$__range])", + legend="", ref="SW", instant=True, format="table"), + ], + transformations=[ + {"id": "merge", "options": {}}, + {"id": "organize", "options": { + "excludeByName": {"Time": True, "__name__": True, + "job": True, "target": True, + "exported_job": True}, + }}, + ], + )) + + # ---- File IO Stats Reads/Writes (Data - bytes) Histogram ---- + ps.append(Panel( + title="[${Server}] - Db File IO Stats - Read/Writes Data", + description=("Per-file bytes-read and bytes-written rates " + "(bytes/sec), derived from the two underlying " + "counters."), + type="timeseries", unit="Bps", + grid=(0, 30, 24, 12), + targets=[ + Target( + f"rate(mssql_virtualfilestats__num_of_bytes_read{I}[$__rate_interval])", + legend="read • {{database_name}} / {{file_logical_name}}", + ref="Reads"), + Target( + f"rate(mssql_virtualfilestats__num_of_bytes_written{I}[$__rate_interval])", + legend="write • {{database_name}} / {{file_logical_name}}", + ref="Writes"), + ], + )) + + # ---- File IO Stats Reads/Writes (#) Histogram ---- + ps.append(Panel( + title="[${Server}] - Db File IO Stats - # Read/Writes", + description=("Per-file IO operations per second " + "(reads + writes), derived from the operation " + "counters."), + type="timeseries", unit="ops", + grid=(0, 42, 24, 12), + targets=[ + Target( + f"rate(mssql_virtualfilestats__num_of_reads{I}[$__rate_interval])", + legend="reads/s • {{database_name}} / {{file_logical_name}}", + ref="Reads"), + Target( + f"rate(mssql_virtualfilestats__num_of_writes{I}[$__rate_interval])", + legend="writes/s • {{database_name}} / {{file_logical_name}}", + ref="Writes"), + ], + )) + + # ---- Database IO Stats — Trend ---- + ps.append(Panel( + title="[${Server}] - Db IO Stats - Read/Writes Data", + description=("Aggregated per-database read/write throughput " + "(Bps), summed across files."), + type="timeseries", unit="Bps", + grid=(0, 54, 24, 12), + targets=[ + Target( + f"sum by (database_name) (" + f"rate(mssql_virtualfilestats__num_of_bytes_read{I}[$__rate_interval]))", + legend="read • {{database_name}}", ref="R"), + Target( + f"sum by (database_name) (" + f"rate(mssql_virtualfilestats__num_of_bytes_written{I}[$__rate_interval]))", + legend="write • {{database_name}}", ref="W"), + ], + )) + + # ---- Database IO Stats — Since Startup (aggregated) ---- + ps.append(Panel( + title="Database IO Stats ___ Since Startup", + description="Per-database aggregates of the filestats counters " + "from SQL Server startup.", + type="table", unit="short", + grid=(0, 66, 24, 10), + targets=[ + Target( + f"sum by (instance, database_name) (" + f"mssql_virtualfilestats__num_of_bytes_read{I})", + legend="", ref="BR", instant=True, format="table"), + Target( + f"sum by (instance, database_name) (" + f"mssql_virtualfilestats__num_of_bytes_written{I})", + legend="", ref="BW", instant=True, format="table"), + Target( + f"sum by (instance, database_name) (" + f"mssql_virtualfilestats__io_stall_read_ms{I})", + legend="", ref="SR", instant=True, format="table"), + Target( + f"sum by (instance, database_name) (" + f"mssql_virtualfilestats__io_stall_write_ms{I})", + legend="", ref="SW", instant=True, format="table"), + ], + transformations=[{"id": "merge", "options": {}}], + )) + + # ---- Database IO Stats — In Selected Time Duration ---- + ps.append(Panel( + title="Database IO Stats ___ In Selected Time Duration", + description="Per-database delta over the dashboard range.", + type="table", unit="short", + grid=(0, 76, 24, 10), + targets=[ + Target( + f"sum by (instance, database_name) (" + f"increase(mssql_virtualfilestats__num_of_bytes_read{I}[$__range]))", + legend="", ref="BR", instant=True, format="table"), + Target( + f"sum by (instance, database_name) (" + f"increase(mssql_virtualfilestats__num_of_bytes_written{I}[$__range]))", + legend="", ref="BW", instant=True, format="table"), + ], + transformations=[{"id": "merge", "options": {}}], + )) + + # ---- Database IO Stats — Comparison (prior window) ---- + ps.append(Panel( + title="Database IO Stats ___ Prior Window ___ DAY(+/-)", + description=("Same aggregate delta as above but over the time " + "window immediately *before* the dashboard range. " + "Use side-by-side with the previous panel for " + "day-over-day comparison."), + type="table", unit="short", + grid=(0, 86, 24, 10), + targets=[ + Target( + f"sum by (instance, database_name) (" + f"increase(mssql_virtualfilestats__num_of_bytes_read{I}[$__range] " + f"@ end() offset $__range))", + legend="", ref="BR", instant=True, format="table"), + Target( + f"sum by (instance, database_name) (" + f"increase(mssql_virtualfilestats__num_of_bytes_written{I}[$__range] " + f"@ end() offset $__range))", + legend="", ref="BW", instant=True, format="table"), + ], + transformations=[{"id": "merge", "options": {}}], + )) + + # ---- Disk IO Stats — Since Startup (by disk_volume) ---- + ps.append(Panel( + title="Disk IO Stats ___ Since Startup", + description="Per-volume aggregates of the filestats counters.", + type="table", unit="short", + grid=(0, 96, 24, 10), + targets=[ + Target( + f"sum by (instance, disk_volume) (" + f"mssql_virtualfilestats__num_of_bytes_read{I})", + legend="", ref="BR", instant=True, format="table"), + Target( + f"sum by (instance, disk_volume) (" + f"mssql_virtualfilestats__num_of_bytes_written{I})", + legend="", ref="BW", instant=True, format="table"), + ], + transformations=[{"id": "merge", "options": {}}], + )) + + # ---- Disk IO Stats — In Selected Time Duration ---- + ps.append(Panel( + title="Disk IO Stats ___ In Selected Time Duration", + description="Per-volume delta over the dashboard range.", + type="table", unit="short", + grid=(0, 106, 24, 10), + targets=[ + Target( + f"sum by (instance, disk_volume) (" + f"increase(mssql_virtualfilestats__num_of_bytes_read{I}[$__range]))", + legend="", ref="BR", instant=True, format="table"), + Target( + f"sum by (instance, disk_volume) (" + f"increase(mssql_virtualfilestats__num_of_bytes_written{I}[$__range]))", + legend="", ref="BW", instant=True, format="table"), + ], + transformations=[{"id": "merge", "options": {}}], + )) + + # ---- Disk IO Stats — Prior window comparison ---- + ps.append(Panel( + title="Disk IO Stats ___ Prior Window", + description="Per-volume delta over the window immediately before " + "the dashboard range.", + type="table", unit="short", + grid=(0, 116, 24, 10), + targets=[ + Target( + f"sum by (instance, disk_volume) (" + f"increase(mssql_virtualfilestats__num_of_bytes_read{I}[$__range] " + f"@ end() offset $__range))", + legend="", ref="BR", instant=True, format="table"), + Target( + f"sum by (instance, disk_volume) (" + f"increase(mssql_virtualfilestats__num_of_bytes_written{I}[$__range] " + f"@ end() offset $__range))", + legend="", ref="BW", instant=True, format="table"), + ], + transformations=[{"id": "merge", "options": {}}], + )) + + return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/dba_inventory.py b/sql_exporter/Prometheus-Dashboards/_specs/dba_inventory.py new file mode 100644 index 0000000..98a23b2 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/_specs/dba_inventory.py @@ -0,0 +1,204 @@ +"""Spec for ``DBA Inventory`` Prometheus port (UID: prom_dba_inventory). + +Source dashboard ``DBA Inventory.json`` has 10 data panels, all driven +off the SQLMonitor inventory schema (dbo.servers, dbo.sql_instances, +dbo.sql_cluster_nodes, etc). That schema is *not* exposed to +Prometheus — those tables are live in SQL Server and the exporter does +not publish row-level inventory rows. + +Strategy: + • Panels that *can* be rebuilt from the `mssql_up`, `mssql_service_info`, + and `mssql_aghealth__*` metrics are implemented as stat/table panels. + • The rest link back to the original SQL dashboard with + ``legacy_link_panel`` so the Prometheus dashboard still lists every + source section and does not pretend inventory data has been ported. +""" +from prom_dashboard import ( + Panel, Target, query_var, legacy_link_panel, +) + + +UID = "prom_dba_inventory" +TITLE = "DBA Inventory" +TAGS = ["mssql", "sqlmonitor", "Inventory", "prometheus"] + + +_LEGACY_UID = "dba-inventory" + + +def variables(): + return [ + query_var("Server", "label_values(mssql_up, instance)", + label="SQL Instance", multi=True, include_all=True), + ] + + +def panels(): + ps: list[Panel] = [] + + # Summary row — real Prometheus data + ps.append(Panel( + title="SQL Instances - Online", + description="Count of SQL Server targets currently scraping " + "successfully (mssql_up == 1).", + type="stat", unit="short", + grid=(0, 0, 6, 4), + thresholds_steps=[{"color": "red", "value": None}, + {"color": "green", "value": 1}], + targets=[Target('sum(mssql_up == 1)', legend="", ref="A", + instant=True)], + )) + ps.append(Panel( + title="SQL Instances - Offline", + description="Count of SQL Server targets with mssql_up == 0.", + type="stat", unit="short", + grid=(6, 0, 6, 4), + thresholds_steps=[{"color": "green", "value": None}, + {"color": "red", "value": 1}], + targets=[Target('sum(mssql_up == 0)', legend="", ref="A", + instant=True)], + )) + ps.append(Panel( + title="Availability Groups", + description="Distinct AG names observed across scrape targets.", + type="stat", unit="short", + grid=(12, 0, 6, 4), + targets=[Target( + 'count(count by (ag_name) (mssql_aghealth__synchronization_health))', + legend="", ref="A", instant=True)], + )) + ps.append(Panel( + title="Hosts", + description="Distinct hostnames observed via mssql_service_info.", + type="stat", unit="short", + grid=(18, 0, 6, 4), + targets=[Target( + 'count(count by (host_name) (mssql_service_info))', + legend="", ref="A", instant=True)], + )) + + # Combined Info table (instance-level) + ps.append(Panel( + title="SQL Servers - Combined Info - FILTERED", + description=("Per-instance combined info from mssql_service_info " + "(host/service/product) and mssql_up for online state."), + type="table", unit="short", + grid=(0, 4, 24, 9), + targets=[ + Target('mssql_service_info{instance=~"$Server"}', + legend="", ref="Info", instant=True, format="table"), + Target('mssql_up{instance=~"$Server"}', + legend="", ref="Up", instant=True, format="table"), + ], + transformations=[ + {"id": "merge", "options": {}}, + {"id": "organize", "options": { + "excludeByName": {"Time": True, "__name__": True, + "job": True, "target": True, + "exported_job": True}, + "renameByName": { + "instance": "Server", + "host_name": "Host", + "product_version": "Version", + "service_name": "Service", + "Value #Info": "Info", + "Value #Up": "Up?", + }, + }}, + ], + )) + + # SQL Instance Details → inventory-only (legacy link) + ps.append(legacy_link_panel( + "SQLMonitor - Instance Details - FILTERED", + grid=(0, 13, 24, 7), + sql_dashboard=_LEGACY_UID, + note="Inventory-DB columns (alias, linked-server-name, " + "major/minor version breakdown) are not exposed to " + "Prometheus. Use the SQL dashboard for the full detail row.", + )) + + # All Servers - Basic Info → inventory + ps.append(legacy_link_panel( + "All Servers - Basic Info", + grid=(0, 20, 24, 7), + sql_dashboard=_LEGACY_UID, + note="dbo.vw_all_servers_basic_info (SMA agents, OS hosts, " + "service accounts) is not mirrored in Prometheus.", + )) + + # SQL Servers - Extended Info → inventory + ps.append(legacy_link_panel( + "SQL Servers - Extended Info", + grid=(0, 27, 24, 7), + sql_dashboard=_LEGACY_UID, + note="SKU / license / feature matrix — inventory table.", + )) + + # SQL Server Hosts → inventory + ps.append(legacy_link_panel( + "SQL Server Hosts", + grid=(0, 34, 24, 7), + sql_dashboard=_LEGACY_UID, + note="Host-level inventory (IP/FQDN/domain) is only in the " + "SQLMonitor inventory DB.", + )) + + # SQL Server Availability Groups + ps.append(Panel( + title="SQL Server Availability Groups - Online", + description=("Per-AG replica count and distinct databases, " + "derived from mssql_aghealth__synchronization_health " + "labels."), + type="table", unit="short", + grid=(0, 41, 24, 9), + targets=[ + Target( + 'count by (ag_name, ag_listener) ' + '(mssql_aghealth__synchronization_health{instance=~"$Server"})', + legend="", ref="Replicas", instant=True, format="table"), + Target( + 'count by (ag_name, database_name) ' + '(mssql_aghealth__synchronization_health{instance=~"$Server"})', + legend="", ref="Dbs", instant=True, format="table"), + ], + transformations=[ + {"id": "merge", "options": {}}, + ], + )) + + # SQL Clusters → legacy (no cluster-topology metrics) + ps.append(legacy_link_panel( + "SQL Clusters", + grid=(0, 50, 24, 8), + sql_dashboard=_LEGACY_UID, + note="WSFC node / resource-group ownership is inventory-only.", + )) + + # Login Expiry → inventory + ps.append(legacy_link_panel( + "SQL Servers - Login Expiry", + grid=(0, 58, 24, 8), + sql_dashboard=_LEGACY_UID, + note="Login-expiry warnings come from the security-collection " + "SQL Agent job and are stored in the inventory DB.", + )) + + # Login Email Mapping → inventory + ps.append(legacy_link_panel( + "Login Email Mapping", + grid=(0, 66, 24, 8), + sql_dashboard=_LEGACY_UID, + note="dbo.login_email_mapping is an inventory-only lookup table.", + )) + + # Config Changes → inventory/lama + ps.append(legacy_link_panel( + "Config Changes", + grid=(0, 74, 24, 8), + sql_dashboard=_LEGACY_UID, + note="LAMA (Look-At-My-Analysis) config-change deltas come from " + "dbo.lama_computed_metrics — not exposed to Prometheus.", + )) + + return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/disk_space.py b/sql_exporter/Prometheus-Dashboards/_specs/disk_space.py new file mode 100644 index 0000000..866529d --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/_specs/disk_space.py @@ -0,0 +1,156 @@ +"""Spec for ``Disk Space`` Prometheus port (UID: prom_disk_space). + +SQL source dashboard has 5 data panels: + + 1. Table Disk Space - [$server] - [$perfmon_host_name] + → latest free/used/capacity per volume. + 2. Timeseries Used Disk Space - [$server] + → GB used per volume over time. + 3. Timeseries % Used Disk Space - [$server] + → percent used per volume over time. + 4. Table Db File Space Usage - [$server] - [$host_name] + → per database file: size, used, free (all MB). + 5. Timeseries Db File Size - Trend - [$server] - [$host_name] + → per database file size over time. + +Metric sources: + windows_logical_disk_{size,free}_bytes (1, 2, 3) + mssql_virtualfilestats__disk_{capacity,free,used}_mb (fallback for 1-3 + when windows_exporter is + unavailable on the host) + mssql_virtualfilestats__size_on_disk_bytes (4, 5) + mssql_database_file_size_bytes (4 - reported size) +""" +from prom_dashboard import Panel, Target, query_var + + +UID = "prom_disk_space" +TITLE = "Disk Space" +TAGS = ["mssql", "sqlmonitor", "Disk Space", "prometheus"] + + +def variables(): + return [ + query_var("Server", "label_values(mssql_up, instance)", + label="SQL Instance"), + query_var("perfmon_host_name", + 'label_values(mssql_service_info{instance="$Server"}, host_name)', + label="Perfmon Host Name", hide=2), + ] + + +def panels(): + ps: list[Panel] = [] + I = '{instance="$Server"}' + WI = '{instance="$Server"}' + + # 1. Latest Disk Space table (volume, capacity, free, used, % used) + ps.append(Panel( + title="Disk Space - [$Server] - [$perfmon_host_name]", + description=("Current capacity / free / used / % used per volume " + "from windows_exporter. Uses logical_disk metrics."), + type="table", unit="bytes", + grid=(0, 0, 24, 10), + targets=[ + Target(f"windows_logical_disk_size_bytes{WI}", + legend="{{volume}}", ref="Size", instant=True, format="table"), + Target(f"windows_logical_disk_free_bytes{WI}", + legend="{{volume}}", ref="Free", instant=True, format="table"), + Target( + f"windows_logical_disk_size_bytes{WI} " + f"- windows_logical_disk_free_bytes{WI}", + legend="{{volume}}", ref="Used", instant=True, format="table"), + Target( + f"100 * (windows_logical_disk_size_bytes{WI} " + f"- windows_logical_disk_free_bytes{WI}) " + f"/ clamp_min(windows_logical_disk_size_bytes{WI}, 1)", + legend="{{volume}}", ref="PctUsed", instant=True, format="table"), + ], + transformations=[ + {"id": "merge", "options": {}}, + {"id": "organize", "options": { + "excludeByName": {"Time": True, "__name__": True, + "job": True, "target": True}, + "renameByName": { + "volume": "Volume", + "instance": "Host", + "Value #Size": "Size (bytes)", + "Value #Free": "Free (bytes)", + "Value #Used": "Used (bytes)", + "Value #PctUsed": "% Used", + }, + }}, + ], + )) + + # 2. Used Disk Space over time (per volume) + ps.append(Panel( + title="Used Disk Space - [$Server] - [$perfmon_host_name]", + description="Used bytes per logical volume over time.", + type="timeseries", unit="bytes", + grid=(0, 10, 24, 12), + targets=[Target( + f"windows_logical_disk_size_bytes{WI} " + f"- windows_logical_disk_free_bytes{WI}", + legend="{{volume}}", ref="A")], + )) + + # 3. % Used Disk Space over time (per volume) + ps.append(Panel( + title="% Used Disk Space - [$Server] - [$perfmon_host_name]", + description="Percent used per logical volume over time.", + type="timeseries", unit="percent", + grid=(0, 22, 24, 12), + min_value=0, max_value=100, + targets=[Target( + f"100 * (windows_logical_disk_size_bytes{WI} " + f"- windows_logical_disk_free_bytes{WI}) " + f"/ clamp_min(windows_logical_disk_size_bytes{WI}, 1)", + legend="{{volume}}", ref="A")], + )) + + # 4. Db File Space Usage (per file: size, used, free MB) + ps.append(Panel( + title="Db File Space Usage - [$Server] - [$perfmon_host_name]", + description=("Per database file: allocated size, size on disk, " + "and computed free space. From " + "mssql_virtualfilestats__* and mssql_database_file_size_bytes."), + type="table", unit="bytes", + grid=(0, 34, 24, 16), + targets=[ + Target(f"mssql_database_file_size_bytes{I}", + legend="{{database}}/{{file_id}}", ref="Size", instant=True, + format="table"), + Target(f"mssql_virtualfilestats__size_on_disk_bytes{I}", + legend="{{database_name}}/{{file_logical_name}}", ref="OnDisk", + instant=True, format="table"), + ], + transformations=[ + {"id": "merge", "options": {}}, + {"id": "organize", "options": { + "excludeByName": {"Time": True, "__name__": True, + "job": True, "target": True}, + "renameByName": { + "database_name": "Database", + "file_logical_name": "Logical Name", + "file_location": "Physical Name", + "disk_volume": "Volume", + "Value #Size": "Allocated (bytes)", + "Value #OnDisk": "Size on Disk (bytes)", + }, + }}, + ], + )) + + # 5. Db File Size Trend (per file, over time) + ps.append(Panel( + title="Db File Size - Trend - [$Server] - [$perfmon_host_name]", + description="Per database file size_on_disk over time.", + type="timeseries", unit="bytes", + grid=(0, 50, 24, 16), + targets=[Target( + f"mssql_virtualfilestats__size_on_disk_bytes{I}", + legend="{{database_name}} / {{file_logical_name}}", ref="A")], + )) + + return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/monitoring_live_all_servers.py b/sql_exporter/Prometheus-Dashboards/_specs/monitoring_live_all_servers.py new file mode 100644 index 0000000..93e987f --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/_specs/monitoring_live_all_servers.py @@ -0,0 +1,291 @@ +"""Spec for ``Monitoring - Live - All Servers`` Prometheus port +(UID: prom_monitoring_live_all_servers). + +Source dashboard has 15 data panels covering: + + Basic Info, Collection Latency, OFFLINE instances/aliases, + SQLAgent service OFFLINE, Backup issues (non-AG + AG), + SQLMonitor Jobs attention list, Disk Utilization, + AlwaysOn Latency, Log/Tempdb space issues, + Alert History (aggregated + detail) and a Health Metrics table. + +Most of these aggregate across the whole fleet via the SQLMonitor +central DB. Panels that can be reconstructed from per-instance +Prometheus series use real PromQL; the inventory-join panels +(alert-history, alias/linked-server mapping) link back to the SQL +dashboard instead. +""" +from prom_dashboard import ( + Panel, Target, query_var, constant_var, legacy_link_panel, +) + + +UID = "prom_monitoring_live_all_servers" +TITLE = "Monitoring - Live - All Servers" +TAGS = ["mssql", "sqlmonitor", "Live", "All Servers", "prometheus"] +_LEGACY_UID = "monitoring-live-all-servers" + + +def variables(): + return [ + query_var("Server", "label_values(mssql_up, instance)", + label="SQL Instance", multi=True, include_all=True), + constant_var("full_threshold_days", "7"), + constant_var("diff_threshold_hours", "24"), + constant_var("tlog_threshold_minutes", "30"), + constant_var("disk_warning_pct", "80"), + constant_var("disk_critical_pct", "90"), + ] + + +def panels(): + ps: list[Panel] = [] + S = '{instance=~"$Server"}' + + # Summary stats row + ps.append(Panel( + title="Basic Info - Online", + description="Instances with mssql_up==1 matching the filter.", + type="stat", unit="short", + grid=(0, 0, 4, 4), + targets=[Target(f'sum(mssql_up{S} == 1)', legend="", ref="A", + instant=True)], + )) + ps.append(Panel( + title="OFFLINE Instances", + description="mssql_up==0.", + type="stat", unit="short", + grid=(4, 0, 4, 4), + thresholds_steps=[{"color": "green", "value": None}, + {"color": "red", "value": 1}], + targets=[Target(f'sum(mssql_up{S} == 0)', legend="", ref="A", + instant=True)], + )) + ps.append(Panel( + title="Disks - CRITICAL", + description=("Logical disks with >$disk_critical_pct% used, via " + "windows_logical_disk metrics."), + type="stat", unit="short", + grid=(8, 0, 4, 4), + thresholds_steps=[{"color": "green", "value": None}, + {"color": "red", "value": 1}], + targets=[Target( + f'count(100 * (1 - windows_logical_disk_free_bytes{S} ' + f'/ clamp_min(windows_logical_disk_size_bytes{S}, 1)) ' + f'> $disk_critical_pct)', + legend="", ref="A", instant=True)], + )) + ps.append(Panel( + title="Disks - WARNING", + description="Logical disks between warning and critical thresholds.", + type="stat", unit="short", + grid=(12, 0, 4, 4), + thresholds_steps=[{"color": "green", "value": None}, + {"color": "orange", "value": 1}], + targets=[Target( + f'count(100 * (1 - windows_logical_disk_free_bytes{S} ' + f'/ clamp_min(windows_logical_disk_size_bytes{S}, 1)) ' + f'> $disk_warning_pct < $disk_critical_pct)', + legend="", ref="A", instant=True)], + )) + ps.append(Panel( + title="Failed Jobs", + description="Jobs whose most recent completed run failed " + "(requires the mssql_sqlagent_jobs collector).", + type="stat", unit="short", + grid=(16, 0, 4, 4), + thresholds_steps=[{"color": "green", "value": None}, + {"color": "red", "value": 1}], + targets=[Target( + f'count(mssql_sqlagent_job__last_run_outcome{S} == 0)', + legend="", ref="A", instant=True)], + )) + ps.append(Panel( + title="Full Backups Overdue", + description="Databases with a Full backup older than " + "$full_threshold_days days.", + type="stat", unit="short", + grid=(20, 0, 4, 4), + thresholds_steps=[{"color": "green", "value": None}, + {"color": "red", "value": 1}], + targets=[Target( + f'count(mssql_backup__age_seconds{{instance=~"$Server",' + f'backup_type="D"}} > ($full_threshold_days * 86400))', + legend="", ref="A", instant=True)], + )) + + # Basic Details table + ps.append(Panel( + title="All Servers - Basic Details", + description="Per-instance mssql_service_info joined with mssql_up.", + type="table", unit="short", + grid=(0, 4, 24, 8), + targets=[ + Target(f'mssql_service_info{S}', legend="", ref="Info", + instant=True, format="table"), + Target(f'mssql_up{S}', legend="", ref="Up", + instant=True, format="table"), + ], + transformations=[{"id": "merge", "options": {}}], + )) + + # Servers with Data Collection Issues + ps.append(Panel( + title="Servers with Data Collection Issues", + description=("Instances whose last successful scrape is more " + "than 5 minutes old, based on scrape_samples_scraped " + "and the `up` metric."), + type="table", unit="short", + grid=(0, 12, 24, 8), + targets=[Target( + f'(time() - timestamp(up{S} == 1)) > 300', + legend="", ref="A", instant=True, format="table")], + )) + + # OFFLINE detail tables + ps.append(Panel( + title="CRITICAL - OFFLINE Instances", + description="Instances currently reporting mssql_up==0.", + type="table", unit="short", + grid=(0, 20, 12, 6), + targets=[Target(f'mssql_up{S} == 0', legend="", ref="A", + instant=True, format="table")], + )) + ps.append(legacy_link_panel( + "CRITICAL - OFFLINE Aliases", + grid=(12, 20, 12, 6), + sql_dashboard=_LEGACY_UID, + note="Alias-instance topology is stored in the inventory DB " + "(dbo.sql_instances.alias) — Prometheus labels only carry " + "the primary endpoint.", + )) + + # SQLAgent service offline (requires windows_exporter service probe) + ps.append(Panel( + title="SQLAgent Service OFFLINE", + description=("Instances where the SQL Agent Windows service is " + "not running (windows_service_state{name=~\"SQLSERVERAGENT.*\",state!=\"running\"})."), + type="table", unit="short", + grid=(0, 26, 24, 6), + targets=[Target( + 'windows_service_state{name=~"SQLSERVERAGENT.*",state!="running"} == 1', + legend="", ref="A", instant=True, format="table")], + )) + + # Backup issues + ps.append(Panel( + title="Backups - Non-AG Databases - Issues", + description=("Databases whose most recent Full/Diff/Log backup is " + "older than the configured thresholds. Driven by " + "mssql_backup__age_seconds."), + type="table", unit="short", + grid=(0, 32, 24, 8), + targets=[ + Target( + f'mssql_backup__age_seconds{{instance=~"$Server",' + f'backup_type="D"}} > ($full_threshold_days * 86400)', + legend="", ref="Full", instant=True, format="table"), + Target( + f'mssql_backup__age_seconds{{instance=~"$Server",' + f'backup_type="L"}} > ($tlog_threshold_minutes * 60)', + legend="", ref="Log", instant=True, format="table"), + ], + transformations=[{"id": "merge", "options": {}}], + )) + ps.append(legacy_link_panel( + "Backups - AG Databases - Issues", + grid=(0, 40, 24, 8), + sql_dashboard=_LEGACY_UID, + note="Distinguishing AG vs non-AG databases requires the " + "inventory DB. Use the SQL dashboard for the AG-split view.", + )) + + # SQLMonitor Jobs attention + ps.append(Panel( + title="SQLMonitor Jobs - Require Attention", + description=("SQL Agent jobs whose latest run did not succeed, or " + "whose next run is more than 12h overdue."), + type="table", unit="short", + grid=(0, 48, 24, 8), + targets=[Target( + f'mssql_sqlagent_job__last_run_outcome{S} != 1', + legend="", ref="A", instant=True, format="table")], + )) + + # Disk Space all servers + ps.append(Panel( + title="Disk Space - All Servers", + description="Per-volume % used across all selected instances.", + type="table", unit="percent", + grid=(0, 56, 24, 10), + targets=[Target( + f'100 * (1 - windows_logical_disk_free_bytes{S} ' + f'/ clamp_min(windows_logical_disk_size_bytes{S}, 1))', + legend="", ref="A", instant=True, format="table")], + )) + + # AlwaysOn Latency + ps.append(Panel( + title="All Servers - AlwaysOn Latency", + description=("Per-(replica, database) commit latency seconds " + "from mssql_aghealth__latency_seconds."), + type="table", unit="s", + grid=(0, 66, 24, 8), + targets=[Target( + f'mssql_aghealth__latency_seconds{S}', + legend="", ref="A", instant=True, format="table")], + )) + + # Log Space Consumers — legacy (requires Inventory + tempdb_log collector) + ps.append(legacy_link_panel( + "Log Space Consumers", + grid=(0, 74, 24, 8), + sql_dashboard=_LEGACY_UID, + note="log_space_consumers collector not yet ported to " + "Prometheus. Relies on dbo.log_space_consumers cache table.", + )) + ps.append(legacy_link_panel( + "TempDb Usage", + grid=(0, 82, 24, 8), + sql_dashboard=_LEGACY_UID, + note="tempdb_space_usage collector not yet ported.", + )) + + # Alert History + ps.append(legacy_link_panel( + "Alerts - Aggregated by Type", + grid=(0, 90, 12, 10), + sql_dashboard=_LEGACY_UID, + note="Alert history rows live in dbo.alert_history — accessible " + "only from the SQLMonitor inventory DB.", + )) + ps.append(legacy_link_panel( + "All Servers - Alert History", + grid=(12, 90, 12, 10), + sql_dashboard=_LEGACY_UID, + note="Same source as above (dbo.alert_history).", + )) + + # Health Metrics (last panel) + ps.append(Panel( + title="Servers Need Help - Health Metrics", + description=("Servers where any of the core health gauges is " + "outside the expected range: PLE < 300, or memory " + "grants pending > 0, or blocking > 0."), + type="table", unit="short", + grid=(0, 100, 24, 12), + targets=[ + Target( + f'mssql_perfmon__page_life_expectancy_seconds{S} < 300', + legend="", ref="PLE", instant=True, format="table"), + Target( + f'mssql_perfmon__memory_grants_pending{S} > 0', + legend="", ref="Grants", instant=True, format="table"), + Target( + f'mssql_perfmon__processes_blocked{S} > 0', + legend="", ref="Blocked", instant=True, format="table"), + ], + transformations=[{"id": "merge", "options": {}}], + )) + + return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/monitoring_live_distributed.py b/sql_exporter/Prometheus-Dashboards/_specs/monitoring_live_distributed.py new file mode 100644 index 0000000..3198909 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/_specs/monitoring_live_distributed.py @@ -0,0 +1,475 @@ +"""Spec for ``Monitoring - Live - Distributed`` Prometheus port +(UID: prom_monitoring_live_distributed). + +Source dashboard has 60 data panels across 22 rows covering OS, SQL +instance and AlwaysOn state for a *single* server selected via +``$Server``. The layout mirrors the original dashboard row-for-row; +panels map to: + + OS / Host metrics → windows_exporter + mssql_service_info + SQL Server state → mssql_standard + mssql_dba_cached + WhoIsActive / blocking → mssql_whoisactive__* (mssql_dba_whoisactive) + AlwaysOn → mssql_aghealth__* + Disk / Wait stats → windows_logical_disk_* / mssql_waits__* + Perfmon trends → mssql_perfmon__* + +Panels that depend on the SQLMonitor cache tables (Server/Database +config change history, sqlagent job activity detail with duration +history, tempdb_space / log_space consumers, Lead Blockers rolled-up +tables) use ``legacy_link_panel`` so they remain visible without +pretending that inventory data has been ported to Prometheus. +""" +from prom_dashboard import ( + Panel, Target, query_var, constant_var, legacy_link_panel, row, +) + + +UID = "prom_monitoring_live_distributed" +TITLE = "Monitoring - Live - Distributed" +TAGS = ["mssql", "sqlmonitor", "Live", "Distributed", "prometheus"] +_LEGACY_UID = "monitoring-live-distributed" + + +def variables(): + return [ + query_var("Server", "label_values(mssql_up, instance)", + label="SQL Instance"), + constant_var("blocked_threshold_seconds", "30"), + constant_var("memory_grant_threshold_mb", "100"), + ] + + +def _stat(title, expr, grid, unit="short", decimals=0, + description="", thresholds=None): + return Panel( + title=title, type="stat", unit=unit, decimals=decimals, + description=description, grid=grid, + thresholds_steps=thresholds, + targets=[Target(expr, legend="", ref="A", instant=True)], + ) + + +def panels(): + ps: list[Panel] = [] + S = '{instance="$Server"}' + + # ==== Row 1: OS Info stat tiles ==== + ps.append(_stat("Memory Model", + f'mssql_service_info{S}', (0, 0, 2, 2), + description="Memory model reported by mssql_service_info.")) + ps.append(_stat("Memory Status", + f'windows_memory_available_bytes{S} > 0', (2, 0, 2, 2), + description="1 when OS reports available memory.")) + ps.append(_stat("OS Uptime", + f'windows_system_system_up_time{S}', + (4, 0, 3, 2), unit="s", + description="Seconds since OS boot (windows_exporter).")) + ps.append(_stat("OS Processes", + f'windows_system_processes{S}', (7, 0, 4, 2))) + ps.append(_stat("OS CPU %", + f'100 - (avg without(cpu,mode) ' + f'(rate(windows_cpu_time_total{{instance="$Server",' + f'mode="idle"}}[$__rate_interval])) * 100)', + (11, 0, 3, 3), unit="percent", decimals=1)) + ps.append(_stat("Idle CPU %", + f'avg without(cpu,mode) ' + f'(rate(windows_cpu_time_total{{instance="$Server",' + f'mode="idle"}}[$__rate_interval])) * 100', + (14, 0, 3, 3), unit="percent", decimals=1)) + ps.append(_stat("PLE", + f'mssql_perfmon__page_life_expectancy_seconds{S}', + (17, 0, 2, 3), unit="s", + thresholds=[{"color": "red", "value": None}, + {"color": "green", "value": 300}])) + ps.append(Panel( + title="AG Details", + description="Replica/DB sync state from mssql_aghealth__*.", + type="table", unit="short", + grid=(19, 0, 5, 5), + targets=[Target( + f'mssql_aghealth__synchronization_health{S}', + legend="", ref="A", instant=True, format="table")], + )) + ps.append(_stat("Box Memory", + f'windows_cs_physical_memory_bytes{S}', + (0, 3, 2, 3), unit="bytes")) + ps.append(_stat("Available Memory", + f'windows_memory_available_bytes{S}', + (2, 3, 2, 3), unit="bytes")) + ps.append(_stat("CPU (OS/SQL)", + f'mssql_sqlserver_cpu_count{S}', + (8, 3, 3, 3))) + ps.append(_stat("Processor", + f'windows_cs_logical_processors{S}', + (11, 4, 5, 2))) + ps.append(_stat("Machine Type", + f'windows_cs_hypervisor{S}', + (16, 4, 3, 2), + description="1 if hypervisor detected (VM).")) + + # ==== Row 2: Live Metrics ==== + ps.append(row("LIVE Metrics - [$Server]", y=6)) + ps.append(_stat( + "Blocked > $blocked_threshold_seconds s", + f'sum(mssql_whoisactive__avg_elapsed_time{{instance="$Server",' + f'blocked_session_count!="0"}} > $blocked_threshold_seconds) or ' + f'vector(0)', + (0, 7, 3, 3), + thresholds=[{"color": "green", "value": None}, + {"color": "red", "value": 1}])) + ps.append(_stat("SQL Used Memory", + f'mssql_perfmon__total_server_memory_bytes{S}', + (3, 7, 2, 3), unit="bytes")) + ps.append(_stat("Allocated M/r %", + f'100 * mssql_perfmon__total_server_memory_bytes{S} ' + f'/ clamp_min(mssql_perfmon__target_server_memory_bytes{S}, 1)', + (5, 7, 2, 3), unit="percent", decimals=1)) + ps.append(_stat("Connections", + f'mssql_perfmon__user_connections{S}', + (7, 7, 2, 3))) + ps.append(_stat("Active Requests", + f'mssql_sqlserver_active_requests{S}', + (9, 7, 2, 3))) + ps.append(_stat("SQL CPU %", + f'mssql_cpu_utilization__sql_cpu_utilization{S}', + (11, 7, 3, 3), unit="percent", decimals=1)) + ps.append(_stat("IsHadrEnabled", + f'mssql_sqlserver_is_hadr_enabled{S}', + (14, 7, 2, 3))) + ps.append(_stat("IsClustered", + f'mssql_sqlserver_is_clustered{S}', + (16, 7, 2, 3))) + ps.append(_stat("SQL Version", + f'mssql_service_info{S}', (18, 7, 6, 3), + description="Value is 1; label `product_version` holds the version string.")) + + ps.append(_stat("Longest Blocking (s)", + f'max(mssql_whoisactive__avg_elapsed_time{S}) or vector(0)', + (0, 10, 3, 3), unit="s")) + ps.append(_stat("Memory Grants Pending", + f'mssql_perfmon__memory_grants_pending{S}', + (3, 10, 3, 3), + thresholds=[{"color": "green", "value": None}, + {"color": "red", "value": 1}])) + ps.append(_stat("Page Faults/sec", + f'rate(windows_memory_page_faults_total{S}[$__rate_interval])', + (6, 10, 3, 3))) + ps.append(_stat("% User Mode", + f'avg without(cpu) (rate(windows_cpu_time_total' + f'{{instance="$Server",mode="user"}}[$__rate_interval])) * 100', + (9, 10, 3, 3), unit="percent", decimals=1)) + ps.append(_stat("Disk Latency (avg ms)", + f'avg(rate(windows_logical_disk_read_seconds_total{S}[$__rate_interval]) ' + f'/ clamp_min(rate(windows_logical_disk_reads_total{S}[$__rate_interval]), 1) ' + f'* 1000)', + (12, 10, 3, 3), unit="ms", decimals=1)) + ps.append(_stat("Waits / Core / Minute", + f'60 * sum(rate(mssql_waits__wait_time_seconds{S}[$__rate_interval])) ' + f'/ clamp_min(mssql_sqlserver_cpu_count{S}, 1)', + (15, 10, 3, 3), unit="short", decimals=1)) + ps.append(_stat("SQL Uptime", + f'mssql_sqlserver_uptime_seconds{S}', + (18, 10, 3, 3), unit="s")) + ps.append(_stat("SQL Start Time UTC", + f'time() - mssql_sqlserver_uptime_seconds{S}', + (21, 10, 3, 3), unit="dateTimeAsIso")) + + # Patch details + ps.append(legacy_link_panel( + "SQL Server Patching Details", + grid=(0, 13, 24, 4), + sql_dashboard=_LEGACY_UID, + note="CU/KB/patch history is stored in the inventory DB " + "(dbo.sql_server_patching) — not a Prometheus metric.")) + + # ==== AlwaysOn AG Status ==== + ps.append(row("AlwaysOn Availability Groups - Status", y=17)) + ps.append(Panel( + title="AlwaysOn Availability Group Health Metrics", + description="Per-(replica, database) AG health: state / queues / " + "rates / latency, from mssql_aghealth__*.", + type="table", unit="short", grid=(0, 18, 24, 9), + targets=[ + Target(f'mssql_aghealth__synchronization_health{S}', + legend="", ref="Health", instant=True, format="table"), + Target(f'mssql_aghealth__latency_seconds{S}', + legend="", ref="Lat", instant=True, format="table"), + Target(f'mssql_aghealth__log_send_queue_size{S}', + legend="", ref="LSQ", instant=True, format="table"), + Target(f'mssql_aghealth__redo_queue_size{S}', + legend="", ref="RQ", instant=True, format="table"), + ], + transformations=[{"id": "merge", "options": {}}], + )) + + # ==== CPU Trend ==== + ps.append(row("Trend - CPU Utilization", y=27)) + ps.append(Panel( + title="CPU %", type="timeseries", unit="percent", + description="SQL vs OS CPU from ring-buffer metrics.", + grid=(0, 28, 24, 8), + targets=[ + Target(f'mssql_cpu_utilization__sql_cpu_utilization{S}', + legend="SQL CPU", ref="Sql"), + Target(f'mssql_cpu_utilization__system_idle_process{S}', + legend="Idle", ref="Idle"), + Target(f'100 - mssql_cpu_utilization__system_idle_process{S}', + legend="OS CPU", ref="Os"), + ], + min_value=0, max_value=100, + )) + ps.append(Panel( + title="OS Processes CPU Utilization", type="timeseries", + description="Per-process CPU from windows_exporter.", + unit="percent", grid=(0, 36, 24, 8), + targets=[Target( + f'topk(10, rate(windows_process_cpu_time_total{S}[$__rate_interval]) * 100)', + legend="{{process}}", ref="A")], + )) + + # ==== Memory Trend ==== + ps.append(row("Trend - Memory Utilization", y=44)) + ps.append(Panel( + title="SQL Server Process Memory", type="timeseries", unit="bytes", + description="mssql_perfmon__total_server_memory_bytes and " + "target_server_memory_bytes.", + grid=(0, 45, 24, 10), + targets=[ + Target(f'mssql_perfmon__total_server_memory_bytes{S}', + legend="Total Server Memory", ref="Total"), + Target(f'mssql_perfmon__target_server_memory_bytes{S}', + legend="Target Server Memory", ref="Target"), + ], + )) + ps.append(Panel( + title="OS Processes Memory Utilization", type="timeseries", + unit="bytes", + description="Top 10 processes by working-set memory.", + grid=(0, 55, 24, 10), + targets=[Target( + f'topk(10, windows_process_working_set_bytes{S})', + legend="{{process}}", ref="A")], + )) + + # ==== Config Changes (legacy) ==== + ps.append(row("Server & Database Config Changes", y=65)) + ps.append(legacy_link_panel( + "Server Configuration Changes", grid=(0, 66, 24, 8), + sql_dashboard=_LEGACY_UID, + note="dbo.server_config_history (LAMA) is inventory-only.")) + ps.append(legacy_link_panel( + "Database Configuration Changes", grid=(0, 74, 24, 8), + sql_dashboard=_LEGACY_UID, + note="dbo.database_config_history is inventory-only.")) + + # ==== Blocking Tree (WhoIsActive) ==== + ps.append(row("Blocking Tree - ACTIVE", y=82)) + ps.append(Panel( + title="Blocking Details - ACTIVE - [sp_WhoIsActive]", + description="Live blocking info from mssql_whoisactive.", + type="table", unit="short", grid=(0, 83, 24, 8), + targets=[Target( + f'mssql_whoisactive__start_time{{instance="$Server",' + f'blocked_session_count!="0"}}', + legend="", ref="A", instant=True, format="table")], + )) + + # ==== Lead Blockers ==== + ps.append(row("Lead Blockers", y=91)) + ps.append(Panel( + title="Lead Blockers - Logins - Blocked Count", + description="Count of blocked sessions grouped by login_name " + "from mssql_whoisactive.", + type="timeseries", unit="short", grid=(0, 92, 24, 11), + targets=[Target( + f'count by (login_name) (' + f'mssql_whoisactive__blocking_session_id{{instance="$Server",' + f'blocked_session_count!="0"}})', + legend="{{login_name}}", ref="A")], + )) + ps.append(Panel( + title="Lead Blockers - Programs - Blocked Count", + description="Blocked sessions grouped by program_name.", + type="timeseries", unit="short", grid=(0, 103, 24, 11), + targets=[Target( + f'count by (program_name) (' + f'mssql_whoisactive__blocking_session_id{{instance="$Server",' + f'blocked_session_count!="0"}})', + legend="{{program_name}}", ref="A")], + )) + + # ==== Memory Grants Pending ==== + ps.append(row("Trend - Memory Grants Pending", y=114)) + ps.append(Panel( + title="Memory Grants Pending", type="timeseries", unit="short", + description="mssql_perfmon__memory_grants_pending — anything >0 " + "indicates grant pressure.", + grid=(0, 115, 24, 7), + targets=[Target(f'mssql_perfmon__memory_grants_pending{S}', + legend="pending grants", ref="A")], + )) + + # ==== Memory Consumers ==== + ps.append(row("Memory Consumers - ACTIVE", y=122)) + ps.append(Panel( + title="Memory Consumers Over $memory_grant_threshold_mb MB", + description="Sessions holding memory grants above the threshold.", + type="table", unit="short", grid=(0, 123, 24, 11), + targets=[Target( + f'mssql_whoisactive__memory_info{{instance="$Server"}}', + legend="", ref="A", instant=True, format="table")], + )) + + # ==== TempdbSaver / LogSaver (legacy) ==== + ps.append(row("TempdbSaver - Latest", y=134)) + ps.append(legacy_link_panel( + "TempdbSaver - tempdb_space_usage", grid=(0, 135, 12, 4), + sql_dashboard=_LEGACY_UID, + note="tempdb_space_usage collector is not yet ported.")) + ps.append(legacy_link_panel( + "TempdbSaver - tempdb_space_consumers", grid=(12, 135, 12, 4), + sql_dashboard=_LEGACY_UID, + note="tempdb_space_consumers collector is not yet ported.")) + ps.append(row("LogSaver - Latest", y=139)) + ps.append(legacy_link_panel( + "LogSaver - log_space_consumers", grid=(0, 140, 24, 8), + sql_dashboard=_LEGACY_UID, + note="log_space_consumers collector is not yet ported.")) + + # ==== Connections / Winsock Rejections ==== + ps.append(row("SQL Connections & Winsock Rejections", y=148)) + ps.append(Panel( + title="microsoft winsock bsp -> rejected connections/sec", + type="timeseries", unit="short", + description="Winsock BSP rejected connections; counter delta.", + grid=(0, 149, 24, 8), + targets=[Target( + f'rate(windows_net_packets_outbound_errors_total{S}[$__rate_interval])', + legend="{{nic}}", ref="A")], + )) + + # ==== Long Running Queries ==== + ps.append(row("Long Running Queries", y=157)) + ps.append(Panel( + title="WhoIsActive Data", type="table", unit="short", + description="Current sp_WhoIsActive snapshot from mssql_whoisactive.", + grid=(0, 158, 24, 9), + targets=[Target( + f'mssql_whoisactive__start_time{{instance="$Server"}}', + legend="", ref="A", instant=True, format="table")], + )) + + # ==== Page Life Expectancy ==== + ps.append(row("Trend - Page Life Expectancy", y=167)) + ps.append(Panel( + title="Page Life Expectancy", type="timeseries", unit="s", + grid=(0, 168, 24, 10), + targets=[Target( + f'mssql_perfmon__page_life_expectancy_seconds{S}', + legend="PLE (s)", ref="A")], + )) + + # ==== Batch Request/sec ==== + ps.append(row("Trend - Batch Request/Sec", y=178)) + ps.append(Panel( + title="Batch Requests Per Second", type="timeseries", unit="short", + grid=(0, 179, 24, 7), + targets=[Target( + f'rate(mssql_perfmon__batch_requests_total{S}[$__rate_interval])', + legend="batch req/s", ref="A")], + )) + + # ==== Connection Distribution ==== + ps.append(row("SQL Connections - Distribution", y=186)) + ps.append(Panel( + title="Connections by Interface", type="table", unit="short", + description="Connections grouped by net_transport / auth_scheme.", + grid=(0, 187, 8, 6), + targets=[Target( + f'count by (net_transport) (' + f'mssql_whoisactive__start_time{{instance="$Server"}})', + legend="", ref="A", instant=True, format="table")], + )) + ps.append(Panel( + title="Host Connections", type="table", unit="short", + grid=(8, 187, 8, 12), + targets=[Target( + f'count by (host_name) (' + f'mssql_whoisactive__start_time{{instance="$Server"}})', + legend="", ref="A", instant=True, format="table")], + )) + ps.append(Panel( + title="Login Connections", type="table", unit="short", + grid=(16, 187, 8, 12), + targets=[Target( + f'count by (login_name) (' + f'mssql_whoisactive__start_time{{instance="$Server"}})', + legend="", ref="A", instant=True, format="table")], + )) + ps.append(Panel( + title="Connections By Status", type="table", unit="short", + grid=(0, 193, 8, 6), + targets=[Target( + f'count by (status) (' + f'mssql_whoisactive__start_time{{instance="$Server"}})', + legend="", ref="A", instant=True, format="table")], + )) + + # ==== Running Jobs / WhoIsActive latest ==== + ps.append(row("Running Jobs & Maintenance Workloads", y=199)) + ps.append(Panel( + title="WhoIsActive Latest Captured Data", type="table", unit="short", + grid=(0, 200, 24, 8), + targets=[Target( + f'mssql_whoisactive__start_time{{instance="$Server"}}', + legend="", ref="A", instant=True, format="table")], + )) + + # ==== SQL Agent Job Activity ==== + ps.append(row("SQLAgent Job Activity Monitor - [$Server]", y=208)) + ps.append(Panel( + title="Job Activity Monitor", + description="SQL Agent jobs for this instance — outcome / duration " + "/ running state from mssql_sqlagent_job__*.", + type="table", unit="short", grid=(0, 209, 24, 16), + targets=[ + Target(f'mssql_sqlagent_job__enabled{S}', legend="", + ref="En", instant=True, format="table"), + Target(f'mssql_sqlagent_job__last_run_outcome{S}', legend="", + ref="Out", instant=True, format="table"), + Target(f'mssql_sqlagent_job__last_run_duration_seconds{S}', + legend="", ref="Dur", instant=True, format="table"), + Target(f'mssql_sqlagent_job__is_running{S}', legend="", + ref="Run", instant=True, format="table"), + ], + transformations=[{"id": "merge", "options": {}}], + )) + + # ==== Disk Space ==== + ps.append(row("Disk Space - [$Server]", y=225)) + ps.append(Panel( + title="Disk Space Utilization", type="table", unit="bytes", + description="Per-volume size / free / used from windows_exporter.", + grid=(0, 226, 24, 16), + targets=[ + Target(f'windows_logical_disk_size_bytes{S}', legend="", + ref="Size", instant=True, format="table"), + Target(f'windows_logical_disk_free_bytes{S}', legend="", + ref="Free", instant=True, format="table"), + ], + transformations=[{"id": "merge", "options": {}}], + )) + + # ==== WaitStats ==== + ps.append(row("WaitStats", y=242)) + ps.append(Panel( + title="[${Server}] - WaitStats", type="timeseries", unit="s", + description="rate(mssql_waits__wait_time_seconds) per wait_type.", + grid=(0, 243, 24, 15), + targets=[Target( + f'topk(20, sum by (wait_type) (' + f'rate(mssql_waits__wait_time_seconds{S}[$__rate_interval])))', + legend="{{wait_type}}", ref="A")], + )) + + return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/monitoring_perfmon_quest.py b/sql_exporter/Prometheus-Dashboards/_specs/monitoring_perfmon_quest.py new file mode 100644 index 0000000..78fb6f9 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/_specs/monitoring_perfmon_quest.py @@ -0,0 +1,421 @@ +"""Spec for ``Monitoring - Perfmon Counters - Quest Softwares - Distributed`` +Prometheus port (UID: prom_monitoring_perfmon_quest). + +The source dashboard is a 53-timeseries perfmon catalogue for a single +server. Every panel maps to either ``mssql_perfmon__*`` (from +mssql_standard / mssql_dba_cached) or ``windows_*`` (from +windows_exporter). Rows that rely on the SQLMonitor dbo.os_task_list +cache table or dbo.memory_clerks snapshot are rendered as +``legacy_link_panel`` so every source row is accounted for. +""" +from prom_dashboard import ( + Panel, Target, query_var, legacy_link_panel, row, +) + + +UID = "prom_monitoring_perfmon_quest" +TITLE = "Monitoring - Perfmon Counters - Quest Softwares - Distributed" +TAGS = ["mssql", "sqlmonitor", "Perfmon", "Quest", "prometheus"] +_LEGACY_UID = "monitoring-perfmon-counters-quest-softwares-distributed" + + +def variables(): + return [ + query_var("Server", "label_values(mssql_up, instance)", + label="SQL Instance"), + query_var("database", + 'label_values(mssql_perfmon__log_bytes_flushed_total{instance="$Server"}, database_name)', + label="Database", multi=True, include_all=True), + query_var("disk_drive", + 'label_values(windows_logical_disk_size_bytes{instance="$Server"}, volume)', + label="Disk", multi=True, include_all=True), + ] + + +def _ts(title, exprs_legend, grid, unit="short", description=""): + return Panel( + title=title, type="timeseries", unit=unit, + description=description, grid=grid, + targets=[Target(e, legend=l, ref=chr(65 + i)) + for i, (e, l) in enumerate(exprs_legend)], + ) + + +def panels(): + ps: list[Panel] = [] + S = '{instance="$Server"}' + Sd = '{instance="$Server",database_name=~"$database"}' + Svol = '{instance="$Server",volume=~"$disk_drive"}' + rate = "$__rate_interval" + + y = 0 + # 1. CPU & Processor + ps.append(row("CPU & Processor", y)); y += 1 + ps.append(_ts("%Processor Time (SQL Server)", + [(f'mssql_cpu_utilization__sql_cpu_utilization{S}', + 'SQL CPU'), + (f'100 - mssql_cpu_utilization__system_idle_process{S}', + 'OS CPU')], + (0, y, 24, 7), unit="percent", + description="SQL vs OS CPU %.")); y += 7 + ps.append(_ts("System: Processor Queue Length", + [(f'windows_system_processor_queue_length{S}', + 'queue length')], + (0, y, 24, 5))); y += 5 + + # 2. OS Memory & Paging + ps.append(row("OS Memory & Paging Performance Counters", y)); y += 1 + ps.append(_ts("Memory - Available Mbytes", + [(f'windows_memory_available_bytes{S} / 1024 / 1024', + 'Available MB')], + (0, y, 24, 6), unit="decmbytes")); y += 6 + ps.append(_ts("Memory - Pages Input/sec, Pages/sec", + [(f'rate(windows_memory_swap_page_operations_total{S}[{rate}])', + 'Pages/sec'), + (f'rate(windows_memory_swap_page_reads_total{S}[{rate}])', + 'Pages Input/sec')], + (0, y, 24, 11))); y += 11 + ps.append(_ts("Paging File Usage", + [(f'windows_paging_file_usage_percent{S}', 'usage %')], + (0, y, 24, 7), unit="percent")); y += 7 + + # 3. SQL Server: Memory Manager + ps.append(row("SQL Server: Memory Manager Counters", y)); y += 1 + ps.append(_ts("SQL Server Process Memory", + [(f'mssql_perfmon__total_server_memory_bytes{S}', + 'Total Server Memory'), + (f'mssql_perfmon__target_server_memory_bytes{S}', + 'Target Server Memory')], + (0, y, 24, 11), unit="bytes")); y += 11 + ps.append(_ts("SQL Server: Memory Manager", + [(f'mssql_perfmon__memory_grants_pending{S}', + 'Memory Grants Pending'), + (f'mssql_perfmon__memory_grants_outstanding{S}', + 'Memory Grants Outstanding')], + (0, y, 24, 11))); y += 11 + ps.append(_ts("Memory Grants", + [(f'mssql_perfmon__memory_grants_pending{S}', 'pending'), + (f'mssql_perfmon__memory_grants_outstanding{S}', + 'outstanding')], + (0, y, 24, 8))); y += 8 + + # 4. MSSQL Data Access + ps.append(row("MSSQL Data Access Performance Counters", y)); y += 1 + ps.append(_ts("Batch Requests/sec", + [(f'rate(mssql_perfmon__batch_requests_total{S}[{rate}])', + 'Batch Req/sec')], + (0, y, 24, 6))); y += 6 + ps.append(_ts("SQLServer:Access Methods", + [(f'rate(mssql_perfmon__page_splits_total{S}[{rate}])', + 'Page Splits/sec'), + (f'rate(mssql_perfmon__full_scans_total{S}[{rate}])', + 'Full Scans/sec'), + (f'rate(mssql_perfmon__index_searches_total{S}[{rate}])', + 'Index Searches/sec'), + (f'rate(mssql_perfmon__forwarded_records_total{S}[{rate}])', + 'Forwarded Records/sec')], + (0, y, 24, 15))); y += 15 + Svol = '{instance="$Server",volume=~"$disk_drive"}' + Sd = '{instance="$Server",database_name=~"$database"}' + _extend_disk_network(ps, S, Sd, Svol, rate, y) + return ps + + +def _extend_disk_network(ps, S, Sd, Svol, rate, y): + # 5. Logical Disk + ps.append(row("Logical Disk Counters", y)); y += 1 + ps.append(_ts("Logical Disk (Disk Queue Length)", + [(f'windows_logical_disk_avg_read_requests_queued{Svol}', + 'read queue {{volume}}'), + (f'windows_logical_disk_avg_write_requests_queued{Svol}', + 'write queue {{volume}}')], + (0, y, 24, 5))); y += 5 + ps.append(_ts("Logical Disk - Latency (ms)", + [(f'1000 * rate(windows_logical_disk_read_seconds_total{Svol}[{rate}]) ' + f'/ clamp_min(rate(windows_logical_disk_reads_total{Svol}[{rate}]), 1)', + 'read ms {{volume}}'), + (f'1000 * rate(windows_logical_disk_write_seconds_total{Svol}[{rate}]) ' + f'/ clamp_min(rate(windows_logical_disk_writes_total{Svol}[{rate}]), 1)', + 'write ms {{volume}}')], + (0, y, 24, 6), unit="ms")); y += 6 + ps.append(_ts("Logical Disk - IOPS", + [(f'rate(windows_logical_disk_reads_total{Svol}[{rate}])', + 'reads/s {{volume}}'), + (f'rate(windows_logical_disk_writes_total{Svol}[{rate}])', + 'writes/s {{volume}}')], + (0, y, 24, 8), unit="ops")); y += 8 + ps.append(_ts("Logical Disk - Throughput", + [(f'rate(windows_logical_disk_read_bytes_total{Svol}[{rate}])', + 'read B/s {{volume}}'), + (f'rate(windows_logical_disk_write_bytes_total{Svol}[{rate}])', + 'write B/s {{volume}}')], + (0, y, 24, 7), unit="Bps")); y += 7 + + # 6. Physical Disk + ps.append(row("Physical Disk Counters", y)); y += 1 + ps.append(_ts("Physical Disk (Disk Queue Length)", + [(f'windows_physical_disk_avg_read_requests_queued{S}', + 'read queue {{disk}}'), + (f'windows_physical_disk_avg_write_requests_queued{S}', + 'write queue {{disk}}')], + (0, y, 24, 5))); y += 5 + ps.append(_ts("Physical Disk - Latency (ms)", + [(f'1000 * rate(windows_physical_disk_read_seconds_total{S}[{rate}]) ' + f'/ clamp_min(rate(windows_physical_disk_reads_total{S}[{rate}]), 1)', + 'read ms {{disk}}'), + (f'1000 * rate(windows_physical_disk_write_seconds_total{S}[{rate}]) ' + f'/ clamp_min(rate(windows_physical_disk_writes_total{S}[{rate}]), 1)', + 'write ms {{disk}}')], + (0, y, 24, 6), unit="ms")); y += 6 + ps.append(_ts("Physical Disk - Throughput", + [(f'rate(windows_physical_disk_read_bytes_total{S}[{rate}])', + 'read B/s {{disk}}'), + (f'rate(windows_physical_disk_write_bytes_total{S}[{rate}])', + 'write B/s {{disk}}')], + (0, y, 24, 7), unit="Bps")); y += 7 + ps.append(_ts("Physical Disk - IOPS", + [(f'rate(windows_physical_disk_reads_total{S}[{rate}])', + 'reads/s {{disk}}'), + (f'rate(windows_physical_disk_writes_total{S}[{rate}])', + 'writes/s {{disk}}')], + (0, y, 24, 8), unit="ops")); y += 8 + + # 7. Network + ps.append(row("Network Interface Counters", y)); y += 1 + ps.append(_ts("Network Interface - Bytes Total/sec", + [(f'rate(windows_net_bytes_total{S}[{rate}])', + '{{nic}}')], + (0, y, 24, 7), unit="Bps")); y += 7 + + # 8. MSSQL Databases - Size + ps.append(row("MSSQL Databases - Size Counters", y)); y += 1 + ps.append(_ts("SQLServer:Databases - Log File Size", + [(f'mssql_perfmon__log_file_used_size_kb{Sd} * 1024', + '{{database_name}} log used (B)'), + (f'mssql_perfmon__log_file_size_kb{Sd} * 1024', + '{{database_name}} log size (B)')], + (0, y, 24, 15), unit="bytes")); y += 15 + ps.append(_ts("SQLServer:Databases - Data File Size", + [(f'mssql_perfmon__data_file_size_kb{Sd} * 1024', + '{{database_name}} data (B)')], + (0, y, 24, 12), unit="bytes")); y += 12 + + _extend_sql_statistics(ps, S, Sd, rate, y) + + +def _extend_sql_statistics(ps, S, Sd, rate, y): + # 9. User Database Performance + ps.append(row("MSSQL User Database - Performance Counters", y)); y += 1 + ps.append(_ts("SqlServer:Databases - Log Bytes Flushed/sec", + [(f'rate(mssql_perfmon__log_bytes_flushed_total{Sd}[{rate}])', + '{{database_name}}')], + (0, y, 24, 9), unit="Bps")); y += 9 + ps.append(_ts("SqlServer:Databases - Log Flush Wait Time", + [(f'rate(mssql_perfmon__log_flush_wait_time_ms_total{Sd}[{rate}])', + '{{database_name}}')], + (0, y, 24, 10), unit="ms")); y += 10 + ps.append(_ts("SqlServer:Databases - Others", + [(f'rate(mssql_perfmon__transactions_total{Sd}[{rate}])', + 'tx/s {{database_name}}'), + (f'rate(mssql_perfmon__write_transactions_total{Sd}[{rate}])', + 'write-tx/s {{database_name}}')], + (0, y, 24, 15))); y += 15 + + # 10. SQL Statistics — Auto Parameterization + ps.append(row("SQL Server - SQL Statistics - Auto Parameterization", y)) + y += 1 + ps.append(_ts("SQLServer:SQL Statistics - Auto Parameterization", + [(f'rate(mssql_perfmon__auto_param_attempts_total{S}[{rate}])', + 'auto-param attempts/s'), + (f'rate(mssql_perfmon__failed_auto_params_total{S}[{rate}])', + 'failed auto-params/s'), + (f'rate(mssql_perfmon__safe_auto_params_total{S}[{rate}])', + 'safe auto-params/s')], + (0, y, 24, 10))); y += 10 + + # 11. Buffer Manager & Memory + ps.append(row("MSSQL Buffer Manager & Memory Performance Counters", y)) + y += 1 + ps.append(_ts("Batch Requests/sec", + [(f'rate(mssql_perfmon__batch_requests_total{S}[{rate}])', + 'batch req/s')], + (0, y, 24, 6))); y += 6 + ps.append(_ts("Page Life Expectancy", + [(f'mssql_perfmon__page_life_expectancy_seconds{S}', 'PLE')], + (0, y, 24, 7), unit="s")); y += 7 + ps.append(_ts("SQLServer:Buffer Manager", + [(f'mssql_perfmon__buffer_cache_hit_ratio{S}', + 'buffer cache hit %'), + (f'rate(mssql_perfmon__page_reads_total{S}[{rate}])', + 'page reads/s'), + (f'rate(mssql_perfmon__page_writes_total{S}[{rate}])', + 'page writes/s'), + (f'rate(mssql_perfmon__lazy_writes_total{S}[{rate}])', + 'lazy writes/s')], + (0, y, 24, 17))); y += 17 + + # 12. Memory Consumers (legacy) + ps.append(row("Memory Consumers - sys.dm_os_memory_clerks", y)); y += 1 + ps.append(legacy_link_panel( + "Memory Consumers", grid=(0, y, 24, 13), + sql_dashboard=_LEGACY_UID, + note="dm_os_memory_clerks snapshot is cached in the SQLMonitor " + "memory_clerks table and is not exposed as a Prometheus metric.", + )); y += 13 + + # 13. "How is My Memory Being Used" + ps.append(row("MSSQL Memory Breakdown Counters", y)); y += 1 + ps.append(_ts("SQLServer:Memory Manager - Connection/Lock/Opt", + [(f'mssql_perfmon__connection_memory_kb{S} * 1024', + 'connection mem (B)'), + (f'mssql_perfmon__lock_memory_kb{S} * 1024', + 'lock mem (B)'), + (f'mssql_perfmon__optimizer_memory_kb{S} * 1024', + 'optimizer mem (B)')], + (0, y, 24, 9), unit="bytes")); y += 9 + ps.append(_ts("SQLServer:Memory Manager - Granted Workspace", + [(f'mssql_perfmon__granted_workspace_memory_kb{S} * 1024', + 'granted workspace (B)'), + (f'mssql_perfmon__reserved_server_memory_kb{S} * 1024', + 'reserved server mem (B)')], + (0, y, 24, 12), unit="bytes")); y += 12 + + _extend_workload(ps, S, rate, y) + + +def _extend_workload(ps, S, rate, y): + # 14. Workload + ps.append(row("MSSQL Workload Performance Counters", y)); y += 1 + ps.append(_ts("SQLServer:SQL Statistics - CPU Stuff", + [(f'rate(mssql_perfmon__sql_compilations_total{S}[{rate}])', + 'compilations/s'), + (f'rate(mssql_perfmon__sql_re_compilations_total{S}[{rate}])', + 're-compilations/s')], + (0, y, 24, 6))); y += 6 + ps.append(_ts("SQLServer:SQL Statistics - Cursors & Errors", + [(f'rate(mssql_perfmon__errors_total{S}[{rate}])', + 'errors/s')], + (0, y, 24, 8))); y += 8 + ps.append(_ts("SQLServer:SQL Errors", + [(f'rate(mssql_perfmon__errors_total{S}[{rate}])', + 'errors/s')], + (0, y, 24, 7))); y += 7 + ps.append(legacy_link_panel( + "SQLServer: Deprecated Features", + grid=(0, y, 24, 7), + sql_dashboard=_LEGACY_UID, + note="Deprecated-features counter not currently published by " + "mssql_standard.")); y += 7 + + # 15. Plan Cache + ps.append(row("SQL Server : Plan Cache : Cache Manager Instance", y)) + y += 1 + ps.append(_ts("SQLServer: Plan Cache - Totals", + [(f'mssql_perfmon__cache_pages{S}', 'cache pages'), + (f'mssql_perfmon__cache_object_counts{S}', + 'cache object counts'), + (f'mssql_perfmon__cache_objects_in_use{S}', + 'cache objects in use')], + (0, y, 24, 5))); y += 5 + ps.append(_ts("SQLServer: Plan Cache - cache object counts", + [(f'mssql_perfmon__cache_object_counts{S}', + '{{cache_type}}')], + (0, y, 24, 6))); y += 6 + ps.append(_ts("SQLServer: Plan Cache - cache pages", + [(f'mssql_perfmon__cache_pages{S}', '{{cache_type}}')], + (0, y, 24, 6))); y += 6 + ps.append(_ts("SQLServer: Plan Cache - cache objects in use", + [(f'mssql_perfmon__cache_objects_in_use{S}', + '{{cache_type}}')], + (0, y, 24, 6))); y += 6 + + # 16. Transactions + ps.append(row("SQLServer:Transactions", y)); y += 1 + ps.append(_ts("Longest Transaction Running Time", + [(f'mssql_perfmon__longest_transaction_running_time_seconds{S}', + 'longest tx (s)')], + (0, y, 11, 5), unit="s")) + ps.append(_ts("Free Space in tempdb (KB)", + [(f'mssql_perfmon__free_space_in_tempdb_kb{S}', + 'free tempdb (KB)')], + (11, y, 13, 5), unit="kbytes")); y += 5 + ps.append(_ts("Transactions", + [(f'mssql_perfmon__transactions{S}', 'tx')], + (0, y, 11, 5))) + ps.append(_ts("Version Store Size (KB)", + [(f'mssql_perfmon__version_store_size_kb{S}', + 'version store (KB)')], + (11, y, 13, 5), unit="kbytes")); y += 5 + + # 17. General Stats + ps.append(row("SQLServer:General Statistics", y)); y += 1 + ps.append(_ts("Winsock BSP rejected connections/sec", + [(f'rate(windows_net_packets_outbound_errors_total{S}[{rate}])', + '{{nic}}')], + (0, y, 24, 8))); y += 8 + ps.append(_ts("SQLServer:General Statistics - Login/Logout", + [(f'rate(mssql_perfmon__logins_total{S}[{rate}])', + 'logins/s'), + (f'rate(mssql_perfmon__logouts_total{S}[{rate}])', + 'logouts/s')], + (0, y, 24, 7))); y += 7 + + # 18. Locks + ps.append(row("MSSQL Locks Performance Counters", y)); y += 1 + ps.append(_ts("SqlServer:Locks - Lock Wait Time (ms)", + [(f'rate(mssql_perfmon__lock_wait_time_ms_total{S}[{rate}])', + '{{resource_type}}')], + (0, y, 24, 8), unit="ms")); y += 8 + ps.append(_ts("SqlServer:Locks - Average Wait Time (ms)", + [(f'mssql_perfmon__average_wait_time_ms{S}', + '{{resource_type}}')], + (0, y, 24, 8), unit="ms")); y += 8 + ps.append(_ts("SqlServer:Locks - Waits/sec", + [(f'rate(mssql_perfmon__lock_waits_total{S}[{rate}])', + '{{resource_type}}')], + (0, y, 24, 8))); y += 8 + + # 19. Latches + ps.append(row("MSSQL Latches Performance Counters", y)); y += 1 + ps.append(_ts("Latch Waits/sec", + [(f'rate(mssql_perfmon__latch_waits_total{S}[{rate}])', + 'latch waits/s')], + (0, y, 24, 6))); y += 6 + ps.append(_ts("Latch Wait Time (ms)", + [(f'rate(mssql_perfmon__latch_wait_time_ms_total{S}[{rate}])', + 'latch wait ms/s')], + (0, y, 24, 8), unit="ms")); y += 8 + + # 20. Replication + ps.append(row("SQLServer:Replication", y)); y += 1 + ps.append(_ts("Replication - Latency", + [(f'mssql_perfmon__replication_latency_seconds{S}', + '{{publication}}')], + (0, y, 24, 8), unit="s")); y += 8 + ps.append(_ts("Replication - Transfer Rate", + [(f'rate(mssql_perfmon__replication_delivered_commands_total{S}[{rate}])', + '{{publication}}')], + (0, y, 24, 8))); y += 8 + + # 21. SQLAgent:Jobs + ps.append(row("SQLAgent:Jobs", y)); y += 1 + ps.append(_ts("SQLAgent: Jobs", + [(f'sum by (instance) (mssql_sqlagent_job__is_running{S})', + 'jobs running'), + (f'sum by (instance) (mssql_sqlagent_job__enabled{S})', + 'jobs enabled')], + (0, y, 24, 5))); y += 5 + + # 22/23. Mirroring / Resource Pool — no metrics published + ps.append(row("SQLServer:Database Mirroring", y)); y += 1 + ps.append(legacy_link_panel( + "Database Mirroring", grid=(0, y, 24, 5), + sql_dashboard=_LEGACY_UID, + note="Mirroring counters are not currently exposed by " + "mssql_standard; use the SQL dashboard.")); y += 5 + ps.append(row("SQLServer:Resource Pool Stats", y)); y += 1 + ps.append(legacy_link_panel( + "Resource Pool Stats", grid=(0, y, 24, 5), + sql_dashboard=_LEGACY_UID, + note="Resource Governor pool counters are not currently exposed " + "by mssql_standard.")) diff --git a/sql_exporter/Prometheus-Dashboards/_specs/sql_agent_jobs.py b/sql_exporter/Prometheus-Dashboards/_specs/sql_agent_jobs.py new file mode 100644 index 0000000..e39f399 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/_specs/sql_agent_jobs.py @@ -0,0 +1,154 @@ +"""Spec for ``SQL Agent Jobs`` Prometheus port (UID: prom_sql_agent_jobs). + +SQL source dashboards: + + - Monitoring - Live - All Servers - Job Activity Monitor.json (5 data) + - Monitoring - Live - All Servers.json (failed-jobs summary rows) + +Backed by the new ``mssql_sqlagent_jobs.collector.yml``: + + mssql_sqlagent_job__enabled {job_name, job_id, + category_name, owner_name} + mssql_sqlagent_job__last_run_outcome {..., last_run_outcome_desc} + mssql_sqlagent_job__last_run_duration_seconds {job_name, job_id} + mssql_sqlagent_job__last_run_end_time_utc {job_name, job_id} + mssql_sqlagent_job__next_run_time_utc {job_name, job_id} + mssql_sqlagent_job__is_running {job_name, job_id} + mssql_sqlagent_job__step_failures_last_24h {job_name, job_id} +""" +from prom_dashboard import Panel, Target, query_var, custom_var + + +UID = "prom_sql_agent_jobs" +TITLE = "SQL Agent Jobs" +TAGS = ["mssql", "sqlmonitor", "SQL Agent", "prometheus"] + + +def variables(): + return [ + query_var("Server", "label_values(mssql_up, instance)", + label="SQL Instance", multi=True, include_all=True), + query_var("job_category", + 'label_values(mssql_sqlagent_job__enabled{instance=~"$Server"}, category_name)', + label="Category", multi=True, include_all=True), + query_var("job_name", + 'label_values(mssql_sqlagent_job__enabled{instance=~"$Server",category_name=~"$job_category"}, job_name)', + label="Job Name", multi=True, include_all=True), + custom_var("enabled", ["__ALL__", "1", "0"], default="__ALL__", + label="Enabled"), + custom_var("last_outcome", + ["__ALL__", "Succeeded", "Failed", "Retry", + "Canceled", "Unknown"], + default="__ALL__", label="Last Outcome"), + ] + + +def panels(): + ps: list[Panel] = [] + I = ('{instance=~"$Server",category_name=~"$job_category",' + 'job_name=~"$job_name"}') + # Selector for metrics that only carry the job_name/job_id pair. + IJ = '{instance=~"$Server",job_name=~"$job_name"}' + + # 1 - Summary stats + ps.append(Panel( + title="Jobs - Total", + description="Total number of SQL Agent jobs matching the filters.", + type="stat", unit="short", + grid=(0, 0, 6, 4), + targets=[Target(f"count(mssql_sqlagent_job__enabled{I})", + legend="", ref="A", instant=True)], + )) + ps.append(Panel( + title="Jobs - Enabled", + description="Number of enabled jobs matching the filters.", + type="stat", unit="short", + grid=(6, 0, 6, 4), + thresholds_steps=[{"color": "red", "value": None}, + {"color": "green", "value": 1}], + targets=[Target(f"sum(mssql_sqlagent_job__enabled{I})", + legend="", ref="A", instant=True)], + )) + ps.append(Panel( + title="Jobs - Running Now", + description="Jobs whose latest sysjobactivity row shows " + "start_execution_date set and stop_execution_date NULL.", + type="stat", unit="short", + grid=(12, 0, 6, 4), + targets=[Target(f"sum(mssql_sqlagent_job__is_running{IJ})", + legend="", ref="A", instant=True)], + )) + ps.append(Panel( + title="Jobs - Last Outcome = Failed", + description="Jobs whose most recent completed run failed.", + type="stat", unit="short", + grid=(18, 0, 6, 4), + thresholds_steps=[{"color": "green", "value": None}, + {"color": "red", "value": 1}], + targets=[Target( + f'count(mssql_sqlagent_job__last_run_outcome{I} == 0)', + legend="", ref="A", instant=True)], + )) + + # 2 - Main table: join everything by (instance, job_name) + ps.append(Panel( + title="SQL Agent Jobs - Status Detail - [$Server]", + description=("Per-job roll-up of enabled/outcome/duration/next-run/" + "running/24h-step-failures, joined on (instance, job_name)."), + type="table", unit="short", + grid=(0, 4, 24, 18), + targets=[ + Target(f"mssql_sqlagent_job__enabled{I}", + legend="", ref="Enabled", instant=True, format="table"), + Target( + f"mssql_sqlagent_job__last_run_outcome{I}", + legend="", ref="Outcome", instant=True, format="table"), + Target(f"mssql_sqlagent_job__last_run_duration_seconds{IJ}", + legend="", ref="Duration", instant=True, format="table"), + Target(f"mssql_sqlagent_job__last_run_end_time_utc{IJ}", + legend="", ref="LastEnd", instant=True, format="table"), + Target(f"mssql_sqlagent_job__next_run_time_utc{IJ}", + legend="", ref="NextRun", instant=True, format="table"), + Target(f"mssql_sqlagent_job__is_running{IJ}", + legend="", ref="Running", instant=True, format="table"), + Target(f"mssql_sqlagent_job__step_failures_last_24h{IJ}", + legend="", ref="Fails24h", instant=True, format="table"), + ], + transformations=[ + {"id": "merge", "options": {}}, + {"id": "organize", "options": { + "excludeByName": {"Time": True, "__name__": True, + "job": True, "target": True, + "exported_job": True, "job_id": True}, + "renameByName": { + "instance": "Server", + "job_name": "Job", + "category_name": "Category", + "owner_name": "Owner", + "last_run_outcome_desc": "Last Outcome", + "Value #Enabled": "Enabled", + "Value #Outcome": "Outcome (code)", + "Value #Duration": "Duration (s)", + "Value #LastEnd": "Last Run End (UTC)", + "Value #NextRun": "Next Run (UTC)", + "Value #Running": "Running", + "Value #Fails24h": "Step Failures (24h)", + }, + }}, + ], + )) + + # 3 - Trend: recent failed-job count + ps.append(Panel( + title="Failed Jobs - Trend", + description="Number of jobs whose last completed run was Failed " + "(outcome=0), tracked across time.", + type="timeseries", unit="short", + grid=(0, 22, 24, 10), + targets=[Target( + f'count(mssql_sqlagent_job__last_run_outcome{I} == 0) ' + f'by (instance)', + legend="{{instance}}", ref="A")], + )) + + return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/wait_stats.py b/sql_exporter/Prometheus-Dashboards/_specs/wait_stats.py new file mode 100644 index 0000000..c561ba3 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/_specs/wait_stats.py @@ -0,0 +1,135 @@ +"""Spec for ``Wait Stats`` Prometheus port (UID: prom_wait_stats). + +SQL source dashboard has 4 data panels: + + 1. Table "Wait Stats with ${sql_schedulers} CPUs since Startup" + → top waits ranked by wait_percentage with resource/signal splits. + 2. Table "Wait Stats Since Startup till ${__from}" + → same as (1) but evaluated at the dashboard's start time. + 3. Table "Wait Stats In Selected Time Duration" + → deltas between ${__from} and ${__to}. + 4. Timeseries "[${server}] - WaitStats" + → per-wait_type wait_time_seconds rate over the range. + +All panels port 1:1 using ``mssql_waits__*`` counter metrics which are +already produced by ``mssql_dba_cached.collector.yml``. +""" +from prom_dashboard import Panel, Target, query_var, constant_var + + +UID = "prom_wait_stats" +TITLE = "Wait Stats" +TAGS = ["mssql", "sqlmonitor", "Wait Stats", "prometheus"] + + +def variables(): + return [ + query_var("Server", "label_values(mssql_up, instance)", + label="SQL Instance", multi=False, include_all=False), + query_var("sql_schedulers", + 'query_result(mssql_sqlserver_cpu_count{instance="$Server"})', + label="SQL Schedulers", hide=2), + query_var("sqlserver_start_time_utc", + 'query_result((time() - mssql_sqlserver_uptime_seconds{instance="$Server"}) * 1000)', + label="SQL Start Time UTC (ms)", hide=2), + constant_var("top_n", "20", label="Top N Waits"), + ] + + +def panels(): + ps: list[Panel] = [] + I = '{instance="$Server"}' + + # Panel 1 - table "Wait Stats with $sql_schedulers CPUs since Startup" + # Uses the raw counter values (since startup = counter-to-date). + ps.append(Panel( + title=("Wait Stats with \"__${sql_schedulers} CPUs__\" since Startup"), + description=("Top wait_types ranked by wait_time since SQL Server " + "last started. Matches the SQL dashboard's first table."), + type="table", unit="s", + grid=(0, 0, 24, 11), + targets=[ + Target(f"topk($top_n, mssql_waits__wait_time_seconds{I})", + legend="{{wait_type}}", ref="WaitSec", instant=True, + format="table"), + Target(f"mssql_waits__resource_time_seconds{I}", + legend="{{wait_type}}", ref="ResSec", instant=True, + format="table"), + Target(f"mssql_waits__signal_time_seconds{I}", + legend="{{wait_type}}", ref="SigSec", instant=True, + format="table"), + Target(f"mssql_waits__waiting_tasks_count{I}", + legend="{{wait_type}}", ref="Waiters", instant=True, + format="table"), + Target(f"mssql_waits__wait_percentage{I}", + legend="{{wait_type}}", ref="Pct", instant=True, + format="table"), + Target(f"mssql_waits__wait_rank_no{I}", + legend="{{wait_type}}", ref="Rank", instant=True, + format="table"), + ], + transformations=[ + {"id": "merge", "options": {}}, + {"id": "organize", "options": { + "excludeByName": {"Time": True, "__name__": True, + "instance": True, "job": True, + "exported_job": True, "target": True}, + "renameByName": { + "wait_type": "Wait Type", + "Value #Rank": "Rank", + "Value #WaitSec": "Wait (s)", + "Value #ResSec": "Resource (s)", + "Value #SigSec": "Signal (s)", + "Value #Waiters": "Waiting Tasks", + "Value #Pct": "Wait %", + }, + "indexByName": {"Rank": 0, "Wait Type": 1, "Wait (s)": 2, + "Resource (s)": 3, "Signal (s)": 4, + "Waiting Tasks": 5, "Wait %": 6}, + }}, + ], + )) + + # Panel 2 - Since Startup till $__from (historical snapshot) + ps.append(Panel( + title="Wait Stats ____Since Startup ___ till ___ ${__from:date:YYYY-MM-DD HH.mm}___", + description=("Counter value at dashboard `from` time — " + "waits accumulated from SQL startup until the start of " + "the visible range."), + type="table", unit="s", + grid=(0, 11, 24, 7), + targets=[Target( + f"topk($top_n, mssql_waits__wait_time_seconds{I} @ end() offset ($__to - $__from))", + legend="{{wait_type}}", ref="A", instant=True, format="table")], + )) + + # Panel 3 - Delta over selected time duration + ps.append(Panel( + title=("Wait Stats ____In Selected Time Duration____Since____" + "${__from:date:YYYY-MM-DD HH.mm}___till___" + "${__to:date:YYYY-MM-DD HH.mm}____"), + description=("Wait time accrued between `from` and `to`. " + "Uses increase() on the counter, so wait type = " + "additional seconds waited in the visible range."), + type="table", unit="s", + grid=(0, 18, 24, 7), + targets=[Target( + f"topk($top_n, sum by (wait_type) (" + f"increase(mssql_waits__wait_time_seconds{I}[$__range])))", + legend="{{wait_type}}", ref="A", instant=True, format="table")], + )) + + # Panel 4 - Timeseries of wait_time rate per wait_type + ps.append(Panel( + title="[${Server}] - WaitStats", + description=("rate(mssql_waits__wait_time_seconds) per wait_type — " + "top N by average rate over the visible range."), + type="timeseries", unit="s", + grid=(0, 25, 24, 19), + targets=[Target( + f"topk($top_n, sum by (wait_type) (" + f"rate(mssql_waits__wait_time_seconds{I}[$__rate_interval])))", + legend="{{wait_type}}", ref="A")], + )) + + return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/xevent_trend.py b/sql_exporter/Prometheus-Dashboards/_specs/xevent_trend.py new file mode 100644 index 0000000..59a6da4 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/_specs/xevent_trend.py @@ -0,0 +1,124 @@ +"""Spec for ``XEvent - Trend`` Prometheus port (UID: prom_xevent_trend). + +SQL source dashboard ``XEvent - Trend.json`` has 3 data panels: + + 1. Timeseries CPU Trend by {grouping_key} + 2. Timeseries Counts Trend by {grouping_key} + 3. Timeseries Reads Trend by {grouping_key} + +Backed by the new ``mssql_xevent.collector.yml``: + + mssql_xevent__events_last_5m {event_name, database_name, + result, client_app_name} + mssql_xevent__cpu_time_ms_last_5m (same labels) + mssql_xevent__duration_seconds_last_5m + mssql_xevent__logical_reads_last_5m + mssql_xevent__physical_reads_last_5m + mssql_xevent__writes_last_5m + +The SQL dashboard lets the user toggle the grouping key (event / db / +login / program). Prometheus has no SUM(CASE ...) GROUP BY, so we ship +one variable ``$grouping_key`` and build the ``sum by (<key>)`` expr +with a templated label name. +""" +from prom_dashboard import Panel, Target, query_var, custom_var + + +UID = "prom_xevent_trend" +TITLE = "XEvent - Trend" +TAGS = ["mssql", "sqlmonitor", "XEvent", "prometheus"] + + +def variables(): + return [ + query_var("Server", "label_values(mssql_up, instance)", + label="SQL Instance"), + query_var("database", + 'label_values(mssql_xevent__events_last_5m{instance="$Server"}, database_name)', + label="Database", multi=True, include_all=True), + query_var("event_name", + 'label_values(mssql_xevent__events_last_5m{instance="$Server"}, event_name)', + label="Event", multi=True, include_all=True), + query_var("result", + 'label_values(mssql_xevent__events_last_5m{instance="$Server"}, result)', + label="Result", multi=True, include_all=True), + query_var("client_app", + 'label_values(mssql_xevent__events_last_5m{instance="$Server"}, client_app_name)', + label="Client App", multi=True, include_all=True), + custom_var("grouping_key", + ["event_name", "database_name", + "client_app_name", "result"], + default="event_name", label="Group by"), + custom_var("top_n", + ["5", "10", "15", "20", "25"], default="10", + label="Top N series"), + ] + + +def panels(): + ps: list[Panel] = [] + I = ('{instance="$Server",database_name=~"$database",' + 'event_name=~"$event_name",result=~"$result",' + 'client_app_name=~"$client_app"}') + + # 1 - CPU Trend (cpu_time_ms → seconds) + ps.append(Panel( + title="XEvent - CPU Trend - By - {${grouping_key}}", + description=("CPU time (seconds) attributed to extended events, " + "summed per ${grouping_key}. Uses the 5-minute " + "aggregate gauge published by mssql_xevent; rendered " + "as a rate since the gauge resets each collection."), + type="timeseries", unit="s", + grid=(0, 0, 24, 11), + targets=[Target( + f"topk($top_n, sum by (${{grouping_key}}) (" + f"mssql_xevent__cpu_time_ms_last_5m{I} / 1000))", + legend="{{${grouping_key}}}", ref="A")], + )) + + # 2 - Counts Trend + ps.append(Panel( + title="XEvent - Counts Trend - By - {${grouping_key}}", + description=("Count of extended events in the most recent " + "5-minute window, summed per ${grouping_key}."), + type="timeseries", unit="short", + grid=(0, 11, 24, 11), + targets=[Target( + f"topk($top_n, sum by (${{grouping_key}}) (" + f"mssql_xevent__events_last_5m{I}))", + legend="{{${grouping_key}}}", ref="A")], + )) + + # 3 - Reads Trend (logical + physical) + ps.append(Panel( + title="XEvent - Reads Trend - By - {${grouping_key}}", + description=("Logical + physical reads attributed to extended " + "events, summed per ${grouping_key}."), + type="timeseries", unit="short", + grid=(0, 22, 24, 11), + targets=[ + Target( + f"topk($top_n, sum by (${{grouping_key}}) (" + f"mssql_xevent__logical_reads_last_5m{I}))", + legend="logical • {{${grouping_key}}}", ref="Logical"), + Target( + f"topk($top_n, sum by (${{grouping_key}}) (" + f"mssql_xevent__physical_reads_last_5m{I}))", + legend="physical • {{${grouping_key}}}", ref="Physical"), + ], + )) + + # 4 - Duration (bonus panel; useful complement to the SQL original) + ps.append(Panel( + title="XEvent - Duration Trend - By - {${grouping_key}}", + description=("Sum of durations (seconds) for extended events in " + "the 5-minute window, per ${grouping_key}."), + type="timeseries", unit="s", + grid=(0, 33, 24, 11), + targets=[Target( + f"topk($top_n, sum by (${{grouping_key}}) (" + f"mssql_xevent__duration_seconds_last_5m{I}))", + legend="{{${grouping_key}}}", ref="A")], + )) + + return ps diff --git a/sql_exporter/Prometheus-Dashboards/_tools/inspect_panels.py b/sql_exporter/Prometheus-Dashboards/_tools/inspect_panels.py new file mode 100644 index 0000000..308a489 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/_tools/inspect_panels.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +"""Helper: list panels (title+type+grid) for a source dashboard JSON. +Usage: python3 inspect_panels.py <file.json> +""" +import json +import sys + +def walk(panels, prefix=""): + for p in panels: + t = p.get("type", "?") + title = p.get("title", "") + g = p.get("gridPos", {}) + coord = f"({g.get('x',0)},{g.get('y',0)},{g.get('w',0)},{g.get('h',0)})" + print(f"{prefix}[{t:10}] {coord:18} {title}") + if p.get("panels"): + walk(p["panels"], prefix + " ") + +d = json.load(open(sys.argv[1])) +walk(d.get("panels", [])) diff --git a/sql_exporter/Prometheus-Dashboards/_tools/validate.py b/sql_exporter/Prometheus-Dashboards/_tools/validate.py new file mode 100644 index 0000000..a83f875 --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/_tools/validate.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 +"""Validate every generated Prometheus dashboard JSON in this folder. + +Checks: + - parses as JSON + - schemaVersion >= 41 + - contains a DS_PROMETHEUS datasource input + - every non-row/non-text panel has >= 1 target with a non-empty expr + - prints (uid, #panels total, #data panels, #rows, #text panels, #vars) +""" +import json +import os +import sys + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +def walk(panels): + for p in panels: + yield p + if p.get("panels"): + yield from walk(p["panels"]) + + +def validate(path: str) -> bool: + d = json.load(open(path)) + assert d.get("schemaVersion", 0) >= 41, f"{path}: schemaVersion too old" + assert any(i["name"] == "DS_PROMETHEUS" for i in d.get("__inputs", [])), \ + f"{path}: missing DS_PROMETHEUS input" + all_p = list(walk(d.get("panels", []))) + rows = sum(1 for p in all_p if p.get("type") == "row") + text = sum(1 for p in all_p if p.get("type") == "text") + data = [p for p in all_p + if p.get("type") not in ("row", "text", "dashlist")] + for p in data: + tgts = p.get("targets", []) + if not tgts: + print(f" WARN {path}: panel '{p.get('title')}' has 0 targets") + continue + for t in tgts: + if not t.get("expr", "").strip(): + print(f" WARN {path}: panel '{p.get('title')}' " + f"target {t.get('refId')} has empty expr") + vars_ = len(d.get("templating", {}).get("list", [])) + print(f"{os.path.basename(path):60s} uid={d['uid']:40s} " + f"panels={len(all_p):3d} data={len(data):3d} rows={rows:2d} " + f"text={text:2d} vars={vars_:2d}") + return True + + +if __name__ == "__main__": + files = sorted(f for f in os.listdir(ROOT) if f.endswith(".json")) + ok = True + for f in files: + try: + validate(os.path.join(ROOT, f)) + except Exception as e: + print(f"FAIL {f}: {e}") + ok = False + sys.exit(0 if ok else 1) diff --git a/sql_exporter/Prometheus-Dashboards/generate.py b/sql_exporter/Prometheus-Dashboards/generate.py new file mode 100644 index 0000000..6a73c1c --- /dev/null +++ b/sql_exporter/Prometheus-Dashboards/generate.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +"""Generate all Prometheus-backed SQLMonitor Grafana dashboards. + +Run from this folder: + + python3 generate.py # regenerate every dashboard + python3 generate.py core # regenerate only the Core Metrics - Trend port + +Each ``*.json`` written here is importable directly into Grafana via the +standard "New -> Import" dialog; Grafana will prompt you for the +Prometheus datasource to bind to the ``${DS_PROMETHEUS}`` placeholder. +""" +from __future__ import annotations + +import importlib +import sys +from pathlib import Path + +ROOT = Path(__file__).resolve().parent +sys.path.insert(0, str(ROOT / "_lib")) +sys.path.insert(0, str(ROOT / "_specs")) + +from build import build_dashboard, write_dashboard # noqa: E402 + + +SPECS = [ + # (spec_module, output_filename) + ("core_metrics_trend", "Core Metrics - Trend.json"), + ("wait_stats", "Wait Stats.json"), + ("disk_space", "Disk Space.json"), + ("ag_health_state", "Ag Health State.json"), + ("sql_agent_jobs", "SQL Agent Jobs.json"), + ("backup_history", "Backup History.json"), + ("xevent_trend", "XEvent - Trend.json"), + ("database_file_io_stats", "Database File IO Stats.json"), + ("dba_inventory", "DBA Inventory.json"), + ("monitoring_live_all_servers", + "Monitoring - Live - All Servers.json"), + ("monitoring_live_distributed", + "Monitoring - Live - Distributed.json"), + ("monitoring_perfmon_quest", + "Monitoring - Perfmon Counters - Quest Softwares - Distributed.json"), +] + + +def regenerate(filter_: str | None = None) -> list[Path]: + out: list[Path] = [] + for mod_name, filename in SPECS: + if filter_ and filter_ not in mod_name: + continue + spec = importlib.import_module(mod_name) + dashboard = build_dashboard( + uid=spec.UID, + title=spec.TITLE, + tags=spec.TAGS, + variables=spec.variables(), + panels=spec.panels(), + description=getattr(spec, "DESCRIPTION", ""), + ) + out.append(write_dashboard(ROOT, filename, dashboard)) + return out + + +if __name__ == "__main__": + flt = sys.argv[1] if len(sys.argv) > 1 else None + for p in regenerate(flt): + print(f"wrote {p.relative_to(ROOT)}") From 1449fc3cdd1f3846326344870d0084e7b9dd7b85 Mon Sep 17 00:00:00 2001 From: Ajay Kumar Dwivedi <ajay.dwivedi2007@gmail.com> Date: Sun, 19 Apr 2026 12:55:59 +0530 Subject: [PATCH 3/4] docs: document 3 new collectors and Phase 1 Prometheus dashboard pack - docs/prometheus.md: add rows for mssql_sqlagent_jobs, mssql_backup_history, mssql_xevent to the collectors table; add a 'Prometheus-backed dashboard pack' section with the 12 Phase 1 dashboards and regeneration commands. - sql_exporter/README-sql_exporter.md: add a 'Collectors' table describing every mssql_*.collector.yml file, its job binding, scrape interval and the metric prefix it publishes. --- docs/prometheus.md | 47 +++++++++++++++++++++++++++++ sql_exporter/README-sql_exporter.md | 24 +++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/docs/prometheus.md b/docs/prometheus.md index ec7f69a..d09cbee 100644 --- a/docs/prometheus.md +++ b/docs/prometheus.md @@ -24,6 +24,9 @@ The two paths are **complementary**, not mutually exclusive. Most of the Grafana | `mssql_dba_stableinfo.collector.yml` | Instance- and host-level stable facts (SQL version, core count, RAM). | | `mssql_dba_aghealth.collector.yml` | AG primary/secondary state, redo/log-send queue. | | `mssql_dba_whoisactive.collector.yml` | Top concurrent queries — higher cardinality. | +| `mssql_sqlagent_jobs.collector.yml` | SQL Agent job status / outcome / duration / next-run / 24h-failure count from `msdb`. | +| `mssql_backup_history.collector.yml` | Per-(database, backup_type) last-time / size / duration / age from `msdb.dbo.backupset`. | +| `mssql_xevent.collector.yml` | 5-minute aggregates from `DBA.dbo.xevent_metrics` (guarded with an existence check; no-op where the XEvent collector proc isn't installed). | | `mssql_standard.collector.yml` | The upstream [sql_exporter](https://github.com/burningalchemist/sql_exporter/tree/master/examples/mssql_standard) stock collector. | | `windows_exporter_config.yml` | Matching config for [windows_exporter](https://github.com/prometheus-community/windows_exporter) — host-level CPU, disk, network. | | `tessell-metrics.collector.yml` | Managed-instance variant (no `xp_cmdshell`). | @@ -95,6 +98,50 @@ For AGs add `sqlmonitor_ag` with `scrape_interval: 30s` pointing at the same tar 2. Import `sql_exporter/SQL-Exporter-Metrics-Dashboard-External.json` — this is the Prometheus counterpart of the SQL-backed distributed dashboard. 3. Optionally import the unified-alerting YAMLs from `sql_exporter/alert-engine/` — they define the same CPU / memory / wait / blocking alerts the Python engine provides, but run inside Grafana Alerting instead. +## Prometheus-backed dashboard pack + +The repo ships a parallel set of Grafana dashboards under [`sql_exporter/Prometheus-Dashboards/`](https://github.com/imajaydwivedi/SQLMonitor/tree/dev/sql_exporter/Prometheus-Dashboards) that mirror the SQL-backed dashboards in [`Grafana-Dashboards/`](https://github.com/imajaydwivedi/SQLMonitor/tree/dev/Grafana-Dashboards) but source every panel from Prometheus metrics. + +Phase 1 ships 12 dashboards covering the fleet's core signal set: + +| UID | Title | Data panels | +|---|---|---:| +| `prom_core_metrics_trend` | Core Metrics - Trend | 9 | +| `prom_wait_stats` | Wait Stats | 4 | +| `prom_disk_space` | Disk Space | 5 | +| `prom_ag_health_state` | Ag Health State | 3 | +| `prom_sql_agent_jobs` | SQL Agent Jobs | 6 | +| `prom_backup_history` | Backup History | 6 | +| `prom_xevent_trend` | XEvent - Trend | 4 | +| `prom_database_file_io_stats` | Database File IO Stats | 12 | +| `prom_dba_inventory` | DBA Inventory | 6 (+8 deep-links) | +| `prom_monitoring_live_all_servers` | Monitoring - Live - All Servers | 15 (+6 deep-links) | +| `prom_monitoring_live_distributed` | Monitoring - Live - Distributed | 52 (+6 deep-links) | +| `prom_monitoring_perfmon_quest` | Monitoring - Perfmon Counters - Quest Softwares - Distributed | 51 (+4 deep-links) | + +Panels that depend on the SQLMonitor central inventory database (alert history, AG-vs-nonAG backup split, LAMA config-change deltas, `dm_os_memory_clerks` snapshot, tempdb/log_space cache tables, `sql_server_patching`) render as markdown **deep-link tiles** that jump back to the SQL-backed dashboard so every source section remains visible. + +### Regenerating the dashboards + +Each dashboard is built from a small Python spec: + +```bash +cd sql_exporter/Prometheus-Dashboards +python3 generate.py # rebuild every *.json +python3 generate.py backup # filter: rebuild only backup_history +python3 _tools/validate.py # structural + expr sanity check +``` + +High-fidelity PromQL patterns used across the specs: + +- `increase(metric[$__range])` — selective-duration deltas (File IO, Wait Stats). +- `@ end() offset $__range` — prior-window comparison tables (day-over-day). +- `quantile_over_time($percentile_q, (expr)[$trend_window:])` — percentile trends. +- `topk($top_n, sum by (...) (...))` — XEvent / wait-type / memory-consumer trends. +- `time() - timestamp(up == 1)` — data-collection-issue detection. + +See the folder's [`README.md`](https://github.com/imajaydwivedi/SQLMonitor/blob/dev/sql_exporter/Prometheus-Dashboards/README.md) for the full spec-driven workflow and Grafana API bulk-import snippet. + ## Choosing between the two paths | Consideration | SQL table path (classic) | Prometheus path | diff --git a/sql_exporter/README-sql_exporter.md b/sql_exporter/README-sql_exporter.md index 1c520b6..970f7eb 100644 --- a/sql_exporter/README-sql_exporter.md +++ b/sql_exporter/README-sql_exporter.md @@ -135,6 +135,30 @@ scrape_configs: ``` +# Collectors + +`sql_exporter.yml` binds each collector file (`mssql_*.collector.yml`) to a +job; every target in the job runs every metric definition in the named +collectors. + +| Collector file | Job | Scrape interval | What it publishes | +|---|---|---|---| +| `mssql_standard.collector.yml` | `mssql_common` | default | Upstream [sql_exporter](https://github.com/burningalchemist/sql_exporter/tree/master/examples/mssql_standard) baseline — `mssql_perfmon__*`, `mssql_up`, `mssql_sqlserver_*`. | +| `mssql_dba_cached.collector.yml` | `mssql_common` | 1m | `mssql_virtualfilestats__*`, `mssql_waits__*`, `mssql_cpu_utilization__*`. | +| `mssql_dba_regular.collector.yml` | `mssql_common` | default | `mssql_service_info`, `mssql_db_state`, registry/config snapshot. | +| `mssql_dba_stableinfo.collector.yml` | `mssql_common` | 10m | Low-churn info (CPU count, version, clustering). | +| `mssql_dba_aghealth.collector.yml` | `mssql_ag` | 1m | `mssql_aghealth__*` (AG sync_health / latency / queues). | +| `mssql_dba_whoisactive.collector.yml` | `mssql_long_running` | 2m | `mssql_whoisactive__*` — current sp_WhoIsActive snapshot. | +| `mssql_sqlagent_jobs.collector.yml` | `mssql_msdb` | 1m | `mssql_sqlagent_job__*` — job enabled / outcome / duration / next run / 24h step failures. | +| `mssql_backup_history.collector.yml` | `mssql_msdb` | 5m | `mssql_backup__*` — per-(db, backup_type) last-time / size / duration / age. | +| `mssql_xevent.collector.yml` | `mssql_xevent` | 1m | `mssql_xevent__*` — 5-minute aggregates of `DBA.dbo.xevent_metrics` (guarded; no-op where the XEvent proc isn't installed). | + +The three **msdb / xevent** collectors are new in Phase 1 of the Prometheus +dashboard rollout and feed the new Grafana dashboards under +`sql_exporter/Prometheus-Dashboards/`. See [`Prometheus-Dashboards/README.md`](Prometheus-Dashboards/README.md) +for the generator / spec workflow and the per-dashboard panel inventory. + + # Refresh Collectors ``` # E:\Github\SQLMonitor\sql_exporter\sql_exporter.exe --config.file E:\Github\SQLMonitor\sql_exporter\sql_exporter.yml From 18221b6e7bd293e3970bd29d3230ec9ef183bcf4 Mon Sep 17 00:00:00 2001 From: Ajay Kumar Dwivedi <ajay.dwivedi2007@gmail.com> Date: Sun, 19 Apr 2026 16:45:46 +0530 Subject: [PATCH 4/4] added more metrics in sql_exporter --- ...Perfmon-SQL-Exporter-Migration-Progress.md | 25 - .../Ag Health State.json | 781 --- .../Prometheus-Dashboards/Backup History.json | 869 --- .../Core Metrics - Trend.json | 1312 ---- .../Prometheus-Dashboards/DBA Inventory.json | 930 --- .../Database File IO Stats.json | 1460 ---- .../Prometheus-Dashboards/Disk Space.json | 673 -- .../Monitoring - Live - All Servers.json | 1573 ----- .../Monitoring - Live - Distributed.json | 4677 ------------- ...nters - Quest Softwares - Distributed.json | 5859 ----------------- sql_exporter/Prometheus-Dashboards/README.md | 133 - .../Prometheus-Dashboards/SQL Agent Jobs.json | 794 --- ...L-Exporter-Metrics-Dashboard-External.json | 0 .../Prometheus-Dashboards/Wait Stats.json | 591 -- .../Prometheus-Dashboards/XEvent - Trend.json | 682 -- .../Prometheus-Dashboards/_lib/build.py | 162 - .../_lib/prom_dashboard.py | 153 - .../_specs/ag_health_state.py | 162 - .../_specs/backup_history.py | 167 - .../_specs/core_metrics_trend.py | 225 - .../_specs/database_file_io_stats.py | 340 - .../_specs/dba_inventory.py | 204 - .../_specs/disk_space.py | 156 - .../_specs/monitoring_live_all_servers.py | 291 - .../_specs/monitoring_live_distributed.py | 475 -- .../_specs/monitoring_perfmon_quest.py | 421 -- .../_specs/sql_agent_jobs.py | 154 - .../_specs/wait_stats.py | 135 - .../_specs/xevent_trend.py | 124 - .../_tools/inspect_panels.py | 19 - .../Prometheus-Dashboards/_tools/validate.py | 60 - .../Prometheus-Dashboards/generate.py | 67 - .../SQL-Exporter-Metrics-Documentation.md | 228 - sql_exporter/SQL-Exporter-Metrics-QuickRef.md | 154 - .../mssql_dba_stableinfo.collector.yml | 66 +- .../mssql_sqlagent_jobs.collector.yml | 119 +- sql_exporter/mssql_xevent.collector.yml | 82 +- sql_exporter/sql_exporter_metrics.txt | 501 -- 38 files changed, 140 insertions(+), 24684 deletions(-) delete mode 100644 sql_exporter/Perfmon-SQL-Exporter-Migration-Progress.md delete mode 100644 sql_exporter/Prometheus-Dashboards/Ag Health State.json delete mode 100644 sql_exporter/Prometheus-Dashboards/Backup History.json delete mode 100644 sql_exporter/Prometheus-Dashboards/Core Metrics - Trend.json delete mode 100644 sql_exporter/Prometheus-Dashboards/DBA Inventory.json delete mode 100644 sql_exporter/Prometheus-Dashboards/Database File IO Stats.json delete mode 100644 sql_exporter/Prometheus-Dashboards/Disk Space.json delete mode 100644 sql_exporter/Prometheus-Dashboards/Monitoring - Live - All Servers.json delete mode 100644 sql_exporter/Prometheus-Dashboards/Monitoring - Live - Distributed.json delete mode 100644 sql_exporter/Prometheus-Dashboards/Monitoring - Perfmon Counters - Quest Softwares - Distributed.json delete mode 100644 sql_exporter/Prometheus-Dashboards/README.md delete mode 100644 sql_exporter/Prometheus-Dashboards/SQL Agent Jobs.json rename sql_exporter/{ => Prometheus-Dashboards}/SQL-Exporter-Metrics-Dashboard-External.json (100%) delete mode 100644 sql_exporter/Prometheus-Dashboards/Wait Stats.json delete mode 100644 sql_exporter/Prometheus-Dashboards/XEvent - Trend.json delete mode 100644 sql_exporter/Prometheus-Dashboards/_lib/build.py delete mode 100644 sql_exporter/Prometheus-Dashboards/_lib/prom_dashboard.py delete mode 100644 sql_exporter/Prometheus-Dashboards/_specs/ag_health_state.py delete mode 100644 sql_exporter/Prometheus-Dashboards/_specs/backup_history.py delete mode 100644 sql_exporter/Prometheus-Dashboards/_specs/core_metrics_trend.py delete mode 100644 sql_exporter/Prometheus-Dashboards/_specs/database_file_io_stats.py delete mode 100644 sql_exporter/Prometheus-Dashboards/_specs/dba_inventory.py delete mode 100644 sql_exporter/Prometheus-Dashboards/_specs/disk_space.py delete mode 100644 sql_exporter/Prometheus-Dashboards/_specs/monitoring_live_all_servers.py delete mode 100644 sql_exporter/Prometheus-Dashboards/_specs/monitoring_live_distributed.py delete mode 100644 sql_exporter/Prometheus-Dashboards/_specs/monitoring_perfmon_quest.py delete mode 100644 sql_exporter/Prometheus-Dashboards/_specs/sql_agent_jobs.py delete mode 100644 sql_exporter/Prometheus-Dashboards/_specs/wait_stats.py delete mode 100644 sql_exporter/Prometheus-Dashboards/_specs/xevent_trend.py delete mode 100644 sql_exporter/Prometheus-Dashboards/_tools/inspect_panels.py delete mode 100644 sql_exporter/Prometheus-Dashboards/_tools/validate.py delete mode 100644 sql_exporter/Prometheus-Dashboards/generate.py delete mode 100644 sql_exporter/SQL-Exporter-Metrics-Documentation.md delete mode 100644 sql_exporter/SQL-Exporter-Metrics-QuickRef.md delete mode 100644 sql_exporter/sql_exporter_metrics.txt diff --git a/sql_exporter/Perfmon-SQL-Exporter-Migration-Progress.md b/sql_exporter/Perfmon-SQL-Exporter-Migration-Progress.md deleted file mode 100644 index 62db936..0000000 --- a/sql_exporter/Perfmon-SQL-Exporter-Migration-Progress.md +++ /dev/null @@ -1,25 +0,0 @@ -## Resumable Retry Plan - -### Objective -1. Inventory metrics/data covered by `Grafana-Dashboards/*.json` and `DDLs/SCH-usp_collect_performance_metrics.sql`. -2. Ensure matching coverage exists in `sql_exporter/mssql_*.collector.yml`; add missing items to `sql_exporter/mssql_dba_metrics.collector.yml`. -3. Copy `Grafana-Dashboards/Monitoring - Perfmon Counters - Quest Softwares - Distributed.json` into `sql_exporter/` and retarget its datasource/queries to `sql_exporter` metrics without changing layout, thresholds, or titles. - -### Checkpoints -- [ ] Step 01A: Extract dashboard metric inventory from `Grafana-Dashboards/` -- [ ] Step 01B: Extract procedure metric/data inventory from `DDLs/SCH-usp_collect_performance_metrics.sql` -- [ ] Step 01C: Compare inventory with `sql_exporter/mssql_*.collector.yml` -- [ ] Step 01D: Add missing items to `sql_exporter/mssql_dba_metrics.collector.yml` -- [ ] Step 02A: Copy Perfmon dashboard into `sql_exporter/` -- [ ] Step 02B: Retarget datasource and queries to `sql_exporter` metrics -- [ ] Step 02C: Validate migrated dashboard JSON - -### Current status -- Active phase: Step 01A / Step 01B inventory gathering -- Notes: task list created and repository scope confirmed. - -### Resume instructions -- Re-open this file first. -- Continue from the first unchecked checkpoint. -- Re-run only the inventory/validation commands for the incomplete phase. - diff --git a/sql_exporter/Prometheus-Dashboards/Ag Health State.json b/sql_exporter/Prometheus-Dashboards/Ag Health State.json deleted file mode 100644 index e407f16..0000000 --- a/sql_exporter/Prometheus-Dashboards/Ag Health State.json +++ /dev/null @@ -1,781 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__elements": {}, - "__requires": [ - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "12.0.0" - }, - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - }, - { - "type": "panel", - "id": "timeseries", - "name": "Time series", - "version": "" - }, - { - "type": "panel", - "id": "table", - "name": "Table", - "version": "" - }, - { - "type": "panel", - "id": "stat", - "name": "Stat", - "version": "" - } - ], - "annotations": { - "list": [] - }, - "description": "", - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 1, - "id": null, - "links": [], - "liveNow": false, - "panels": [ - { - "id": 101, - "type": "table", - "title": "LIVE - AlwaysOn Availability Group Health Metrics - [$Server]", - "description": "Latest AG replica health joined by unique_key. Sync state / health / queue sizes / rates / latency from mssql_aghealth__*.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 0, - "w": 24, - "h": 14 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__synchronization_health{instance=~\"$Server\",ag_name=~\"$ag_name\",ag_listener=~\"$ag_listener\",replica_server_name=~\"$replica_server_name\",database_name=~\"$database_name\",synchronization_state_desc=~\"$sync_state_desc\",synchronization_health_desc=~\"$sync_health_desc\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Health" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__synchronization_state{instance=~\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "State" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__is_primary_replica{instance=~\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Primary" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__is_local{instance=~\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Local" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__is_suspended{instance=~\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Suspended" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__latency_seconds{instance=~\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Latency" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__log_send_queue_size{instance=~\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "LogSendQ" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__redo_queue_size{instance=~\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "RedoQ" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__log_send_rate{instance=~\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "LogRate" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__redo_rate{instance=~\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "RedoRate" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__estimated_redo_completion_time_min{instance=~\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "RedoEtaMin" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__last_redone_time{instance=~\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "LastRedone" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__last_commit_time{instance=~\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "LastCommit" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Time": true, - "__name__": true, - "job": true, - "target": true, - "exported_job": true - }, - "renameByName": { - "replica_server_name": "Replica", - "database_name": "Database", - "ag_name": "AG", - "ag_listener": "Listener", - "synchronization_state_desc": "Sync State", - "synchronization_health_desc": "Sync Health", - "suspend_reason_desc": "Suspend Reason", - "Value #Health": "Health (code)", - "Value #State": "State (code)", - "Value #Primary": "Is Primary", - "Value #Local": "Is Local", - "Value #Suspended": "Is Suspended", - "Value #Latency": "Latency (s)", - "Value #LogSendQ": "Log Send Queue", - "Value #RedoQ": "Redo Queue", - "Value #LogRate": "Log Send Rate", - "Value #RedoRate": "Redo Rate", - "Value #RedoEtaMin": "Est. Redo (min)", - "Value #LastRedone": "Last Redone (epoch s)", - "Value #LastCommit": "Last Commit (epoch s)" - } - } - } - ], - "pluginVersion": "12.4.1" - }, - { - "id": 102, - "type": "table", - "title": "Latest - AlwaysOn Availability Groups - Status - FILTERED @ dashboard end", - "description": "SQL version anchors this at a cached collection timestamp. Prometheus serves the latest sample within the visible range instead.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 14, - "w": 24, - "h": 11 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "last_over_time(mssql_aghealth__latency_seconds{instance=~\"$Server\",ag_name=~\"$ag_name\",ag_listener=~\"$ag_listener\",replica_server_name=~\"$replica_server_name\",database_name=~\"$database_name\",synchronization_state_desc=~\"$sync_state_desc\",synchronization_health_desc=~\"$sync_health_desc\"}[$__range])", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 103, - "type": "timeseries", - "title": "Trend - AlwaysOn Latency (seconds)", - "description": "Per (replica, database) commit latency vs the primary, from mssql_aghealth__latency_seconds. -1 latency means the probe could not be evaluated.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 25, - "w": 24, - "h": 16 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "s", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__latency_seconds{instance=~\"$Server\",ag_name=~\"$ag_name\",ag_listener=~\"$ag_listener\",replica_server_name=~\"$replica_server_name\",database_name=~\"$database_name\",synchronization_state_desc=~\"$sync_state_desc\",synchronization_health_desc=~\"$sync_health_desc\"}", - "legendFormat": "{{replica_server_name}} || {{database_name}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - } - ], - "refresh": "30s", - "schemaVersion": 42, - "tags": [ - "mssql", - "sqlmonitor", - "Ag Health State", - "prometheus" - ], - "templating": { - "list": [ - { - "name": "DS_PROMETHEUS", - "type": "datasource", - "label": "Data Source", - "query": "prometheus", - "current": { - "text": "", - "value": "${DS_PROMETHEUS}", - "selected": true - }, - "refresh": 1, - "hide": 0, - "regex": "", - "skipUrlSync": false - }, - { - "name": "Server", - "type": "query", - "label": "SQL Instance", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_up, instance)", - "query": { - "qryType": 1, - "query": "label_values(mssql_up, instance)", - "refId": "PrometheusVariableQueryEditor-Server" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "ag_name", - "type": "query", - "label": "AG Name", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, ag_name)", - "query": { - "qryType": 1, - "query": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, ag_name)", - "refId": "PrometheusVariableQueryEditor-ag_name" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "ag_listener", - "type": "query", - "label": "AG Listener", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, ag_listener)", - "query": { - "qryType": 1, - "query": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, ag_listener)", - "refId": "PrometheusVariableQueryEditor-ag_listener" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "replica_server_name", - "type": "query", - "label": "Replica Server", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, replica_server_name)", - "query": { - "qryType": 1, - "query": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, replica_server_name)", - "refId": "PrometheusVariableQueryEditor-replica_server_name" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "database_name", - "type": "query", - "label": "Database", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, database_name)", - "query": { - "qryType": 1, - "query": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, database_name)", - "refId": "PrometheusVariableQueryEditor-database_name" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "sync_state_desc", - "type": "query", - "label": "Sync State", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, synchronization_state_desc)", - "query": { - "qryType": 1, - "query": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, synchronization_state_desc)", - "refId": "PrometheusVariableQueryEditor-sync_state_desc" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "sync_health_desc", - "type": "query", - "label": "Sync Health", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, synchronization_health_desc)", - "query": { - "qryType": 1, - "query": "label_values(mssql_aghealth__synchronization_health{instance=~\"$Server\"}, synchronization_health_desc)", - "refId": "PrometheusVariableQueryEditor-sync_health_desc" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "replica_type", - "type": "custom", - "label": "Replica Type", - "query": "__ALL__,Primary,Secondary,Local", - "options": [ - { - "text": "__ALL__", - "value": "__ALL__", - "selected": true - }, - { - "text": "Primary", - "value": "Primary", - "selected": false - }, - { - "text": "Secondary", - "value": "Secondary", - "selected": false - }, - { - "text": "Local", - "value": "Local", - "selected": false - } - ], - "current": { - "text": "__ALL__", - "value": "__ALL__", - "selected": true - }, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "latency_minutes", - "type": "custom", - "label": "Min Latency (min, -1=off)", - "query": "-1,0,1,5,15,30,60", - "options": [ - { - "text": "-1", - "value": "-1", - "selected": true - }, - { - "text": "0", - "value": "0", - "selected": false - }, - { - "text": "1", - "value": "1", - "selected": false - }, - { - "text": "5", - "value": "5", - "selected": false - }, - { - "text": "15", - "value": "15", - "selected": false - }, - { - "text": "30", - "value": "30", - "selected": false - }, - { - "text": "60", - "value": "60", - "selected": false - } - ], - "current": { - "text": "-1", - "value": "-1", - "selected": true - }, - "hide": 0, - "skipUrlSync": false - } - ] - }, - "time": { - "from": "now-3h", - "to": "now" - }, - "timepicker": {}, - "timezone": "browser", - "title": "Ag Health State", - "uid": "prom_ag_health_state", - "version": 1, - "weekStart": "" -} diff --git a/sql_exporter/Prometheus-Dashboards/Backup History.json b/sql_exporter/Prometheus-Dashboards/Backup History.json deleted file mode 100644 index 44596ba..0000000 --- a/sql_exporter/Prometheus-Dashboards/Backup History.json +++ /dev/null @@ -1,869 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__elements": {}, - "__requires": [ - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "12.0.0" - }, - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - }, - { - "type": "panel", - "id": "timeseries", - "name": "Time series", - "version": "" - }, - { - "type": "panel", - "id": "table", - "name": "Table", - "version": "" - }, - { - "type": "panel", - "id": "stat", - "name": "Stat", - "version": "" - } - ], - "annotations": { - "list": [] - }, - "description": "", - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 1, - "id": null, - "links": [], - "liveNow": false, - "panels": [ - { - "id": 101, - "type": "stat", - "title": "Databases - Covered", - "description": "Number of databases reporting backup history.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 0, - "w": 6, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count(count by (instance, database_name) (mssql_backup__last_time_utc{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=~\"$backup_type\"}))", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 102, - "type": "stat", - "title": "Full Backups older than $full_threshold_days days", - "description": "Databases whose most recent Full (D) backup is older than the configured threshold.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 6, - "y": 0, - "w": 6, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 1 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count(mssql_backup__age_seconds{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=\"D\"} > ($full_threshold_days * 86400))", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 103, - "type": "stat", - "title": "Diff Backups older than $diff_threshold_hours hours", - "description": "Databases whose most recent Differential (I) backup is older than the configured threshold.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 12, - "y": 0, - "w": 6, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 1 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count(mssql_backup__age_seconds{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=\"I\"} > ($diff_threshold_hours * 3600))", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 104, - "type": "stat", - "title": "Log Backups older than $tlog_threshold_minutes minutes", - "description": "Databases whose most recent Log (L) backup is older than the configured threshold.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 18, - "y": 0, - "w": 6, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 1 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count(mssql_backup__age_seconds{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=\"L\"} > ($tlog_threshold_minutes * 60))", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 105, - "type": "table", - "title": "Backup History - [$Server] - [$database_name]", - "description": "Latest backup per (database, type): age / duration / size / compressed size / 24h count, joined by the backup_type label.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 4, - "w": 24, - "h": 16 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_backup__last_time_utc{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=~\"$backup_type\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "When" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_backup__age_seconds{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=~\"$backup_type\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "AgeS" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_backup__last_duration_seconds{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=~\"$backup_type\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "DurS" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_backup__last_size_bytes{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=~\"$backup_type\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Size" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_backup__last_compressed_size_bytes{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=~\"$backup_type\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "CompSize" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_backup__count_last_24h{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=~\"$backup_type\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Cnt24h" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Time": true, - "__name__": true, - "job": true, - "target": true, - "exported_job": true - }, - "renameByName": { - "instance": "Server", - "database_name": "Database", - "backup_type": "Type", - "backup_type_desc": "Type Description", - "recovery_model": "Recovery Model", - "Value #When": "Last Backup (UTC epoch)", - "Value #AgeS": "Age (s)", - "Value #DurS": "Duration (s)", - "Value #Size": "Size (bytes)", - "Value #CompSize": "Compressed (bytes)", - "Value #Cnt24h": "Count (24h)" - } - } - } - ], - "pluginVersion": "12.4.1" - }, - { - "id": 106, - "type": "timeseries", - "title": "Backup Size Trend - [$Server] - [$database_name]", - "description": "Per-(database, backup_type) backup size over time.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 20, - "w": 24, - "h": 12 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "bytes", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_backup__last_size_bytes{instance=~\"$Server\",database_name=~\"$database_name\",backup_type=~\"$backup_type\"}", - "legendFormat": "{{database_name}} / {{backup_type}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - } - ], - "refresh": "30s", - "schemaVersion": 42, - "tags": [ - "mssql", - "sqlmonitor", - "Backup", - "prometheus" - ], - "templating": { - "list": [ - { - "name": "DS_PROMETHEUS", - "type": "datasource", - "label": "Data Source", - "query": "prometheus", - "current": { - "text": "", - "value": "${DS_PROMETHEUS}", - "selected": true - }, - "refresh": 1, - "hide": 0, - "regex": "", - "skipUrlSync": false - }, - { - "name": "Server", - "type": "query", - "label": "SQL Instance", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_up, instance)", - "query": { - "qryType": 1, - "query": "label_values(mssql_up, instance)", - "refId": "PrometheusVariableQueryEditor-Server" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "database_name", - "type": "query", - "label": "Database", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_backup__last_time_utc{instance=~\"$Server\"}, database_name)", - "query": { - "qryType": 1, - "query": "label_values(mssql_backup__last_time_utc{instance=~\"$Server\"}, database_name)", - "refId": "PrometheusVariableQueryEditor-database_name" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "backup_type", - "type": "custom", - "label": "Backup Type (D=Full, I=Diff, L=Log)", - "query": "__ALL__,D,I,L,F,G,P,Q", - "options": [ - { - "text": "__ALL__", - "value": "__ALL__", - "selected": true - }, - { - "text": "D", - "value": "D", - "selected": false - }, - { - "text": "I", - "value": "I", - "selected": false - }, - { - "text": "L", - "value": "L", - "selected": false - }, - { - "text": "F", - "value": "F", - "selected": false - }, - { - "text": "G", - "value": "G", - "selected": false - }, - { - "text": "P", - "value": "P", - "selected": false - }, - { - "text": "Q", - "value": "Q", - "selected": false - } - ], - "current": { - "text": "__ALL__", - "value": "__ALL__", - "selected": true - }, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "full_threshold_days", - "type": "custom", - "label": "Full age warn (days)", - "query": "1,2,3,7,14,30", - "options": [ - { - "text": "1", - "value": "1", - "selected": false - }, - { - "text": "2", - "value": "2", - "selected": false - }, - { - "text": "3", - "value": "3", - "selected": false - }, - { - "text": "7", - "value": "7", - "selected": true - }, - { - "text": "14", - "value": "14", - "selected": false - }, - { - "text": "30", - "value": "30", - "selected": false - } - ], - "current": { - "text": "7", - "value": "7", - "selected": true - }, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "diff_threshold_hours", - "type": "custom", - "label": "Diff age warn (hours)", - "query": "4,8,12,24,48", - "options": [ - { - "text": "4", - "value": "4", - "selected": false - }, - { - "text": "8", - "value": "8", - "selected": false - }, - { - "text": "12", - "value": "12", - "selected": false - }, - { - "text": "24", - "value": "24", - "selected": true - }, - { - "text": "48", - "value": "48", - "selected": false - } - ], - "current": { - "text": "24", - "value": "24", - "selected": true - }, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "tlog_threshold_minutes", - "type": "custom", - "label": "Log age warn (minutes)", - "query": "5,15,30,60,120,240", - "options": [ - { - "text": "5", - "value": "5", - "selected": false - }, - { - "text": "15", - "value": "15", - "selected": false - }, - { - "text": "30", - "value": "30", - "selected": true - }, - { - "text": "60", - "value": "60", - "selected": false - }, - { - "text": "120", - "value": "120", - "selected": false - }, - { - "text": "240", - "value": "240", - "selected": false - } - ], - "current": { - "text": "30", - "value": "30", - "selected": true - }, - "hide": 0, - "skipUrlSync": false - } - ] - }, - "time": { - "from": "now-3h", - "to": "now" - }, - "timepicker": {}, - "timezone": "browser", - "title": "Backup History", - "uid": "prom_backup_history", - "version": 1, - "weekStart": "" -} diff --git a/sql_exporter/Prometheus-Dashboards/Core Metrics - Trend.json b/sql_exporter/Prometheus-Dashboards/Core Metrics - Trend.json deleted file mode 100644 index 6800e33..0000000 --- a/sql_exporter/Prometheus-Dashboards/Core Metrics - Trend.json +++ /dev/null @@ -1,1312 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__elements": {}, - "__requires": [ - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "12.0.0" - }, - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - }, - { - "type": "panel", - "id": "timeseries", - "name": "Time series", - "version": "" - }, - { - "type": "panel", - "id": "table", - "name": "Table", - "version": "" - }, - { - "type": "panel", - "id": "stat", - "name": "Stat", - "version": "" - } - ], - "annotations": { - "list": [] - }, - "description": "", - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 1, - "id": null, - "links": [], - "liveNow": false, - "panels": [ - { - "id": 101, - "type": "timeseries", - "title": "Core Metrics - ${trend_by} TREND - Database IO Latency - Server ___[${Server}]___", - "description": "Per-database read/write latency in ms/IO. Aggregated at the $trend_by window using $percentile quantile_over_time.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 0, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "ms", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "quantile_over_time($percentile_q, (avg by (instance, database_name) (rate(mssql_virtualfilestats__io_stall_read_ms{instance=~\"$Server\"}[$__rate_interval]) / clamp_min(rate(mssql_virtualfilestats__num_of_reads{instance=~\"$Server\"}[$__rate_interval]), 1)))[$trend_window:])", - "legendFormat": "{{instance}} - {{database_name}} - read", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "quantile_over_time($percentile_q, (avg by (instance, database_name) (rate(mssql_virtualfilestats__io_stall_write_ms{instance=~\"$Server\"}[$__rate_interval]) / clamp_min(rate(mssql_virtualfilestats__num_of_writes{instance=~\"$Server\"}[$__rate_interval]), 1)))[$trend_window:])", - "legendFormat": "{{instance}} - {{database_name}} - write", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 102, - "type": "timeseries", - "title": "Core Metrics - ${trend_by} TREND - Database IO - Server ___[${Server}]___", - "description": "Per-database throughput in MB/s at the $trend_by window.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 8, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "MBs", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "quantile_over_time($percentile_q, (sum by (instance, database_name) (rate(mssql_virtualfilestats__num_of_bytes_read{instance=~\"$Server\"}[$__rate_interval])) / (1024*1024))[$trend_window:])", - "legendFormat": "{{instance}} - {{database_name}} - read", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "quantile_over_time($percentile_q, (sum by (instance, database_name) (rate(mssql_virtualfilestats__num_of_bytes_written{instance=~\"$Server\"}[$__rate_interval])) / (1024*1024))[$trend_window:])", - "legendFormat": "{{instance}} - {{database_name}} - write", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 103, - "type": "timeseries", - "title": "Core Metrics - ${trend_by} TREND - Database IOPS - Server ___[${Server}]___", - "description": "Per-database reads/writes per second at the $trend_by window.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 16, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "iops", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "quantile_over_time($percentile_q, (sum by (instance, database_name) (rate(mssql_virtualfilestats__num_of_reads{instance=~\"$Server\"}[$__rate_interval])))[$trend_window:])", - "legendFormat": "{{instance}} - {{database_name}} - reads", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "quantile_over_time($percentile_q, (sum by (instance, database_name) (rate(mssql_virtualfilestats__num_of_writes{instance=~\"$Server\"}[$__rate_interval])))[$trend_window:])", - "legendFormat": "{{instance}} - {{database_name}} - writes", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 104, - "type": "timeseries", - "title": "Core Metrics - ${trend_by} TREND - OS CPU - Max ${max_servers} Servers", - "description": "OS CPU % per server, top-N by $percentile at $trend_by window.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 24, - "w": 12, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "percent", - "min": 0, - "max": 100, - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "topk($max_servers, quantile_over_time($percentile_q, (100 - (avg by (instance) (rate(windows_cpu_time_total{mode=\"idle\",instance=~\"$Server\"}[$__rate_interval])) * 100))[$trend_window:]))", - "legendFormat": "{{instance}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 105, - "type": "timeseries", - "title": "Core Metrics - ${trend_by} TREND - SQL CPU - Max ${max_servers} Servers", - "description": "SQL CPU % per server, top-N by $percentile at $trend_by window.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 12, - "y": 24, - "w": 12, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "percent", - "min": 0, - "max": 100, - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "topk($max_servers, quantile_over_time($percentile_q, (avg by (instance) (mssql_cpu_utilization_percentage{instance=~\"$Server\"}))[$trend_window:]))", - "legendFormat": "{{instance}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 106, - "type": "timeseries", - "title": "Core Metrics - ${trend_by} TREND - Disk Latency - Max ${max_servers} Servers", - "description": "OS-level disk latency (s/IO) per volume. top-N by $percentile.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 32, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "s", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "topk($max_servers, quantile_over_time($percentile_q, (avg by (instance, volume) (rate(windows_logical_disk_read_latency_seconds_total{instance=~\"$Server\"}[$__rate_interval]) / clamp_min(rate(windows_logical_disk_reads_total{instance=~\"$Server\"}[$__rate_interval]), 1)))[$trend_window:]))", - "legendFormat": "{{instance}} {{volume}} read", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "topk($max_servers, quantile_over_time($percentile_q, (avg by (instance, volume) (rate(windows_logical_disk_write_latency_seconds_total{instance=~\"$Server\"}[$__rate_interval]) / clamp_min(rate(windows_logical_disk_writes_total{instance=~\"$Server\"}[$__rate_interval]), 1)))[$trend_window:]))", - "legendFormat": "{{instance}} {{volume}} write", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 107, - "type": "timeseries", - "title": "Core Metrics - ${trend_by} TREND - Requests - Max ${max_servers} Servers", - "description": "Batch requests/sec per server, top-N by $percentile.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 40, - "w": 12, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "reqps", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "topk($max_servers, quantile_over_time($percentile_q, (sum by (instance) (rate(mssql_batch_requests{instance=~\"$Server\"}[$__rate_interval])))[$trend_window:]))", - "legendFormat": "{{instance}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 108, - "type": "timeseries", - "title": "Core Metrics - ${trend_by} TREND - Available Memory - Max ${max_servers} Servers", - "description": "OS available memory per server, bottom-N (smallest) at $percentile quantile over $trend_by window.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 12, - "y": 40, - "w": 12, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "bytes", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "bottomk($max_servers, quantile_over_time($percentile_q, (avg by (instance) (windows_memory_available_bytes{instance=~\"$Server\"}))[$trend_window:]))", - "legendFormat": "{{instance}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 109, - "type": "timeseries", - "title": "Core Metrics - ${trend_by} TREND - Connections - Max ${max_servers} Servers", - "description": "SQL connection count per server, top-N by $percentile.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 48, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "topk($max_servers, quantile_over_time($percentile_q, (sum by (instance) (mssql_connections{instance=~\"$Server\"}))[$trend_window:]))", - "legendFormat": "{{instance}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - } - ], - "refresh": "30s", - "schemaVersion": 42, - "tags": [ - "mssql", - "sqlmonitor", - "core-metrics", - "prometheus" - ], - "templating": { - "list": [ - { - "name": "DS_PROMETHEUS", - "type": "datasource", - "label": "Data Source", - "query": "prometheus", - "current": { - "text": "", - "value": "${DS_PROMETHEUS}", - "selected": true - }, - "refresh": 1, - "hide": 0, - "regex": "", - "skipUrlSync": false - }, - { - "name": "Server", - "type": "query", - "label": "SQL Instance", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_up, instance)", - "query": { - "qryType": 1, - "query": "label_values(mssql_up, instance)", - "refId": "PrometheusVariableQueryEditor-Server" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "trend_by", - "type": "custom", - "label": "Trend By", - "query": "Hourly,Daily", - "options": [ - { - "text": "Hourly", - "value": "Hourly", - "selected": true - }, - { - "text": "Daily", - "value": "Daily", - "selected": false - } - ], - "current": { - "text": "Hourly", - "value": "Hourly", - "selected": true - }, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "trend_window", - "type": "custom", - "label": "Trend Window", - "query": "1h,1d", - "options": [ - { - "text": "1h", - "value": "1h", - "selected": true - }, - { - "text": "1d", - "value": "1d", - "selected": false - } - ], - "current": { - "text": "1h", - "value": "1h", - "selected": true - }, - "hide": 2, - "skipUrlSync": false - }, - { - "name": "percentile", - "type": "custom", - "label": "Percentile", - "query": "p50,p75,p95,p99,max", - "options": [ - { - "text": "p50", - "value": "p50", - "selected": false - }, - { - "text": "p75", - "value": "p75", - "selected": false - }, - { - "text": "p95", - "value": "p95", - "selected": true - }, - { - "text": "p99", - "value": "p99", - "selected": false - }, - { - "text": "max", - "value": "max", - "selected": false - } - ], - "current": { - "text": "p95", - "value": "p95", - "selected": true - }, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "percentile_q", - "type": "custom", - "label": "Percentile Q", - "query": "0.5,0.75,0.95,0.99,1.0", - "options": [ - { - "text": "0.5", - "value": "0.5", - "selected": false - }, - { - "text": "0.75", - "value": "0.75", - "selected": false - }, - { - "text": "0.95", - "value": "0.95", - "selected": true - }, - { - "text": "0.99", - "value": "0.99", - "selected": false - }, - { - "text": "1.0", - "value": "1.0", - "selected": false - } - ], - "current": { - "text": "0.95", - "value": "0.95", - "selected": true - }, - "hide": 2, - "skipUrlSync": false - }, - { - "name": "hour_of_day", - "type": "custom", - "label": "Hour of Day (-1 = any)", - "query": "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,-1", - "options": [ - { - "text": "0", - "value": "0", - "selected": false - }, - { - "text": "1", - "value": "1", - "selected": false - }, - { - "text": "2", - "value": "2", - "selected": false - }, - { - "text": "3", - "value": "3", - "selected": false - }, - { - "text": "4", - "value": "4", - "selected": false - }, - { - "text": "5", - "value": "5", - "selected": false - }, - { - "text": "6", - "value": "6", - "selected": false - }, - { - "text": "7", - "value": "7", - "selected": false - }, - { - "text": "8", - "value": "8", - "selected": false - }, - { - "text": "9", - "value": "9", - "selected": false - }, - { - "text": "10", - "value": "10", - "selected": false - }, - { - "text": "11", - "value": "11", - "selected": false - }, - { - "text": "12", - "value": "12", - "selected": false - }, - { - "text": "13", - "value": "13", - "selected": false - }, - { - "text": "14", - "value": "14", - "selected": false - }, - { - "text": "15", - "value": "15", - "selected": false - }, - { - "text": "16", - "value": "16", - "selected": false - }, - { - "text": "17", - "value": "17", - "selected": false - }, - { - "text": "18", - "value": "18", - "selected": false - }, - { - "text": "19", - "value": "19", - "selected": false - }, - { - "text": "20", - "value": "20", - "selected": false - }, - { - "text": "21", - "value": "21", - "selected": false - }, - { - "text": "22", - "value": "22", - "selected": false - }, - { - "text": "23", - "value": "23", - "selected": false - }, - { - "text": "-1", - "value": "-1", - "selected": true - } - ], - "current": { - "text": "-1", - "value": "-1", - "selected": true - }, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "max_servers", - "type": "constant", - "label": "Max Servers", - "query": "10", - "current": { - "text": "10", - "value": "10", - "selected": false - }, - "hide": 2, - "skipUrlSync": false - } - ] - }, - "time": { - "from": "now-3h", - "to": "now" - }, - "timepicker": {}, - "timezone": "browser", - "title": "Core Metrics - Trend", - "uid": "prom_core_metrics_trend", - "version": 1, - "weekStart": "" -} diff --git a/sql_exporter/Prometheus-Dashboards/DBA Inventory.json b/sql_exporter/Prometheus-Dashboards/DBA Inventory.json deleted file mode 100644 index e254006..0000000 --- a/sql_exporter/Prometheus-Dashboards/DBA Inventory.json +++ /dev/null @@ -1,930 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__elements": {}, - "__requires": [ - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "12.0.0" - }, - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - }, - { - "type": "panel", - "id": "timeseries", - "name": "Time series", - "version": "" - }, - { - "type": "panel", - "id": "table", - "name": "Table", - "version": "" - }, - { - "type": "panel", - "id": "stat", - "name": "Stat", - "version": "" - } - ], - "annotations": { - "list": [] - }, - "description": "", - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 1, - "id": null, - "links": [], - "liveNow": false, - "panels": [ - { - "id": 101, - "type": "stat", - "title": "SQL Instances - Online", - "description": "Count of SQL Server targets currently scraping successfully (mssql_up == 1).", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 0, - "w": 6, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "green", - "value": 1 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum(mssql_up == 1)", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 102, - "type": "stat", - "title": "SQL Instances - Offline", - "description": "Count of SQL Server targets with mssql_up == 0.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 6, - "y": 0, - "w": 6, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 1 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum(mssql_up == 0)", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 103, - "type": "stat", - "title": "Availability Groups", - "description": "Distinct AG names observed across scrape targets.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 12, - "y": 0, - "w": 6, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count(count by (ag_name) (mssql_aghealth__synchronization_health))", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 104, - "type": "stat", - "title": "Hosts", - "description": "Distinct hostnames observed via mssql_service_info.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 18, - "y": 0, - "w": 6, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count(count by (host_name) (mssql_service_info))", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 105, - "type": "table", - "title": "SQL Servers - Combined Info - FILTERED", - "description": "Per-instance combined info from mssql_service_info (host/service/product) and mssql_up for online state.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 4, - "w": 24, - "h": 9 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_service_info{instance=~\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Info" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_up{instance=~\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Up" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Time": true, - "__name__": true, - "job": true, - "target": true, - "exported_job": true - }, - "renameByName": { - "instance": "Server", - "host_name": "Host", - "product_version": "Version", - "service_name": "Service", - "Value #Info": "Info", - "Value #Up": "Up?" - } - } - } - ], - "pluginVersion": "12.4.1" - }, - { - "id": 106, - "type": "text", - "title": "SQLMonitor - Instance Details - FILTERED", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ Inventory-DB columns (alias, linked-server-name, major/minor version breakdown) are not exposed to Prometheus. Use the SQL dashboard for the full detail row.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 13, - "w": 24, - "h": 7 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ Inventory-DB columns (alias, linked-server-name, major/minor version breakdown) are not exposed to Prometheus. Use the SQL dashboard for the full detail row." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 107, - "type": "text", - "title": "All Servers - Basic Info", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ dbo.vw_all_servers_basic_info (SMA agents, OS hosts, service accounts) is not mirrored in Prometheus.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 20, - "w": 24, - "h": 7 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ dbo.vw_all_servers_basic_info (SMA agents, OS hosts, service accounts) is not mirrored in Prometheus." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 108, - "type": "text", - "title": "SQL Servers - Extended Info", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ SKU / license / feature matrix \u2014 inventory table.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 27, - "w": 24, - "h": 7 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ SKU / license / feature matrix \u2014 inventory table." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 109, - "type": "text", - "title": "SQL Server Hosts", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ Host-level inventory (IP/FQDN/domain) is only in the SQLMonitor inventory DB.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 34, - "w": 24, - "h": 7 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ Host-level inventory (IP/FQDN/domain) is only in the SQLMonitor inventory DB." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 110, - "type": "table", - "title": "SQL Server Availability Groups - Online", - "description": "Per-AG replica count and distinct databases, derived from mssql_aghealth__synchronization_health labels.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 41, - "w": 24, - "h": 9 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count by (ag_name, ag_listener) (mssql_aghealth__synchronization_health{instance=~\"$Server\"})", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Replicas" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count by (ag_name, database_name) (mssql_aghealth__synchronization_health{instance=~\"$Server\"})", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Dbs" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - } - ], - "pluginVersion": "12.4.1" - }, - { - "id": 111, - "type": "text", - "title": "SQL Clusters", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ WSFC node / resource-group ownership is inventory-only.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 50, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ WSFC node / resource-group ownership is inventory-only." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 112, - "type": "text", - "title": "SQL Servers - Login Expiry", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ Login-expiry warnings come from the security-collection SQL Agent job and are stored in the inventory DB.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 58, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ Login-expiry warnings come from the security-collection SQL Agent job and are stored in the inventory DB." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 113, - "type": "text", - "title": "Login Email Mapping", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ dbo.login_email_mapping is an inventory-only lookup table.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 66, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ dbo.login_email_mapping is an inventory-only lookup table." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 114, - "type": "text", - "title": "Config Changes", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ LAMA (Look-At-My-Analysis) config-change deltas come from dbo.lama_computed_metrics \u2014 not exposed to Prometheus.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 74, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *dba-inventory*](/d/dba-inventory)\n\n_Note:_ LAMA (Look-At-My-Analysis) config-change deltas come from dbo.lama_computed_metrics \u2014 not exposed to Prometheus." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - } - ], - "refresh": "30s", - "schemaVersion": 42, - "tags": [ - "mssql", - "sqlmonitor", - "Inventory", - "prometheus" - ], - "templating": { - "list": [ - { - "name": "DS_PROMETHEUS", - "type": "datasource", - "label": "Data Source", - "query": "prometheus", - "current": { - "text": "", - "value": "${DS_PROMETHEUS}", - "selected": true - }, - "refresh": 1, - "hide": 0, - "regex": "", - "skipUrlSync": false - }, - { - "name": "Server", - "type": "query", - "label": "SQL Instance", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_up, instance)", - "query": { - "qryType": 1, - "query": "label_values(mssql_up, instance)", - "refId": "PrometheusVariableQueryEditor-Server" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - } - ] - }, - "time": { - "from": "now-3h", - "to": "now" - }, - "timepicker": {}, - "timezone": "browser", - "title": "DBA Inventory", - "uid": "prom_dba_inventory", - "version": 1, - "weekStart": "" -} diff --git a/sql_exporter/Prometheus-Dashboards/Database File IO Stats.json b/sql_exporter/Prometheus-Dashboards/Database File IO Stats.json deleted file mode 100644 index 0a17a8f..0000000 --- a/sql_exporter/Prometheus-Dashboards/Database File IO Stats.json +++ /dev/null @@ -1,1460 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__elements": {}, - "__requires": [ - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "12.0.0" - }, - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - }, - { - "type": "panel", - "id": "timeseries", - "name": "Time series", - "version": "" - }, - { - "type": "panel", - "id": "table", - "name": "Table", - "version": "" - }, - { - "type": "panel", - "id": "stat", - "name": "Stat", - "version": "" - } - ], - "annotations": { - "list": [] - }, - "description": "", - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 1, - "id": null, - "links": [], - "liveNow": false, - "panels": [ - { - "id": 101, - "type": "table", - "title": "File IO Stats ___ Since Startup", - "description": "Per-file counters since SQL Server start, straight off mssql_virtualfilestats__*: bytes read/written, IO counts and cumulative stall time (ms).", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 0, - "w": 24, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "BR" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "BW" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_virtualfilestats__num_of_reads{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "NR" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_virtualfilestats__num_of_writes{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "NW" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_virtualfilestats__io_stall_read_ms{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "SR" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_virtualfilestats__io_stall_write_ms{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "SW" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Time": true, - "__name__": true, - "job": true, - "target": true, - "exported_job": true - }, - "renameByName": { - "database_name": "Database", - "file_logical_name": "File", - "disk_volume": "Volume", - "Value #BR": "Bytes Read", - "Value #BW": "Bytes Written", - "Value #NR": "# Reads", - "Value #NW": "# Writes", - "Value #SR": "Stall Read (ms)", - "Value #SW": "Stall Write (ms)" - } - } - } - ], - "pluginVersion": "12.4.1" - }, - { - "id": 102, - "type": "table", - "title": "File IO Stats ___ Since Startup till ${__from:date:YYYY-MM-DD HH.mm}", - "description": "Counter values at the dashboard's `from` time \u2014 accumulated IO from SQL startup until the start of the visible range.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 10, - "w": 24, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"} @ end() offset ($__to - $__from)", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 103, - "type": "table", - "title": "File IO Stats ___ In Selected Time Duration ___${__from:date:YYYY-MM-DD HH.mm} \u2192 ${__to:date:YYYY-MM-DD HH.mm}", - "description": "Delta of each virtualfilestats counter over the dashboard's visible range (increase()).", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 20, - "w": 24, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "increase(mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range])", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "BR" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "increase(mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range])", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "BW" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "increase(mssql_virtualfilestats__num_of_reads{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range])", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "NR" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "increase(mssql_virtualfilestats__num_of_writes{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range])", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "NW" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "increase(mssql_virtualfilestats__io_stall_read_ms{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range])", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "SR" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "increase(mssql_virtualfilestats__io_stall_write_ms{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range])", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "SW" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Time": true, - "__name__": true, - "job": true, - "target": true, - "exported_job": true - } - } - } - ], - "pluginVersion": "12.4.1" - }, - { - "id": 104, - "type": "timeseries", - "title": "[${Server}] - Db File IO Stats - Read/Writes Data", - "description": "Per-file bytes-read and bytes-written rates (bytes/sec), derived from the two underlying counters.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 30, - "w": 24, - "h": 12 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "Bps", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__rate_interval])", - "legendFormat": "read \u2022 {{database_name}} / {{file_logical_name}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "Reads" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__rate_interval])", - "legendFormat": "write \u2022 {{database_name}} / {{file_logical_name}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "Writes" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 105, - "type": "timeseries", - "title": "[${Server}] - Db File IO Stats - # Read/Writes", - "description": "Per-file IO operations per second (reads + writes), derived from the operation counters.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 42, - "w": 24, - "h": 12 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "ops", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_virtualfilestats__num_of_reads{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__rate_interval])", - "legendFormat": "reads/s \u2022 {{database_name}} / {{file_logical_name}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "Reads" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_virtualfilestats__num_of_writes{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__rate_interval])", - "legendFormat": "writes/s \u2022 {{database_name}} / {{file_logical_name}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "Writes" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 106, - "type": "timeseries", - "title": "[${Server}] - Db IO Stats - Read/Writes Data", - "description": "Aggregated per-database read/write throughput (Bps), summed across files.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 54, - "w": 24, - "h": 12 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "Bps", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum by (database_name) (rate(mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__rate_interval]))", - "legendFormat": "read \u2022 {{database_name}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "R" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum by (database_name) (rate(mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__rate_interval]))", - "legendFormat": "write \u2022 {{database_name}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "W" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 107, - "type": "table", - "title": "Database IO Stats ___ Since Startup", - "description": "Per-database aggregates of the filestats counters from SQL Server startup.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 66, - "w": 24, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum by (instance, database_name) (mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"})", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "BR" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum by (instance, database_name) (mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"})", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "BW" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum by (instance, database_name) (mssql_virtualfilestats__io_stall_read_ms{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"})", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "SR" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum by (instance, database_name) (mssql_virtualfilestats__io_stall_write_ms{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"})", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "SW" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - } - ], - "pluginVersion": "12.4.1" - }, - { - "id": 108, - "type": "table", - "title": "Database IO Stats ___ In Selected Time Duration", - "description": "Per-database delta over the dashboard range.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 76, - "w": 24, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum by (instance, database_name) (increase(mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range]))", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "BR" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum by (instance, database_name) (increase(mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range]))", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "BW" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - } - ], - "pluginVersion": "12.4.1" - }, - { - "id": 109, - "type": "table", - "title": "Database IO Stats ___ Prior Window ___ DAY(+/-)", - "description": "Same aggregate delta as above but over the time window immediately *before* the dashboard range. Use side-by-side with the previous panel for day-over-day comparison.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 86, - "w": 24, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum by (instance, database_name) (increase(mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range] @ end() offset $__range))", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "BR" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum by (instance, database_name) (increase(mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range] @ end() offset $__range))", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "BW" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - } - ], - "pluginVersion": "12.4.1" - }, - { - "id": 110, - "type": "table", - "title": "Disk IO Stats ___ Since Startup", - "description": "Per-volume aggregates of the filestats counters.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 96, - "w": 24, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum by (instance, disk_volume) (mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"})", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "BR" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum by (instance, disk_volume) (mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"})", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "BW" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - } - ], - "pluginVersion": "12.4.1" - }, - { - "id": 111, - "type": "table", - "title": "Disk IO Stats ___ In Selected Time Duration", - "description": "Per-volume delta over the dashboard range.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 106, - "w": 24, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum by (instance, disk_volume) (increase(mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range]))", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "BR" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum by (instance, disk_volume) (increase(mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range]))", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "BW" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - } - ], - "pluginVersion": "12.4.1" - }, - { - "id": 112, - "type": "table", - "title": "Disk IO Stats ___ Prior Window", - "description": "Per-volume delta over the window immediately before the dashboard range.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 116, - "w": 24, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum by (instance, disk_volume) (increase(mssql_virtualfilestats__num_of_bytes_read{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range] @ end() offset $__range))", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "BR" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum by (instance, disk_volume) (increase(mssql_virtualfilestats__num_of_bytes_written{instance=\"$Server\",database_name=~\"$database\",disk_volume=~\"$disk_drive\"}[$__range] @ end() offset $__range))", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "BW" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - } - ], - "pluginVersion": "12.4.1" - } - ], - "refresh": "30s", - "schemaVersion": 42, - "tags": [ - "mssql", - "sqlmonitor", - "IO Stats", - "prometheus" - ], - "templating": { - "list": [ - { - "name": "DS_PROMETHEUS", - "type": "datasource", - "label": "Data Source", - "query": "prometheus", - "current": { - "text": "", - "value": "${DS_PROMETHEUS}", - "selected": true - }, - "refresh": 1, - "hide": 0, - "regex": "", - "skipUrlSync": false - }, - { - "name": "Server", - "type": "query", - "label": "SQL Instance", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_up, instance)", - "query": { - "qryType": 1, - "query": "label_values(mssql_up, instance)", - "refId": "PrometheusVariableQueryEditor-Server" - }, - "refresh": 1, - "sort": 1, - "multi": false, - "includeAll": false, - "allValue": null, - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "database", - "type": "query", - "label": "Database", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_virtualfilestats__num_of_reads{instance=\"$Server\"}, database_name)", - "query": { - "qryType": 1, - "query": "label_values(mssql_virtualfilestats__num_of_reads{instance=\"$Server\"}, database_name)", - "refId": "PrometheusVariableQueryEditor-database" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "disk_drive", - "type": "query", - "label": "Disk", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_virtualfilestats__num_of_reads{instance=\"$Server\"}, disk_volume)", - "query": { - "qryType": 1, - "query": "label_values(mssql_virtualfilestats__num_of_reads{instance=\"$Server\"}, disk_volume)", - "refId": "PrometheusVariableQueryEditor-disk_drive" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "top_n", - "type": "constant", - "label": "Top N Rows", - "query": "25", - "current": { - "text": "25", - "value": "25", - "selected": false - }, - "hide": 2, - "skipUrlSync": false - } - ] - }, - "time": { - "from": "now-3h", - "to": "now" - }, - "timepicker": {}, - "timezone": "browser", - "title": "Database File IO Stats", - "uid": "prom_database_file_io_stats", - "version": 1, - "weekStart": "" -} diff --git a/sql_exporter/Prometheus-Dashboards/Disk Space.json b/sql_exporter/Prometheus-Dashboards/Disk Space.json deleted file mode 100644 index 5665ad7..0000000 --- a/sql_exporter/Prometheus-Dashboards/Disk Space.json +++ /dev/null @@ -1,673 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__elements": {}, - "__requires": [ - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "12.0.0" - }, - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - }, - { - "type": "panel", - "id": "timeseries", - "name": "Time series", - "version": "" - }, - { - "type": "panel", - "id": "table", - "name": "Table", - "version": "" - }, - { - "type": "panel", - "id": "stat", - "name": "Stat", - "version": "" - } - ], - "annotations": { - "list": [] - }, - "description": "", - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 1, - "id": null, - "links": [], - "liveNow": false, - "panels": [ - { - "id": 101, - "type": "table", - "title": "Disk Space - [$Server] - [$perfmon_host_name]", - "description": "Current capacity / free / used / % used per volume from windows_exporter. Uses logical_disk metrics.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 0, - "w": 24, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "bytes", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_logical_disk_size_bytes{instance=\"$Server\"}", - "legendFormat": "{{volume}}", - "range": false, - "instant": true, - "format": "table", - "refId": "Size" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_logical_disk_free_bytes{instance=\"$Server\"}", - "legendFormat": "{{volume}}", - "range": false, - "instant": true, - "format": "table", - "refId": "Free" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_logical_disk_size_bytes{instance=\"$Server\"} - windows_logical_disk_free_bytes{instance=\"$Server\"}", - "legendFormat": "{{volume}}", - "range": false, - "instant": true, - "format": "table", - "refId": "Used" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "100 * (windows_logical_disk_size_bytes{instance=\"$Server\"} - windows_logical_disk_free_bytes{instance=\"$Server\"}) / clamp_min(windows_logical_disk_size_bytes{instance=\"$Server\"}, 1)", - "legendFormat": "{{volume}}", - "range": false, - "instant": true, - "format": "table", - "refId": "PctUsed" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Time": true, - "__name__": true, - "job": true, - "target": true - }, - "renameByName": { - "volume": "Volume", - "instance": "Host", - "Value #Size": "Size (bytes)", - "Value #Free": "Free (bytes)", - "Value #Used": "Used (bytes)", - "Value #PctUsed": "% Used" - } - } - } - ], - "pluginVersion": "12.4.1" - }, - { - "id": 102, - "type": "timeseries", - "title": "Used Disk Space - [$Server] - [$perfmon_host_name]", - "description": "Used bytes per logical volume over time.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 10, - "w": 24, - "h": 12 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "bytes", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_logical_disk_size_bytes{instance=\"$Server\"} - windows_logical_disk_free_bytes{instance=\"$Server\"}", - "legendFormat": "{{volume}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 103, - "type": "timeseries", - "title": "% Used Disk Space - [$Server] - [$perfmon_host_name]", - "description": "Percent used per logical volume over time.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 22, - "w": 24, - "h": 12 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "percent", - "min": 0, - "max": 100, - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "100 * (windows_logical_disk_size_bytes{instance=\"$Server\"} - windows_logical_disk_free_bytes{instance=\"$Server\"}) / clamp_min(windows_logical_disk_size_bytes{instance=\"$Server\"}, 1)", - "legendFormat": "{{volume}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 104, - "type": "table", - "title": "Db File Space Usage - [$Server] - [$perfmon_host_name]", - "description": "Per database file: allocated size, size on disk, and computed free space. From mssql_virtualfilestats__* and mssql_database_file_size_bytes.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 34, - "w": 24, - "h": 16 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "bytes", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_database_file_size_bytes{instance=\"$Server\"}", - "legendFormat": "{{database}}/{{file_id}}", - "range": false, - "instant": true, - "format": "table", - "refId": "Size" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_virtualfilestats__size_on_disk_bytes{instance=\"$Server\"}", - "legendFormat": "{{database_name}}/{{file_logical_name}}", - "range": false, - "instant": true, - "format": "table", - "refId": "OnDisk" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Time": true, - "__name__": true, - "job": true, - "target": true - }, - "renameByName": { - "database_name": "Database", - "file_logical_name": "Logical Name", - "file_location": "Physical Name", - "disk_volume": "Volume", - "Value #Size": "Allocated (bytes)", - "Value #OnDisk": "Size on Disk (bytes)" - } - } - } - ], - "pluginVersion": "12.4.1" - }, - { - "id": 105, - "type": "timeseries", - "title": "Db File Size - Trend - [$Server] - [$perfmon_host_name]", - "description": "Per database file size_on_disk over time.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 50, - "w": 24, - "h": 16 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "bytes", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_virtualfilestats__size_on_disk_bytes{instance=\"$Server\"}", - "legendFormat": "{{database_name}} / {{file_logical_name}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - } - ], - "refresh": "30s", - "schemaVersion": 42, - "tags": [ - "mssql", - "sqlmonitor", - "Disk Space", - "prometheus" - ], - "templating": { - "list": [ - { - "name": "DS_PROMETHEUS", - "type": "datasource", - "label": "Data Source", - "query": "prometheus", - "current": { - "text": "", - "value": "${DS_PROMETHEUS}", - "selected": true - }, - "refresh": 1, - "hide": 0, - "regex": "", - "skipUrlSync": false - }, - { - "name": "Server", - "type": "query", - "label": "SQL Instance", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_up, instance)", - "query": { - "qryType": 1, - "query": "label_values(mssql_up, instance)", - "refId": "PrometheusVariableQueryEditor-Server" - }, - "refresh": 1, - "sort": 1, - "multi": false, - "includeAll": false, - "allValue": null, - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "perfmon_host_name", - "type": "query", - "label": "Perfmon Host Name", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_service_info{instance=\"$Server\"}, host_name)", - "query": { - "qryType": 1, - "query": "label_values(mssql_service_info{instance=\"$Server\"}, host_name)", - "refId": "PrometheusVariableQueryEditor-perfmon_host_name" - }, - "refresh": 1, - "sort": 1, - "multi": false, - "includeAll": false, - "allValue": null, - "regex": "", - "current": {}, - "hide": 2, - "skipUrlSync": false - } - ] - }, - "time": { - "from": "now-3h", - "to": "now" - }, - "timepicker": {}, - "timezone": "browser", - "title": "Disk Space", - "uid": "prom_disk_space", - "version": 1, - "weekStart": "" -} diff --git a/sql_exporter/Prometheus-Dashboards/Monitoring - Live - All Servers.json b/sql_exporter/Prometheus-Dashboards/Monitoring - Live - All Servers.json deleted file mode 100644 index 8db8159..0000000 --- a/sql_exporter/Prometheus-Dashboards/Monitoring - Live - All Servers.json +++ /dev/null @@ -1,1573 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__elements": {}, - "__requires": [ - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "12.0.0" - }, - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - }, - { - "type": "panel", - "id": "timeseries", - "name": "Time series", - "version": "" - }, - { - "type": "panel", - "id": "table", - "name": "Table", - "version": "" - }, - { - "type": "panel", - "id": "stat", - "name": "Stat", - "version": "" - } - ], - "annotations": { - "list": [] - }, - "description": "", - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 1, - "id": null, - "links": [], - "liveNow": false, - "panels": [ - { - "id": 101, - "type": "stat", - "title": "Basic Info - Online", - "description": "Instances with mssql_up==1 matching the filter.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 0, - "w": 4, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum(mssql_up{instance=~\"$Server\"} == 1)", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 102, - "type": "stat", - "title": "OFFLINE Instances", - "description": "mssql_up==0.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 4, - "y": 0, - "w": 4, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 1 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum(mssql_up{instance=~\"$Server\"} == 0)", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 103, - "type": "stat", - "title": "Disks - CRITICAL", - "description": "Logical disks with >$disk_critical_pct% used, via windows_logical_disk metrics.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 8, - "y": 0, - "w": 4, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 1 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count(100 * (1 - windows_logical_disk_free_bytes{instance=~\"$Server\"} / clamp_min(windows_logical_disk_size_bytes{instance=~\"$Server\"}, 1)) > $disk_critical_pct)", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 104, - "type": "stat", - "title": "Disks - WARNING", - "description": "Logical disks between warning and critical thresholds.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 12, - "y": 0, - "w": 4, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "orange", - "value": 1 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count(100 * (1 - windows_logical_disk_free_bytes{instance=~\"$Server\"} / clamp_min(windows_logical_disk_size_bytes{instance=~\"$Server\"}, 1)) > $disk_warning_pct < $disk_critical_pct)", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 105, - "type": "stat", - "title": "Failed Jobs", - "description": "Jobs whose most recent completed run failed (requires the mssql_sqlagent_jobs collector).", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 16, - "y": 0, - "w": 4, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 1 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count(mssql_sqlagent_job__last_run_outcome{instance=~\"$Server\"} == 0)", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 106, - "type": "stat", - "title": "Full Backups Overdue", - "description": "Databases with a Full backup older than $full_threshold_days days.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 20, - "y": 0, - "w": 4, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 1 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count(mssql_backup__age_seconds{instance=~\"$Server\",backup_type=\"D\"} > ($full_threshold_days * 86400))", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 107, - "type": "table", - "title": "All Servers - Basic Details", - "description": "Per-instance mssql_service_info joined with mssql_up.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 4, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_service_info{instance=~\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Info" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_up{instance=~\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Up" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - } - ], - "pluginVersion": "12.4.1" - }, - { - "id": 108, - "type": "table", - "title": "Servers with Data Collection Issues", - "description": "Instances whose last successful scrape is more than 5 minutes old, based on scrape_samples_scraped and the `up` metric.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 12, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "(time() - timestamp(up{instance=~\"$Server\"} == 1)) > 300", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 109, - "type": "table", - "title": "CRITICAL - OFFLINE Instances", - "description": "Instances currently reporting mssql_up==0.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 20, - "w": 12, - "h": 6 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_up{instance=~\"$Server\"} == 0", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 110, - "type": "text", - "title": "CRITICAL - OFFLINE Aliases", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ Alias-instance topology is stored in the inventory DB (dbo.sql_instances.alias) \u2014 Prometheus labels only carry the primary endpoint.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 12, - "y": 20, - "w": 12, - "h": 6 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ Alias-instance topology is stored in the inventory DB (dbo.sql_instances.alias) \u2014 Prometheus labels only carry the primary endpoint." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 111, - "type": "table", - "title": "SQLAgent Service OFFLINE", - "description": "Instances where the SQL Agent Windows service is not running (windows_service_state{name=~\"SQLSERVERAGENT.*\",state!=\"running\"}).", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 26, - "w": 24, - "h": 6 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_service_state{name=~\"SQLSERVERAGENT.*\",state!=\"running\"} == 1", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 112, - "type": "table", - "title": "Backups - Non-AG Databases - Issues", - "description": "Databases whose most recent Full/Diff/Log backup is older than the configured thresholds. Driven by mssql_backup__age_seconds.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 32, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_backup__age_seconds{instance=~\"$Server\",backup_type=\"D\"} > ($full_threshold_days * 86400)", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Full" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_backup__age_seconds{instance=~\"$Server\",backup_type=\"L\"} > ($tlog_threshold_minutes * 60)", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Log" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - } - ], - "pluginVersion": "12.4.1" - }, - { - "id": 113, - "type": "text", - "title": "Backups - AG Databases - Issues", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ Distinguishing AG vs non-AG databases requires the inventory DB. Use the SQL dashboard for the AG-split view.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 40, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ Distinguishing AG vs non-AG databases requires the inventory DB. Use the SQL dashboard for the AG-split view." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 114, - "type": "table", - "title": "SQLMonitor Jobs - Require Attention", - "description": "SQL Agent jobs whose latest run did not succeed, or whose next run is more than 12h overdue.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 48, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_sqlagent_job__last_run_outcome{instance=~\"$Server\"} != 1", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 115, - "type": "table", - "title": "Disk Space - All Servers", - "description": "Per-volume % used across all selected instances.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 56, - "w": 24, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "percent", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "100 * (1 - windows_logical_disk_free_bytes{instance=~\"$Server\"} / clamp_min(windows_logical_disk_size_bytes{instance=~\"$Server\"}, 1))", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 116, - "type": "table", - "title": "All Servers - AlwaysOn Latency", - "description": "Per-(replica, database) commit latency seconds from mssql_aghealth__latency_seconds.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 66, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "s", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__latency_seconds{instance=~\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 117, - "type": "text", - "title": "Log Space Consumers", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ log_space_consumers collector not yet ported to Prometheus. Relies on dbo.log_space_consumers cache table.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 74, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ log_space_consumers collector not yet ported to Prometheus. Relies on dbo.log_space_consumers cache table." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 118, - "type": "text", - "title": "TempDb Usage", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ tempdb_space_usage collector not yet ported.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 82, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ tempdb_space_usage collector not yet ported." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 119, - "type": "text", - "title": "Alerts - Aggregated by Type", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ Alert history rows live in dbo.alert_history \u2014 accessible only from the SQLMonitor inventory DB.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 90, - "w": 12, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ Alert history rows live in dbo.alert_history \u2014 accessible only from the SQLMonitor inventory DB." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 120, - "type": "text", - "title": "All Servers - Alert History", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ Same source as above (dbo.alert_history).", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 12, - "y": 90, - "w": 12, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-all-servers*](/d/monitoring-live-all-servers)\n\n_Note:_ Same source as above (dbo.alert_history)." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 121, - "type": "table", - "title": "Servers Need Help - Health Metrics", - "description": "Servers where any of the core health gauges is outside the expected range: PLE < 300, or memory grants pending > 0, or blocking > 0.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 100, - "w": 24, - "h": 12 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__page_life_expectancy_seconds{instance=~\"$Server\"} < 300", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "PLE" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__memory_grants_pending{instance=~\"$Server\"} > 0", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Grants" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__processes_blocked{instance=~\"$Server\"} > 0", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Blocked" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - } - ], - "pluginVersion": "12.4.1" - } - ], - "refresh": "30s", - "schemaVersion": 42, - "tags": [ - "mssql", - "sqlmonitor", - "Live", - "All Servers", - "prometheus" - ], - "templating": { - "list": [ - { - "name": "DS_PROMETHEUS", - "type": "datasource", - "label": "Data Source", - "query": "prometheus", - "current": { - "text": "", - "value": "${DS_PROMETHEUS}", - "selected": true - }, - "refresh": 1, - "hide": 0, - "regex": "", - "skipUrlSync": false - }, - { - "name": "Server", - "type": "query", - "label": "SQL Instance", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_up, instance)", - "query": { - "qryType": 1, - "query": "label_values(mssql_up, instance)", - "refId": "PrometheusVariableQueryEditor-Server" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "full_threshold_days", - "type": "constant", - "label": "full_threshold_days", - "query": "7", - "current": { - "text": "7", - "value": "7", - "selected": false - }, - "hide": 2, - "skipUrlSync": false - }, - { - "name": "diff_threshold_hours", - "type": "constant", - "label": "diff_threshold_hours", - "query": "24", - "current": { - "text": "24", - "value": "24", - "selected": false - }, - "hide": 2, - "skipUrlSync": false - }, - { - "name": "tlog_threshold_minutes", - "type": "constant", - "label": "tlog_threshold_minutes", - "query": "30", - "current": { - "text": "30", - "value": "30", - "selected": false - }, - "hide": 2, - "skipUrlSync": false - }, - { - "name": "disk_warning_pct", - "type": "constant", - "label": "disk_warning_pct", - "query": "80", - "current": { - "text": "80", - "value": "80", - "selected": false - }, - "hide": 2, - "skipUrlSync": false - }, - { - "name": "disk_critical_pct", - "type": "constant", - "label": "disk_critical_pct", - "query": "90", - "current": { - "text": "90", - "value": "90", - "selected": false - }, - "hide": 2, - "skipUrlSync": false - } - ] - }, - "time": { - "from": "now-3h", - "to": "now" - }, - "timepicker": {}, - "timezone": "browser", - "title": "Monitoring - Live - All Servers", - "uid": "prom_monitoring_live_all_servers", - "version": 1, - "weekStart": "" -} diff --git a/sql_exporter/Prometheus-Dashboards/Monitoring - Live - Distributed.json b/sql_exporter/Prometheus-Dashboards/Monitoring - Live - Distributed.json deleted file mode 100644 index fd7205c..0000000 --- a/sql_exporter/Prometheus-Dashboards/Monitoring - Live - Distributed.json +++ /dev/null @@ -1,4677 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__elements": {}, - "__requires": [ - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "12.0.0" - }, - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - }, - { - "type": "panel", - "id": "timeseries", - "name": "Time series", - "version": "" - }, - { - "type": "panel", - "id": "table", - "name": "Table", - "version": "" - }, - { - "type": "panel", - "id": "stat", - "name": "Stat", - "version": "" - } - ], - "annotations": { - "list": [] - }, - "description": "", - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 1, - "id": null, - "links": [], - "liveNow": false, - "panels": [ - { - "id": 101, - "type": "stat", - "title": "Memory Model", - "description": "Memory model reported by mssql_service_info.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 0, - "w": 2, - "h": 2 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_service_info{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 102, - "type": "stat", - "title": "Memory Status", - "description": "1 when OS reports available memory.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 2, - "y": 0, - "w": 2, - "h": 2 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_memory_available_bytes{instance=\"$Server\"} > 0", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 103, - "type": "stat", - "title": "OS Uptime", - "description": "Seconds since OS boot (windows_exporter).", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 4, - "y": 0, - "w": 3, - "h": 2 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "s", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_system_system_up_time{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 104, - "type": "stat", - "title": "OS Processes", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 7, - "y": 0, - "w": 4, - "h": 2 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_system_processes{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 105, - "type": "stat", - "title": "OS CPU %", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 11, - "y": 0, - "w": 3, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "percent", - "decimals": 1 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "100 - (avg without(cpu,mode) (rate(windows_cpu_time_total{instance=\"$Server\",mode=\"idle\"}[$__rate_interval])) * 100)", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 106, - "type": "stat", - "title": "Idle CPU %", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 14, - "y": 0, - "w": 3, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "percent", - "decimals": 1 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "avg without(cpu,mode) (rate(windows_cpu_time_total{instance=\"$Server\",mode=\"idle\"}[$__rate_interval])) * 100", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 107, - "type": "stat", - "title": "PLE", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 17, - "y": 0, - "w": 2, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "green", - "value": 300 - } - ] - }, - "unit": "s", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__page_life_expectancy_seconds{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 108, - "type": "table", - "title": "AG Details", - "description": "Replica/DB sync state from mssql_aghealth__*.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 19, - "y": 0, - "w": 5, - "h": 5 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__synchronization_health{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 109, - "type": "stat", - "title": "Box Memory", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 3, - "w": 2, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "bytes", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_cs_physical_memory_bytes{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 110, - "type": "stat", - "title": "Available Memory", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 2, - "y": 3, - "w": 2, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "bytes", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_memory_available_bytes{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 111, - "type": "stat", - "title": "CPU (OS/SQL)", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 8, - "y": 3, - "w": 3, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_sqlserver_cpu_count{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 112, - "type": "stat", - "title": "Processor", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 11, - "y": 4, - "w": 5, - "h": 2 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_cs_logical_processors{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 113, - "type": "stat", - "title": "Machine Type", - "description": "1 if hypervisor detected (VM).", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 16, - "y": 4, - "w": 3, - "h": 2 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_cs_hypervisor{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "LIVE Metrics - [$Server]", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 6, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 114, - "type": "stat", - "title": "Blocked > $blocked_threshold_seconds s", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 7, - "w": 3, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 1 - } - ] - }, - "unit": "short", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum(mssql_whoisactive__avg_elapsed_time{instance=\"$Server\",blocked_session_count!=\"0\"} > $blocked_threshold_seconds) or vector(0)", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 115, - "type": "stat", - "title": "SQL Used Memory", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 3, - "y": 7, - "w": 2, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "bytes", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__total_server_memory_bytes{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 116, - "type": "stat", - "title": "Allocated M/r %", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 5, - "y": 7, - "w": 2, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "percent", - "decimals": 1 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "100 * mssql_perfmon__total_server_memory_bytes{instance=\"$Server\"} / clamp_min(mssql_perfmon__target_server_memory_bytes{instance=\"$Server\"}, 1)", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 117, - "type": "stat", - "title": "Connections", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 7, - "y": 7, - "w": 2, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__user_connections{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 118, - "type": "stat", - "title": "Active Requests", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 9, - "y": 7, - "w": 2, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_sqlserver_active_requests{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 119, - "type": "stat", - "title": "SQL CPU %", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 11, - "y": 7, - "w": 3, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "percent", - "decimals": 1 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_cpu_utilization__sql_cpu_utilization{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 120, - "type": "stat", - "title": "IsHadrEnabled", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 14, - "y": 7, - "w": 2, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_sqlserver_is_hadr_enabled{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 121, - "type": "stat", - "title": "IsClustered", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 16, - "y": 7, - "w": 2, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_sqlserver_is_clustered{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 122, - "type": "stat", - "title": "SQL Version", - "description": "Value is 1; label `product_version` holds the version string.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 18, - "y": 7, - "w": 6, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_service_info{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 123, - "type": "stat", - "title": "Longest Blocking (s)", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 10, - "w": 3, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "s", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "max(mssql_whoisactive__avg_elapsed_time{instance=\"$Server\"}) or vector(0)", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 124, - "type": "stat", - "title": "Memory Grants Pending", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 3, - "y": 10, - "w": 3, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 1 - } - ] - }, - "unit": "short", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__memory_grants_pending{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 125, - "type": "stat", - "title": "Page Faults/sec", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 6, - "y": 10, - "w": 3, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(windows_memory_page_faults_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 126, - "type": "stat", - "title": "% User Mode", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 9, - "y": 10, - "w": 3, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "percent", - "decimals": 1 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "avg without(cpu) (rate(windows_cpu_time_total{instance=\"$Server\",mode=\"user\"}[$__rate_interval])) * 100", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 127, - "type": "stat", - "title": "Disk Latency (avg ms)", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 12, - "y": 10, - "w": 3, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "ms", - "decimals": 1 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "avg(rate(windows_logical_disk_read_seconds_total{instance=\"$Server\"}[$__rate_interval]) / clamp_min(rate(windows_logical_disk_reads_total{instance=\"$Server\"}[$__rate_interval]), 1) * 1000)", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 128, - "type": "stat", - "title": "Waits / Core / Minute", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 15, - "y": 10, - "w": 3, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "decimals": 1 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "60 * sum(rate(mssql_waits__wait_time_seconds{instance=\"$Server\"}[$__rate_interval])) / clamp_min(mssql_sqlserver_cpu_count{instance=\"$Server\"}, 1)", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 129, - "type": "stat", - "title": "SQL Uptime", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 18, - "y": 10, - "w": 3, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "s", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_sqlserver_uptime_seconds{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 130, - "type": "stat", - "title": "SQL Start Time UTC", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 21, - "y": 10, - "w": 3, - "h": 3 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "dateTimeAsIso", - "decimals": 0 - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "time() - mssql_sqlserver_uptime_seconds{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 131, - "type": "text", - "title": "SQL Server Patching Details", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ CU/KB/patch history is stored in the inventory DB (dbo.sql_server_patching) \u2014 not a Prometheus metric.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 13, - "w": 24, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ CU/KB/patch history is stored in the inventory DB (dbo.sql_server_patching) \u2014 not a Prometheus metric." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "AlwaysOn Availability Groups - Status", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 17, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 132, - "type": "table", - "title": "AlwaysOn Availability Group Health Metrics", - "description": "Per-(replica, database) AG health: state / queues / rates / latency, from mssql_aghealth__*.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 18, - "w": 24, - "h": 9 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__synchronization_health{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Health" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__latency_seconds{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Lat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__log_send_queue_size{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "LSQ" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_aghealth__redo_queue_size{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "RQ" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - } - ], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "Trend - CPU Utilization", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 27, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 133, - "type": "timeseries", - "title": "CPU %", - "description": "SQL vs OS CPU from ring-buffer metrics.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 28, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "percent", - "min": 0, - "max": 100, - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_cpu_utilization__sql_cpu_utilization{instance=\"$Server\"}", - "legendFormat": "SQL CPU", - "range": true, - "instant": false, - "format": "time_series", - "refId": "Sql" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_cpu_utilization__system_idle_process{instance=\"$Server\"}", - "legendFormat": "Idle", - "range": true, - "instant": false, - "format": "time_series", - "refId": "Idle" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "100 - mssql_cpu_utilization__system_idle_process{instance=\"$Server\"}", - "legendFormat": "OS CPU", - "range": true, - "instant": false, - "format": "time_series", - "refId": "Os" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 134, - "type": "timeseries", - "title": "OS Processes CPU Utilization", - "description": "Per-process CPU from windows_exporter.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 36, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "percent", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "topk(10, rate(windows_process_cpu_time_total{instance=\"$Server\"}[$__rate_interval]) * 100)", - "legendFormat": "{{process}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "Trend - Memory Utilization", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 44, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 135, - "type": "timeseries", - "title": "SQL Server Process Memory", - "description": "mssql_perfmon__total_server_memory_bytes and target_server_memory_bytes.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 45, - "w": 24, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "bytes", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__total_server_memory_bytes{instance=\"$Server\"}", - "legendFormat": "Total Server Memory", - "range": true, - "instant": false, - "format": "time_series", - "refId": "Total" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__target_server_memory_bytes{instance=\"$Server\"}", - "legendFormat": "Target Server Memory", - "range": true, - "instant": false, - "format": "time_series", - "refId": "Target" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 136, - "type": "timeseries", - "title": "OS Processes Memory Utilization", - "description": "Top 10 processes by working-set memory.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 55, - "w": 24, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "bytes", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "topk(10, windows_process_working_set_bytes{instance=\"$Server\"})", - "legendFormat": "{{process}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "Server & Database Config Changes", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 65, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 137, - "type": "text", - "title": "Server Configuration Changes", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ dbo.server_config_history (LAMA) is inventory-only.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 66, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ dbo.server_config_history (LAMA) is inventory-only." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 138, - "type": "text", - "title": "Database Configuration Changes", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ dbo.database_config_history is inventory-only.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 74, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ dbo.database_config_history is inventory-only." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "Blocking Tree - ACTIVE", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 82, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 139, - "type": "table", - "title": "Blocking Details - ACTIVE - [sp_WhoIsActive]", - "description": "Live blocking info from mssql_whoisactive.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 83, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_whoisactive__start_time{instance=\"$Server\",blocked_session_count!=\"0\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "Lead Blockers", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 91, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 140, - "type": "timeseries", - "title": "Lead Blockers - Logins - Blocked Count", - "description": "Count of blocked sessions grouped by login_name from mssql_whoisactive.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 92, - "w": 24, - "h": 11 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count by (login_name) (mssql_whoisactive__blocking_session_id{instance=\"$Server\",blocked_session_count!=\"0\"})", - "legendFormat": "{{login_name}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 141, - "type": "timeseries", - "title": "Lead Blockers - Programs - Blocked Count", - "description": "Blocked sessions grouped by program_name.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 103, - "w": 24, - "h": 11 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count by (program_name) (mssql_whoisactive__blocking_session_id{instance=\"$Server\",blocked_session_count!=\"0\"})", - "legendFormat": "{{program_name}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "Trend - Memory Grants Pending", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 114, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 142, - "type": "timeseries", - "title": "Memory Grants Pending", - "description": "mssql_perfmon__memory_grants_pending \u2014 anything >0 indicates grant pressure.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 115, - "w": 24, - "h": 7 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__memory_grants_pending{instance=\"$Server\"}", - "legendFormat": "pending grants", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "Memory Consumers - ACTIVE", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 122, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 143, - "type": "table", - "title": "Memory Consumers Over $memory_grant_threshold_mb MB", - "description": "Sessions holding memory grants above the threshold.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 123, - "w": 24, - "h": 11 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_whoisactive__memory_info{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "TempdbSaver - Latest", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 134, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 144, - "type": "text", - "title": "TempdbSaver - tempdb_space_usage", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ tempdb_space_usage collector is not yet ported.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 135, - "w": 12, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ tempdb_space_usage collector is not yet ported." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 145, - "type": "text", - "title": "TempdbSaver - tempdb_space_consumers", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ tempdb_space_consumers collector is not yet ported.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 12, - "y": 135, - "w": 12, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ tempdb_space_consumers collector is not yet ported." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "LogSaver - Latest", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 139, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 146, - "type": "text", - "title": "LogSaver - log_space_consumers", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ log_space_consumers collector is not yet ported.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 140, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-live-distributed*](/d/monitoring-live-distributed)\n\n_Note:_ log_space_consumers collector is not yet ported." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "SQL Connections & Winsock Rejections", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 148, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 147, - "type": "timeseries", - "title": "microsoft winsock bsp -> rejected connections/sec", - "description": "Winsock BSP rejected connections; counter delta.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 149, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(windows_net_packets_outbound_errors_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "{{nic}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "Long Running Queries", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 157, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 148, - "type": "table", - "title": "WhoIsActive Data", - "description": "Current sp_WhoIsActive snapshot from mssql_whoisactive.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 158, - "w": 24, - "h": 9 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_whoisactive__start_time{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "Trend - Page Life Expectancy", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 167, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 149, - "type": "timeseries", - "title": "Page Life Expectancy", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 168, - "w": 24, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "s", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__page_life_expectancy_seconds{instance=\"$Server\"}", - "legendFormat": "PLE (s)", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "Trend - Batch Request/Sec", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 178, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 150, - "type": "timeseries", - "title": "Batch Requests Per Second", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 179, - "w": 24, - "h": 7 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__batch_requests_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "batch req/s", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "SQL Connections - Distribution", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 186, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 151, - "type": "table", - "title": "Connections by Interface", - "description": "Connections grouped by net_transport / auth_scheme.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 187, - "w": 8, - "h": 6 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count by (net_transport) (mssql_whoisactive__start_time{instance=\"$Server\"})", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 152, - "type": "table", - "title": "Host Connections", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 8, - "y": 187, - "w": 8, - "h": 12 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count by (host_name) (mssql_whoisactive__start_time{instance=\"$Server\"})", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 153, - "type": "table", - "title": "Login Connections", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 16, - "y": 187, - "w": 8, - "h": 12 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count by (login_name) (mssql_whoisactive__start_time{instance=\"$Server\"})", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 154, - "type": "table", - "title": "Connections By Status", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 193, - "w": 8, - "h": 6 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count by (status) (mssql_whoisactive__start_time{instance=\"$Server\"})", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "Running Jobs & Maintenance Workloads", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 199, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 155, - "type": "table", - "title": "WhoIsActive Latest Captured Data", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 200, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_whoisactive__start_time{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "SQLAgent Job Activity Monitor - [$Server]", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 208, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 156, - "type": "table", - "title": "Job Activity Monitor", - "description": "SQL Agent jobs for this instance \u2014 outcome / duration / running state from mssql_sqlagent_job__*.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 209, - "w": 24, - "h": 16 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_sqlagent_job__enabled{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "En" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_sqlagent_job__last_run_outcome{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Out" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_sqlagent_job__last_run_duration_seconds{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Dur" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_sqlagent_job__is_running{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Run" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - } - ], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "Disk Space - [$Server]", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 225, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 157, - "type": "table", - "title": "Disk Space Utilization", - "description": "Per-volume size / free / used from windows_exporter.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 226, - "w": 24, - "h": 16 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "bytes", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_logical_disk_size_bytes{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Size" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_logical_disk_free_bytes{instance=\"$Server\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Free" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - } - ], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "WaitStats", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 242, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 158, - "type": "timeseries", - "title": "[${Server}] - WaitStats", - "description": "rate(mssql_waits__wait_time_seconds) per wait_type.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 243, - "w": 24, - "h": 15 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "s", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "topk(20, sum by (wait_type) (rate(mssql_waits__wait_time_seconds{instance=\"$Server\"}[$__rate_interval])))", - "legendFormat": "{{wait_type}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - } - ], - "refresh": "30s", - "schemaVersion": 42, - "tags": [ - "mssql", - "sqlmonitor", - "Live", - "Distributed", - "prometheus" - ], - "templating": { - "list": [ - { - "name": "DS_PROMETHEUS", - "type": "datasource", - "label": "Data Source", - "query": "prometheus", - "current": { - "text": "", - "value": "${DS_PROMETHEUS}", - "selected": true - }, - "refresh": 1, - "hide": 0, - "regex": "", - "skipUrlSync": false - }, - { - "name": "Server", - "type": "query", - "label": "SQL Instance", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_up, instance)", - "query": { - "qryType": 1, - "query": "label_values(mssql_up, instance)", - "refId": "PrometheusVariableQueryEditor-Server" - }, - "refresh": 1, - "sort": 1, - "multi": false, - "includeAll": false, - "allValue": null, - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "blocked_threshold_seconds", - "type": "constant", - "label": "blocked_threshold_seconds", - "query": "30", - "current": { - "text": "30", - "value": "30", - "selected": false - }, - "hide": 2, - "skipUrlSync": false - }, - { - "name": "memory_grant_threshold_mb", - "type": "constant", - "label": "memory_grant_threshold_mb", - "query": "100", - "current": { - "text": "100", - "value": "100", - "selected": false - }, - "hide": 2, - "skipUrlSync": false - } - ] - }, - "time": { - "from": "now-3h", - "to": "now" - }, - "timepicker": {}, - "timezone": "browser", - "title": "Monitoring - Live - Distributed", - "uid": "prom_monitoring_live_distributed", - "version": 1, - "weekStart": "" -} diff --git a/sql_exporter/Prometheus-Dashboards/Monitoring - Perfmon Counters - Quest Softwares - Distributed.json b/sql_exporter/Prometheus-Dashboards/Monitoring - Perfmon Counters - Quest Softwares - Distributed.json deleted file mode 100644 index 5c42a32..0000000 --- a/sql_exporter/Prometheus-Dashboards/Monitoring - Perfmon Counters - Quest Softwares - Distributed.json +++ /dev/null @@ -1,5859 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__elements": {}, - "__requires": [ - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "12.0.0" - }, - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - }, - { - "type": "panel", - "id": "timeseries", - "name": "Time series", - "version": "" - }, - { - "type": "panel", - "id": "table", - "name": "Table", - "version": "" - }, - { - "type": "panel", - "id": "stat", - "name": "Stat", - "version": "" - } - ], - "annotations": { - "list": [] - }, - "description": "", - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 1, - "id": null, - "links": [], - "liveNow": false, - "panels": [ - { - "type": "row", - "title": "CPU & Processor", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 0, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 101, - "type": "timeseries", - "title": "%Processor Time (SQL Server)", - "description": "SQL vs OS CPU %.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 1, - "w": 24, - "h": 7 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "percent", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_cpu_utilization__sql_cpu_utilization{instance=\"$Server\"}", - "legendFormat": "SQL CPU", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "100 - mssql_cpu_utilization__system_idle_process{instance=\"$Server\"}", - "legendFormat": "OS CPU", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 102, - "type": "timeseries", - "title": "System: Processor Queue Length", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 8, - "w": 24, - "h": 5 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_system_processor_queue_length{instance=\"$Server\"}", - "legendFormat": "queue length", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "OS Memory & Paging Performance Counters", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 13, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 103, - "type": "timeseries", - "title": "Memory - Available Mbytes", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 14, - "w": 24, - "h": 6 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "decmbytes", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_memory_available_bytes{instance=\"$Server\"} / 1024 / 1024", - "legendFormat": "Available MB", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 104, - "type": "timeseries", - "title": "Memory - Pages Input/sec, Pages/sec", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 20, - "w": 24, - "h": 11 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(windows_memory_swap_page_operations_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "Pages/sec", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(windows_memory_swap_page_reads_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "Pages Input/sec", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 105, - "type": "timeseries", - "title": "Paging File Usage", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 31, - "w": 24, - "h": 7 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "percent", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_paging_file_usage_percent{instance=\"$Server\"}", - "legendFormat": "usage %", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "SQL Server: Memory Manager Counters", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 38, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 106, - "type": "timeseries", - "title": "SQL Server Process Memory", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 39, - "w": 24, - "h": 11 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "bytes", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__total_server_memory_bytes{instance=\"$Server\"}", - "legendFormat": "Total Server Memory", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__target_server_memory_bytes{instance=\"$Server\"}", - "legendFormat": "Target Server Memory", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 107, - "type": "timeseries", - "title": "SQL Server: Memory Manager", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 50, - "w": 24, - "h": 11 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__memory_grants_pending{instance=\"$Server\"}", - "legendFormat": "Memory Grants Pending", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__memory_grants_outstanding{instance=\"$Server\"}", - "legendFormat": "Memory Grants Outstanding", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 108, - "type": "timeseries", - "title": "Memory Grants", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 61, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__memory_grants_pending{instance=\"$Server\"}", - "legendFormat": "pending", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__memory_grants_outstanding{instance=\"$Server\"}", - "legendFormat": "outstanding", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "MSSQL Data Access Performance Counters", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 69, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 109, - "type": "timeseries", - "title": "Batch Requests/sec", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 70, - "w": 24, - "h": 6 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__batch_requests_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "Batch Req/sec", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 110, - "type": "timeseries", - "title": "SQLServer:Access Methods", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 76, - "w": 24, - "h": 15 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__page_splits_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "Page Splits/sec", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__full_scans_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "Full Scans/sec", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__index_searches_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "Index Searches/sec", - "range": true, - "instant": false, - "format": "time_series", - "refId": "C" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__forwarded_records_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "Forwarded Records/sec", - "range": true, - "instant": false, - "format": "time_series", - "refId": "D" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "Logical Disk Counters", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 91, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 111, - "type": "timeseries", - "title": "Logical Disk (Disk Queue Length)", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 92, - "w": 24, - "h": 5 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_logical_disk_avg_read_requests_queued{instance=\"$Server\",volume=~\"$disk_drive\"}", - "legendFormat": "read queue {{volume}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_logical_disk_avg_write_requests_queued{instance=\"$Server\",volume=~\"$disk_drive\"}", - "legendFormat": "write queue {{volume}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 112, - "type": "timeseries", - "title": "Logical Disk - Latency (ms)", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 97, - "w": 24, - "h": 6 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "ms", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "1000 * rate(windows_logical_disk_read_seconds_total{instance=\"$Server\",volume=~\"$disk_drive\"}[$__rate_interval]) / clamp_min(rate(windows_logical_disk_reads_total{instance=\"$Server\",volume=~\"$disk_drive\"}[$__rate_interval]), 1)", - "legendFormat": "read ms {{volume}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "1000 * rate(windows_logical_disk_write_seconds_total{instance=\"$Server\",volume=~\"$disk_drive\"}[$__rate_interval]) / clamp_min(rate(windows_logical_disk_writes_total{instance=\"$Server\",volume=~\"$disk_drive\"}[$__rate_interval]), 1)", - "legendFormat": "write ms {{volume}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 113, - "type": "timeseries", - "title": "Logical Disk - IOPS", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 103, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "ops", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(windows_logical_disk_reads_total{instance=\"$Server\",volume=~\"$disk_drive\"}[$__rate_interval])", - "legendFormat": "reads/s {{volume}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(windows_logical_disk_writes_total{instance=\"$Server\",volume=~\"$disk_drive\"}[$__rate_interval])", - "legendFormat": "writes/s {{volume}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 114, - "type": "timeseries", - "title": "Logical Disk - Throughput", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 111, - "w": 24, - "h": 7 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "Bps", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(windows_logical_disk_read_bytes_total{instance=\"$Server\",volume=~\"$disk_drive\"}[$__rate_interval])", - "legendFormat": "read B/s {{volume}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(windows_logical_disk_write_bytes_total{instance=\"$Server\",volume=~\"$disk_drive\"}[$__rate_interval])", - "legendFormat": "write B/s {{volume}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "Physical Disk Counters", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 118, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 115, - "type": "timeseries", - "title": "Physical Disk (Disk Queue Length)", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 119, - "w": 24, - "h": 5 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_physical_disk_avg_read_requests_queued{instance=\"$Server\"}", - "legendFormat": "read queue {{disk}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "windows_physical_disk_avg_write_requests_queued{instance=\"$Server\"}", - "legendFormat": "write queue {{disk}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 116, - "type": "timeseries", - "title": "Physical Disk - Latency (ms)", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 124, - "w": 24, - "h": 6 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "ms", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "1000 * rate(windows_physical_disk_read_seconds_total{instance=\"$Server\"}[$__rate_interval]) / clamp_min(rate(windows_physical_disk_reads_total{instance=\"$Server\"}[$__rate_interval]), 1)", - "legendFormat": "read ms {{disk}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "1000 * rate(windows_physical_disk_write_seconds_total{instance=\"$Server\"}[$__rate_interval]) / clamp_min(rate(windows_physical_disk_writes_total{instance=\"$Server\"}[$__rate_interval]), 1)", - "legendFormat": "write ms {{disk}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 117, - "type": "timeseries", - "title": "Physical Disk - Throughput", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 130, - "w": 24, - "h": 7 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "Bps", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(windows_physical_disk_read_bytes_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "read B/s {{disk}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(windows_physical_disk_write_bytes_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "write B/s {{disk}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 118, - "type": "timeseries", - "title": "Physical Disk - IOPS", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 137, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "ops", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(windows_physical_disk_reads_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "reads/s {{disk}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(windows_physical_disk_writes_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "writes/s {{disk}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "Network Interface Counters", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 145, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 119, - "type": "timeseries", - "title": "Network Interface - Bytes Total/sec", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 146, - "w": 24, - "h": 7 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "Bps", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(windows_net_bytes_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "{{nic}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "MSSQL Databases - Size Counters", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 153, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 120, - "type": "timeseries", - "title": "SQLServer:Databases - Log File Size", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 154, - "w": 24, - "h": 15 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "bytes", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__log_file_used_size_kb{instance=\"$Server\",database_name=~\"$database\"} * 1024", - "legendFormat": "{{database_name}} log used (B)", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__log_file_size_kb{instance=\"$Server\",database_name=~\"$database\"} * 1024", - "legendFormat": "{{database_name}} log size (B)", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 121, - "type": "timeseries", - "title": "SQLServer:Databases - Data File Size", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 169, - "w": 24, - "h": 12 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "bytes", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__data_file_size_kb{instance=\"$Server\",database_name=~\"$database\"} * 1024", - "legendFormat": "{{database_name}} data (B)", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "MSSQL User Database - Performance Counters", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 181, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 122, - "type": "timeseries", - "title": "SqlServer:Databases - Log Bytes Flushed/sec", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 182, - "w": 24, - "h": 9 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "Bps", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__log_bytes_flushed_total{instance=\"$Server\",database_name=~\"$database\"}[$__rate_interval])", - "legendFormat": "{{database_name}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 123, - "type": "timeseries", - "title": "SqlServer:Databases - Log Flush Wait Time", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 191, - "w": 24, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "ms", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__log_flush_wait_time_ms_total{instance=\"$Server\",database_name=~\"$database\"}[$__rate_interval])", - "legendFormat": "{{database_name}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 124, - "type": "timeseries", - "title": "SqlServer:Databases - Others", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 201, - "w": 24, - "h": 15 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__transactions_total{instance=\"$Server\",database_name=~\"$database\"}[$__rate_interval])", - "legendFormat": "tx/s {{database_name}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__write_transactions_total{instance=\"$Server\",database_name=~\"$database\"}[$__rate_interval])", - "legendFormat": "write-tx/s {{database_name}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "SQL Server - SQL Statistics - Auto Parameterization", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 216, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 125, - "type": "timeseries", - "title": "SQLServer:SQL Statistics - Auto Parameterization", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 217, - "w": 24, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__auto_param_attempts_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "auto-param attempts/s", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__failed_auto_params_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "failed auto-params/s", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__safe_auto_params_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "safe auto-params/s", - "range": true, - "instant": false, - "format": "time_series", - "refId": "C" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "MSSQL Buffer Manager & Memory Performance Counters", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 227, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 126, - "type": "timeseries", - "title": "Batch Requests/sec", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 228, - "w": 24, - "h": 6 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__batch_requests_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "batch req/s", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 127, - "type": "timeseries", - "title": "Page Life Expectancy", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 234, - "w": 24, - "h": 7 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "s", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__page_life_expectancy_seconds{instance=\"$Server\"}", - "legendFormat": "PLE", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 128, - "type": "timeseries", - "title": "SQLServer:Buffer Manager", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 241, - "w": 24, - "h": 17 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__buffer_cache_hit_ratio{instance=\"$Server\"}", - "legendFormat": "buffer cache hit %", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__page_reads_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "page reads/s", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__page_writes_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "page writes/s", - "range": true, - "instant": false, - "format": "time_series", - "refId": "C" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__lazy_writes_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "lazy writes/s", - "range": true, - "instant": false, - "format": "time_series", - "refId": "D" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "Memory Consumers - sys.dm_os_memory_clerks", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 258, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 129, - "type": "text", - "title": "Memory Consumers", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-perfmon-counters-quest-softwares-distributed*](/d/monitoring-perfmon-counters-quest-softwares-distributed)\n\n_Note:_ dm_os_memory_clerks snapshot is cached in the SQLMonitor memory_clerks table and is not exposed as a Prometheus metric.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 259, - "w": 24, - "h": 13 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-perfmon-counters-quest-softwares-distributed*](/d/monitoring-perfmon-counters-quest-softwares-distributed)\n\n_Note:_ dm_os_memory_clerks snapshot is cached in the SQLMonitor memory_clerks table and is not exposed as a Prometheus metric." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "MSSQL Memory Breakdown Counters", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 272, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 130, - "type": "timeseries", - "title": "SQLServer:Memory Manager - Connection/Lock/Opt", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 273, - "w": 24, - "h": 9 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "bytes", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__connection_memory_kb{instance=\"$Server\"} * 1024", - "legendFormat": "connection mem (B)", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__lock_memory_kb{instance=\"$Server\"} * 1024", - "legendFormat": "lock mem (B)", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__optimizer_memory_kb{instance=\"$Server\"} * 1024", - "legendFormat": "optimizer mem (B)", - "range": true, - "instant": false, - "format": "time_series", - "refId": "C" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 131, - "type": "timeseries", - "title": "SQLServer:Memory Manager - Granted Workspace", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 282, - "w": 24, - "h": 12 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "bytes", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__granted_workspace_memory_kb{instance=\"$Server\"} * 1024", - "legendFormat": "granted workspace (B)", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__reserved_server_memory_kb{instance=\"$Server\"} * 1024", - "legendFormat": "reserved server mem (B)", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "MSSQL Workload Performance Counters", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 294, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 132, - "type": "timeseries", - "title": "SQLServer:SQL Statistics - CPU Stuff", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 295, - "w": 24, - "h": 6 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__sql_compilations_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "compilations/s", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__sql_re_compilations_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "re-compilations/s", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 133, - "type": "timeseries", - "title": "SQLServer:SQL Statistics - Cursors & Errors", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 301, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__errors_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "errors/s", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 134, - "type": "timeseries", - "title": "SQLServer:SQL Errors", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 309, - "w": 24, - "h": 7 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__errors_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "errors/s", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 135, - "type": "text", - "title": "SQLServer: Deprecated Features", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-perfmon-counters-quest-softwares-distributed*](/d/monitoring-perfmon-counters-quest-softwares-distributed)\n\n_Note:_ Deprecated-features counter not currently published by mssql_standard.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 316, - "w": 24, - "h": 7 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-perfmon-counters-quest-softwares-distributed*](/d/monitoring-perfmon-counters-quest-softwares-distributed)\n\n_Note:_ Deprecated-features counter not currently published by mssql_standard." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "SQL Server : Plan Cache : Cache Manager Instance", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 323, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 136, - "type": "timeseries", - "title": "SQLServer: Plan Cache - Totals", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 324, - "w": 24, - "h": 5 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__cache_pages{instance=\"$Server\"}", - "legendFormat": "cache pages", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__cache_object_counts{instance=\"$Server\"}", - "legendFormat": "cache object counts", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__cache_objects_in_use{instance=\"$Server\"}", - "legendFormat": "cache objects in use", - "range": true, - "instant": false, - "format": "time_series", - "refId": "C" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 137, - "type": "timeseries", - "title": "SQLServer: Plan Cache - cache object counts", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 329, - "w": 24, - "h": 6 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__cache_object_counts{instance=\"$Server\"}", - "legendFormat": "{{cache_type}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 138, - "type": "timeseries", - "title": "SQLServer: Plan Cache - cache pages", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 335, - "w": 24, - "h": 6 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__cache_pages{instance=\"$Server\"}", - "legendFormat": "{{cache_type}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 139, - "type": "timeseries", - "title": "SQLServer: Plan Cache - cache objects in use", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 341, - "w": 24, - "h": 6 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__cache_objects_in_use{instance=\"$Server\"}", - "legendFormat": "{{cache_type}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "SQLServer:Transactions", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 347, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 140, - "type": "timeseries", - "title": "Longest Transaction Running Time", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 348, - "w": 11, - "h": 5 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "s", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__longest_transaction_running_time_seconds{instance=\"$Server\"}", - "legendFormat": "longest tx (s)", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 141, - "type": "timeseries", - "title": "Free Space in tempdb (KB)", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 11, - "y": 348, - "w": 13, - "h": 5 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "kbytes", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__free_space_in_tempdb_kb{instance=\"$Server\"}", - "legendFormat": "free tempdb (KB)", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 142, - "type": "timeseries", - "title": "Transactions", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 353, - "w": 11, - "h": 5 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__transactions{instance=\"$Server\"}", - "legendFormat": "tx", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 143, - "type": "timeseries", - "title": "Version Store Size (KB)", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 11, - "y": 353, - "w": 13, - "h": 5 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "kbytes", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__version_store_size_kb{instance=\"$Server\"}", - "legendFormat": "version store (KB)", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "SQLServer:General Statistics", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 358, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 144, - "type": "timeseries", - "title": "Winsock BSP rejected connections/sec", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 359, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(windows_net_packets_outbound_errors_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "{{nic}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 145, - "type": "timeseries", - "title": "SQLServer:General Statistics - Login/Logout", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 367, - "w": 24, - "h": 7 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__logins_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "logins/s", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__logouts_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "logouts/s", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "MSSQL Locks Performance Counters", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 374, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 146, - "type": "timeseries", - "title": "SqlServer:Locks - Lock Wait Time (ms)", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 375, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "ms", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__lock_wait_time_ms_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "{{resource_type}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 147, - "type": "timeseries", - "title": "SqlServer:Locks - Average Wait Time (ms)", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 383, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "ms", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__average_wait_time_ms{instance=\"$Server\"}", - "legendFormat": "{{resource_type}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 148, - "type": "timeseries", - "title": "SqlServer:Locks - Waits/sec", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 391, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__lock_waits_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "{{resource_type}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "MSSQL Latches Performance Counters", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 399, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 149, - "type": "timeseries", - "title": "Latch Waits/sec", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 400, - "w": 24, - "h": 6 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__latch_waits_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "latch waits/s", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 150, - "type": "timeseries", - "title": "Latch Wait Time (ms)", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 406, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "ms", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__latch_wait_time_ms_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "latch wait ms/s", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "SQLServer:Replication", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 414, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 151, - "type": "timeseries", - "title": "Replication - Latency", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 415, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "s", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_perfmon__replication_latency_seconds{instance=\"$Server\"}", - "legendFormat": "{{publication}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 152, - "type": "timeseries", - "title": "Replication - Transfer Rate", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 423, - "w": 24, - "h": 8 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "rate(mssql_perfmon__replication_delivered_commands_total{instance=\"$Server\"}[$__rate_interval])", - "legendFormat": "{{publication}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "SQLAgent:Jobs", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 431, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 153, - "type": "timeseries", - "title": "SQLAgent: Jobs", - "description": "", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 432, - "w": 24, - "h": 5 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum by (instance) (mssql_sqlagent_job__is_running{instance=\"$Server\"})", - "legendFormat": "jobs running", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum by (instance) (mssql_sqlagent_job__enabled{instance=\"$Server\"})", - "legendFormat": "jobs enabled", - "range": true, - "instant": false, - "format": "time_series", - "refId": "B" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "SQLServer:Database Mirroring", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 437, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 154, - "type": "text", - "title": "Database Mirroring", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-perfmon-counters-quest-softwares-distributed*](/d/monitoring-perfmon-counters-quest-softwares-distributed)\n\n_Note:_ Mirroring counters are not currently exposed by mssql_standard; use the SQL dashboard.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 438, - "w": 24, - "h": 5 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-perfmon-counters-quest-softwares-distributed*](/d/monitoring-perfmon-counters-quest-softwares-distributed)\n\n_Note:_ Mirroring counters are not currently exposed by mssql_standard; use the SQL dashboard." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "type": "row", - "title": "SQLServer:Resource Pool Stats", - "collapsed": false, - "gridPos": { - "x": 0, - "y": 443, - "w": 24, - "h": 1 - }, - "panels": [] - }, - { - "id": 155, - "type": "text", - "title": "Resource Pool Stats", - "description": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-perfmon-counters-quest-softwares-distributed*](/d/monitoring-perfmon-counters-quest-softwares-distributed)\n\n_Note:_ Resource Governor pool counters are not currently exposed by mssql_standard.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 444, - "w": 24, - "h": 5 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "mode": "markdown", - "content": "**Legacy panel** \u2014 not yet ported to Prometheus.\n\n[Open in SQL dashboard: *monitoring-perfmon-counters-quest-softwares-distributed*](/d/monitoring-perfmon-counters-quest-softwares-distributed)\n\n_Note:_ Resource Governor pool counters are not currently exposed by mssql_standard." - }, - "targets": [], - "transformations": [], - "pluginVersion": "12.4.1" - } - ], - "refresh": "30s", - "schemaVersion": 42, - "tags": [ - "mssql", - "sqlmonitor", - "Perfmon", - "Quest", - "prometheus" - ], - "templating": { - "list": [ - { - "name": "DS_PROMETHEUS", - "type": "datasource", - "label": "Data Source", - "query": "prometheus", - "current": { - "text": "", - "value": "${DS_PROMETHEUS}", - "selected": true - }, - "refresh": 1, - "hide": 0, - "regex": "", - "skipUrlSync": false - }, - { - "name": "Server", - "type": "query", - "label": "SQL Instance", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_up, instance)", - "query": { - "qryType": 1, - "query": "label_values(mssql_up, instance)", - "refId": "PrometheusVariableQueryEditor-Server" - }, - "refresh": 1, - "sort": 1, - "multi": false, - "includeAll": false, - "allValue": null, - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "database", - "type": "query", - "label": "Database", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_perfmon__log_bytes_flushed_total{instance=\"$Server\"}, database_name)", - "query": { - "qryType": 1, - "query": "label_values(mssql_perfmon__log_bytes_flushed_total{instance=\"$Server\"}, database_name)", - "refId": "PrometheusVariableQueryEditor-database" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "disk_drive", - "type": "query", - "label": "Disk", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(windows_logical_disk_size_bytes{instance=\"$Server\"}, volume)", - "query": { - "qryType": 1, - "query": "label_values(windows_logical_disk_size_bytes{instance=\"$Server\"}, volume)", - "refId": "PrometheusVariableQueryEditor-disk_drive" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - } - ] - }, - "time": { - "from": "now-3h", - "to": "now" - }, - "timepicker": {}, - "timezone": "browser", - "title": "Monitoring - Perfmon Counters - Quest Softwares - Distributed", - "uid": "prom_monitoring_perfmon_quest", - "version": 1, - "weekStart": "" -} diff --git a/sql_exporter/Prometheus-Dashboards/README.md b/sql_exporter/Prometheus-Dashboards/README.md deleted file mode 100644 index 3f4e436..0000000 --- a/sql_exporter/Prometheus-Dashboards/README.md +++ /dev/null @@ -1,133 +0,0 @@ -# Prometheus-backed Grafana Dashboards - -This folder contains Grafana dashboard JSON files that port the SQL-backed -dashboards in `../../Grafana-Dashboards/` to use the Prometheus data source -populated by `sql_exporter` and `windows_exporter`. - -## Why two copies? - -SQLMonitor's original dashboards query SQL Server directly. These Prometheus -ports consume the same data via scraped metrics instead, which means: - -- no direct 1433 reachability is required from Grafana to each SQL instance, -- dashboards keep working when an instance is temporarily down (last-known - values remain visible), -- Grafana Alerting can run off the same TSDB without a second datasource, -- metric history is retained on the Prometheus side per its configured - retention, independent of the `DBA` database. - -## Dashboards in this folder — Phase 1 (12 dashboards) - -| UID | Title | Source SQL dashboard | Data panels | -|---|---|---|---:| -| `prom_core_metrics_trend` | Core Metrics - Trend | `Core Metrics - Trend.json` | 9 | -| `prom_wait_stats` | Wait Stats | `Wait Stats.json` | 4 | -| `prom_disk_space` | Disk Space | `t___Disk Space.json` | 5 | -| `prom_ag_health_state` | Ag Health State | `t___Ag Health State.json` | 3 | -| `prom_sql_agent_jobs` | SQL Agent Jobs | `Monitoring - Live - All Servers - Job Activity Monitor.json` | 6 | -| `prom_backup_history` | Backup History | `t___Backup_History.json` | 6 | -| `prom_xevent_trend` | XEvent - Trend | `XEvent - Trend.json` | 4 | -| `prom_database_file_io_stats` | Database File IO Stats | `t___Database File IO Stats.json` | 12 | -| `prom_dba_inventory` | DBA Inventory | `DBA Inventory.json` | 6 (+8 deep-links) | -| `prom_monitoring_live_all_servers` | Monitoring - Live - All Servers | `Monitoring - Live - All Servers.json` | 15 (+6 deep-links) | -| `prom_monitoring_live_distributed` | Monitoring - Live - Distributed | `Monitoring - Live - Distributed.json` | 52 (+6 deep-links) | -| `prom_monitoring_perfmon_quest` | Monitoring - Perfmon Counters - Quest Softwares - Distributed | `Monitoring - Perfmon Counters - Quest Softwares - Distributed.json` | 51 (+4 deep-links) | - -Source panels that depend on the SQLMonitor central inventory database -(alert history, AG-vs-nonAG backup split, LAMA config-change deltas, -`dm_os_memory_clerks` snapshot, tempdb/log_space cache tables, -sql_server_patching …) are rendered as `legacy_link_panel(...)` markdown -tiles that deep-link back to the SQL-backed dashboard so every source -section remains visible. - -## Required `sql_exporter` collectors - -All files live in `../`: - -- `mssql_standard.collector.yml` *(upstream, required)* -- `mssql_dba_cached.collector.yml` -- `mssql_dba_regular.collector.yml` -- `mssql_dba_stableinfo.collector.yml` -- `mssql_dba_aghealth.collector.yml` -- `mssql_dba_whoisactive.collector.yml` -- `mssql_sqlagent_jobs.collector.yml` *(new in Phase 1)* -- `mssql_backup_history.collector.yml` *(new in Phase 1)* -- `mssql_xevent.collector.yml` *(new in Phase 1 — reads `DBA.dbo.xevent_metrics` populated by the ring-buffer or file-target XEvent collector proc)* - -Plus `windows_exporter` with the `cpu`, `memory`, `logical_disk`, -`physical_disk`, `net`, `os`, `paging_file`, `process`, `service`, -`system` collectors enabled for OS-level panels. - -## Regeneration workflow - -Every dashboard is generated from a small Python spec in `_specs/`: - -```text -_specs/<name>.py → generate.py → ./<Title>.json -``` - -- `_lib/prom_dashboard.py` — `Panel`, `Target`, `query_var`, `custom_var`, - `constant_var`, `row`, `legacy_link_panel`. -- `_lib/build.py` — JSON serialization (`schemaVersion: 42`, `__inputs`, - per-panel-type option defaults). -- `_tools/validate.py` — structural JSON + target/expr sanity check. -- `_tools/inspect_panels.py` — source-dashboard panel inventory. - -```bash -cd sql_exporter/Prometheus-Dashboards -python3 generate.py # rebuild every dashboard -python3 generate.py backup # filter: rebuild only backup_history -python3 _tools/validate.py # structural validation -``` - -## Variable conventions - -All ports use a `DS_PROMETHEUS` datasource variable so the JSON is -portable between Grafana instances, plus a `Server` query variable built -from `label_values(mssql_up, instance)`. Per-dashboard variables -(`database`, `disk_drive`, `backup_type`, `grouping_key`, `percentile`, -`trend_window` …) are documented in the source spec file. - -## Importing into Grafana - -### Interactive - -1. Grafana → Dashboards → **New → Import**. -2. Upload any `*.json` file from this folder. -3. Select your Prometheus datasource for the `DS_PROMETHEUS` placeholder. - -### Bulk (Grafana API) - -```bash -TOKEN="<grafana api token>" -FOLDER_UID="prometheus" -for f in *.json; do - body=$(jq --slurpfile d "$f" -n '{dashboard: $d[0], folderUid: "'$FOLDER_UID'", overwrite: true, inputs: [{name: "DS_PROMETHEUS", type: "datasource", pluginId: "prometheus", value: "Prometheus"}]}') - curl -sS -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \ - -XPOST -d "$body" https://grafana.example.com/api/dashboards/import -done -``` - -## Deep links to SQL dashboards - -The `legacy_link_panel(...)` tiles render a markdown link of the form: - -``` -/d/<sql-dashboard-uid> -``` - -Grafana resolves the UID regardless of which folder the SQL dashboard -lives in, so the deep-link keeps working after folder reorganizations as -long as the UID is preserved. - -## Future phases - -- **Phase 2** — 5 text-bound dashboards (WhoIsActive Workload, XEvent - Workload, SQLMonitor-Alerts, Blitz Server Health, BlitzIndex Analysis) - as numeric-summary + deep-link dashboards. -- **Phase 3** — `sql_exporter/README-sql_exporter.md` refresh with - collector map + Mermaid flow diagrams; cross-links from - `docs/deployment/prometheus.md` to each generated dashboard. -- **Phase 4** — deploy collectors to live VMs (`sqlmonitor`, - `AgHost-1A`, `AgHost-1B`) and validate series on - `https://prometheus.ajaydwivedi.com`. diff --git a/sql_exporter/Prometheus-Dashboards/SQL Agent Jobs.json b/sql_exporter/Prometheus-Dashboards/SQL Agent Jobs.json deleted file mode 100644 index 79b83a0..0000000 --- a/sql_exporter/Prometheus-Dashboards/SQL Agent Jobs.json +++ /dev/null @@ -1,794 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__elements": {}, - "__requires": [ - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "12.0.0" - }, - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - }, - { - "type": "panel", - "id": "timeseries", - "name": "Time series", - "version": "" - }, - { - "type": "panel", - "id": "table", - "name": "Table", - "version": "" - }, - { - "type": "panel", - "id": "stat", - "name": "Stat", - "version": "" - } - ], - "annotations": { - "list": [] - }, - "description": "", - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 1, - "id": null, - "links": [], - "liveNow": false, - "panels": [ - { - "id": 101, - "type": "stat", - "title": "Jobs - Total", - "description": "Total number of SQL Agent jobs matching the filters.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 0, - "w": 6, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count(mssql_sqlagent_job__enabled{instance=~\"$Server\",category_name=~\"$job_category\",job_name=~\"$job_name\"})", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 102, - "type": "stat", - "title": "Jobs - Enabled", - "description": "Number of enabled jobs matching the filters.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 6, - "y": 0, - "w": 6, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "green", - "value": 1 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum(mssql_sqlagent_job__enabled{instance=~\"$Server\",category_name=~\"$job_category\",job_name=~\"$job_name\"})", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 103, - "type": "stat", - "title": "Jobs - Running Now", - "description": "Jobs whose latest sysjobactivity row shows start_execution_date set and stop_execution_date NULL.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 12, - "y": 0, - "w": 6, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "sum(mssql_sqlagent_job__is_running{instance=~\"$Server\",job_name=~\"$job_name\"})", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 104, - "type": "stat", - "title": "Jobs - Last Outcome = Failed", - "description": "Jobs whose most recent completed run failed.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 18, - "y": 0, - "w": 6, - "h": 4 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 1 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count(mssql_sqlagent_job__last_run_outcome{instance=~\"$Server\",category_name=~\"$job_category\",job_name=~\"$job_name\"} == 0)", - "legendFormat": "", - "range": false, - "instant": true, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 105, - "type": "table", - "title": "SQL Agent Jobs - Status Detail - [$Server]", - "description": "Per-job roll-up of enabled/outcome/duration/next-run/running/24h-step-failures, joined on (instance, job_name).", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 4, - "w": 24, - "h": 18 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_sqlagent_job__enabled{instance=~\"$Server\",category_name=~\"$job_category\",job_name=~\"$job_name\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Enabled" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_sqlagent_job__last_run_outcome{instance=~\"$Server\",category_name=~\"$job_category\",job_name=~\"$job_name\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Outcome" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_sqlagent_job__last_run_duration_seconds{instance=~\"$Server\",job_name=~\"$job_name\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Duration" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_sqlagent_job__last_run_end_time_utc{instance=~\"$Server\",job_name=~\"$job_name\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "LastEnd" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_sqlagent_job__next_run_time_utc{instance=~\"$Server\",job_name=~\"$job_name\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "NextRun" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_sqlagent_job__is_running{instance=~\"$Server\",job_name=~\"$job_name\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Running" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_sqlagent_job__step_failures_last_24h{instance=~\"$Server\",job_name=~\"$job_name\"}", - "legendFormat": "", - "range": false, - "instant": true, - "format": "table", - "refId": "Fails24h" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Time": true, - "__name__": true, - "job": true, - "target": true, - "exported_job": true, - "job_id": true - }, - "renameByName": { - "instance": "Server", - "job_name": "Job", - "category_name": "Category", - "owner_name": "Owner", - "last_run_outcome_desc": "Last Outcome", - "Value #Enabled": "Enabled", - "Value #Outcome": "Outcome (code)", - "Value #Duration": "Duration (s)", - "Value #LastEnd": "Last Run End (UTC)", - "Value #NextRun": "Next Run (UTC)", - "Value #Running": "Running", - "Value #Fails24h": "Step Failures (24h)" - } - } - } - ], - "pluginVersion": "12.4.1" - }, - { - "id": 106, - "type": "timeseries", - "title": "Failed Jobs - Trend", - "description": "Number of jobs whose last completed run was Failed (outcome=0), tracked across time.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 22, - "w": 24, - "h": 10 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "count(mssql_sqlagent_job__last_run_outcome{instance=~\"$Server\",category_name=~\"$job_category\",job_name=~\"$job_name\"} == 0) by (instance)", - "legendFormat": "{{instance}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - } - ], - "refresh": "30s", - "schemaVersion": 42, - "tags": [ - "mssql", - "sqlmonitor", - "SQL Agent", - "prometheus" - ], - "templating": { - "list": [ - { - "name": "DS_PROMETHEUS", - "type": "datasource", - "label": "Data Source", - "query": "prometheus", - "current": { - "text": "", - "value": "${DS_PROMETHEUS}", - "selected": true - }, - "refresh": 1, - "hide": 0, - "regex": "", - "skipUrlSync": false - }, - { - "name": "Server", - "type": "query", - "label": "SQL Instance", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_up, instance)", - "query": { - "qryType": 1, - "query": "label_values(mssql_up, instance)", - "refId": "PrometheusVariableQueryEditor-Server" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "job_category", - "type": "query", - "label": "Category", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_sqlagent_job__enabled{instance=~\"$Server\"}, category_name)", - "query": { - "qryType": 1, - "query": "label_values(mssql_sqlagent_job__enabled{instance=~\"$Server\"}, category_name)", - "refId": "PrometheusVariableQueryEditor-job_category" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "job_name", - "type": "query", - "label": "Job Name", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_sqlagent_job__enabled{instance=~\"$Server\",category_name=~\"$job_category\"}, job_name)", - "query": { - "qryType": 1, - "query": "label_values(mssql_sqlagent_job__enabled{instance=~\"$Server\",category_name=~\"$job_category\"}, job_name)", - "refId": "PrometheusVariableQueryEditor-job_name" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "enabled", - "type": "custom", - "label": "Enabled", - "query": "__ALL__,1,0", - "options": [ - { - "text": "__ALL__", - "value": "__ALL__", - "selected": true - }, - { - "text": "1", - "value": "1", - "selected": false - }, - { - "text": "0", - "value": "0", - "selected": false - } - ], - "current": { - "text": "__ALL__", - "value": "__ALL__", - "selected": true - }, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "last_outcome", - "type": "custom", - "label": "Last Outcome", - "query": "__ALL__,Succeeded,Failed,Retry,Canceled,Unknown", - "options": [ - { - "text": "__ALL__", - "value": "__ALL__", - "selected": true - }, - { - "text": "Succeeded", - "value": "Succeeded", - "selected": false - }, - { - "text": "Failed", - "value": "Failed", - "selected": false - }, - { - "text": "Retry", - "value": "Retry", - "selected": false - }, - { - "text": "Canceled", - "value": "Canceled", - "selected": false - }, - { - "text": "Unknown", - "value": "Unknown", - "selected": false - } - ], - "current": { - "text": "__ALL__", - "value": "__ALL__", - "selected": true - }, - "hide": 0, - "skipUrlSync": false - } - ] - }, - "time": { - "from": "now-3h", - "to": "now" - }, - "timepicker": {}, - "timezone": "browser", - "title": "SQL Agent Jobs", - "uid": "prom_sql_agent_jobs", - "version": 1, - "weekStart": "" -} diff --git a/sql_exporter/SQL-Exporter-Metrics-Dashboard-External.json b/sql_exporter/Prometheus-Dashboards/SQL-Exporter-Metrics-Dashboard-External.json similarity index 100% rename from sql_exporter/SQL-Exporter-Metrics-Dashboard-External.json rename to sql_exporter/Prometheus-Dashboards/SQL-Exporter-Metrics-Dashboard-External.json diff --git a/sql_exporter/Prometheus-Dashboards/Wait Stats.json b/sql_exporter/Prometheus-Dashboards/Wait Stats.json deleted file mode 100644 index 79f09b6..0000000 --- a/sql_exporter/Prometheus-Dashboards/Wait Stats.json +++ /dev/null @@ -1,591 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__elements": {}, - "__requires": [ - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "12.0.0" - }, - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - }, - { - "type": "panel", - "id": "timeseries", - "name": "Time series", - "version": "" - }, - { - "type": "panel", - "id": "table", - "name": "Table", - "version": "" - }, - { - "type": "panel", - "id": "stat", - "name": "Stat", - "version": "" - } - ], - "annotations": { - "list": [] - }, - "description": "", - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 1, - "id": null, - "links": [], - "liveNow": false, - "panels": [ - { - "id": 101, - "type": "table", - "title": "Wait Stats with \"__${sql_schedulers} CPUs__\" since Startup", - "description": "Top wait_types ranked by wait_time since SQL Server last started. Matches the SQL dashboard's first table.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 0, - "w": 24, - "h": 11 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "s", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "topk($top_n, mssql_waits__wait_time_seconds{instance=\"$Server\"})", - "legendFormat": "{{wait_type}}", - "range": false, - "instant": true, - "format": "table", - "refId": "WaitSec" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_waits__resource_time_seconds{instance=\"$Server\"}", - "legendFormat": "{{wait_type}}", - "range": false, - "instant": true, - "format": "table", - "refId": "ResSec" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_waits__signal_time_seconds{instance=\"$Server\"}", - "legendFormat": "{{wait_type}}", - "range": false, - "instant": true, - "format": "table", - "refId": "SigSec" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_waits__waiting_tasks_count{instance=\"$Server\"}", - "legendFormat": "{{wait_type}}", - "range": false, - "instant": true, - "format": "table", - "refId": "Waiters" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_waits__wait_percentage{instance=\"$Server\"}", - "legendFormat": "{{wait_type}}", - "range": false, - "instant": true, - "format": "table", - "refId": "Pct" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "mssql_waits__wait_rank_no{instance=\"$Server\"}", - "legendFormat": "{{wait_type}}", - "range": false, - "instant": true, - "format": "table", - "refId": "Rank" - } - ], - "transformations": [ - { - "id": "merge", - "options": {} - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Time": true, - "__name__": true, - "instance": true, - "job": true, - "exported_job": true, - "target": true - }, - "renameByName": { - "wait_type": "Wait Type", - "Value #Rank": "Rank", - "Value #WaitSec": "Wait (s)", - "Value #ResSec": "Resource (s)", - "Value #SigSec": "Signal (s)", - "Value #Waiters": "Waiting Tasks", - "Value #Pct": "Wait %" - }, - "indexByName": { - "Rank": 0, - "Wait Type": 1, - "Wait (s)": 2, - "Resource (s)": 3, - "Signal (s)": 4, - "Waiting Tasks": 5, - "Wait %": 6 - } - } - } - ], - "pluginVersion": "12.4.1" - }, - { - "id": 102, - "type": "table", - "title": "Wait Stats ____Since Startup ___ till ___ ${__from:date:YYYY-MM-DD HH.mm}___", - "description": "Counter value at dashboard `from` time \u2014 waits accumulated from SQL startup until the start of the visible range.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 11, - "w": 24, - "h": 7 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "s", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "topk($top_n, mssql_waits__wait_time_seconds{instance=\"$Server\"} @ end() offset ($__to - $__from))", - "legendFormat": "{{wait_type}}", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 103, - "type": "table", - "title": "Wait Stats ____In Selected Time Duration____Since____${__from:date:YYYY-MM-DD HH.mm}___till___${__to:date:YYYY-MM-DD HH.mm}____", - "description": "Wait time accrued between `from` and `to`. Uses increase() on the counter, so wait type = additional seconds waited in the visible range.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 18, - "w": 24, - "h": 7 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "s", - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false, - "filterable": true - } - }, - "overrides": [] - }, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "countRows": false, - "reducer": [ - "sum" - ], - "show": false, - "fields": "" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "topk($top_n, sum by (wait_type) (increase(mssql_waits__wait_time_seconds{instance=\"$Server\"}[$__range])))", - "legendFormat": "{{wait_type}}", - "range": false, - "instant": true, - "format": "table", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 104, - "type": "timeseries", - "title": "[${Server}] - WaitStats", - "description": "rate(mssql_waits__wait_time_seconds) per wait_type \u2014 top N by average rate over the visible range.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 25, - "w": 24, - "h": 19 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "s", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "topk($top_n, sum by (wait_type) (rate(mssql_waits__wait_time_seconds{instance=\"$Server\"}[$__rate_interval])))", - "legendFormat": "{{wait_type}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - } - ], - "refresh": "30s", - "schemaVersion": 42, - "tags": [ - "mssql", - "sqlmonitor", - "Wait Stats", - "prometheus" - ], - "templating": { - "list": [ - { - "name": "DS_PROMETHEUS", - "type": "datasource", - "label": "Data Source", - "query": "prometheus", - "current": { - "text": "", - "value": "${DS_PROMETHEUS}", - "selected": true - }, - "refresh": 1, - "hide": 0, - "regex": "", - "skipUrlSync": false - }, - { - "name": "Server", - "type": "query", - "label": "SQL Instance", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_up, instance)", - "query": { - "qryType": 1, - "query": "label_values(mssql_up, instance)", - "refId": "PrometheusVariableQueryEditor-Server" - }, - "refresh": 1, - "sort": 1, - "multi": false, - "includeAll": false, - "allValue": null, - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "sql_schedulers", - "type": "query", - "label": "SQL Schedulers", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "query_result(mssql_sqlserver_cpu_count{instance=\"$Server\"})", - "query": { - "qryType": 1, - "query": "query_result(mssql_sqlserver_cpu_count{instance=\"$Server\"})", - "refId": "PrometheusVariableQueryEditor-sql_schedulers" - }, - "refresh": 1, - "sort": 1, - "multi": false, - "includeAll": false, - "allValue": null, - "regex": "", - "current": {}, - "hide": 2, - "skipUrlSync": false - }, - { - "name": "sqlserver_start_time_utc", - "type": "query", - "label": "SQL Start Time UTC (ms)", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "query_result((time() - mssql_sqlserver_uptime_seconds{instance=\"$Server\"}) * 1000)", - "query": { - "qryType": 1, - "query": "query_result((time() - mssql_sqlserver_uptime_seconds{instance=\"$Server\"}) * 1000)", - "refId": "PrometheusVariableQueryEditor-sqlserver_start_time_utc" - }, - "refresh": 1, - "sort": 1, - "multi": false, - "includeAll": false, - "allValue": null, - "regex": "", - "current": {}, - "hide": 2, - "skipUrlSync": false - }, - { - "name": "top_n", - "type": "constant", - "label": "Top N Waits", - "query": "20", - "current": { - "text": "20", - "value": "20", - "selected": false - }, - "hide": 2, - "skipUrlSync": false - } - ] - }, - "time": { - "from": "now-3h", - "to": "now" - }, - "timepicker": {}, - "timezone": "browser", - "title": "Wait Stats", - "uid": "prom_wait_stats", - "version": 1, - "weekStart": "" -} diff --git a/sql_exporter/Prometheus-Dashboards/XEvent - Trend.json b/sql_exporter/Prometheus-Dashboards/XEvent - Trend.json deleted file mode 100644 index 50cdf5e..0000000 --- a/sql_exporter/Prometheus-Dashboards/XEvent - Trend.json +++ /dev/null @@ -1,682 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__elements": {}, - "__requires": [ - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "12.0.0" - }, - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - }, - { - "type": "panel", - "id": "timeseries", - "name": "Time series", - "version": "" - }, - { - "type": "panel", - "id": "table", - "name": "Table", - "version": "" - }, - { - "type": "panel", - "id": "stat", - "name": "Stat", - "version": "" - } - ], - "annotations": { - "list": [] - }, - "description": "", - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 1, - "id": null, - "links": [], - "liveNow": false, - "panels": [ - { - "id": 101, - "type": "timeseries", - "title": "XEvent - CPU Trend - By - {${grouping_key}}", - "description": "CPU time (seconds) attributed to extended events, summed per ${grouping_key}. Uses the 5-minute aggregate gauge published by mssql_xevent; rendered as a rate since the gauge resets each collection.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 0, - "w": 24, - "h": 11 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "s", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "topk($top_n, sum by (${grouping_key}) (mssql_xevent__cpu_time_ms_last_5m{instance=\"$Server\",database_name=~\"$database\",event_name=~\"$event_name\",result=~\"$result\",client_app_name=~\"$client_app\"} / 1000))", - "legendFormat": "{{${grouping_key}}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 102, - "type": "timeseries", - "title": "XEvent - Counts Trend - By - {${grouping_key}}", - "description": "Count of extended events in the most recent 5-minute window, summed per ${grouping_key}.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 11, - "w": 24, - "h": 11 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "topk($top_n, sum by (${grouping_key}) (mssql_xevent__events_last_5m{instance=\"$Server\",database_name=~\"$database\",event_name=~\"$event_name\",result=~\"$result\",client_app_name=~\"$client_app\"}))", - "legendFormat": "{{${grouping_key}}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 103, - "type": "timeseries", - "title": "XEvent - Reads Trend - By - {${grouping_key}}", - "description": "Logical + physical reads attributed to extended events, summed per ${grouping_key}.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 22, - "w": 24, - "h": 11 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "short", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "topk($top_n, sum by (${grouping_key}) (mssql_xevent__logical_reads_last_5m{instance=\"$Server\",database_name=~\"$database\",event_name=~\"$event_name\",result=~\"$result\",client_app_name=~\"$client_app\"}))", - "legendFormat": "logical \u2022 {{${grouping_key}}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "Logical" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "topk($top_n, sum by (${grouping_key}) (mssql_xevent__physical_reads_last_5m{instance=\"$Server\",database_name=~\"$database\",event_name=~\"$event_name\",result=~\"$result\",client_app_name=~\"$client_app\"}))", - "legendFormat": "physical \u2022 {{${grouping_key}}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "Physical" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - }, - { - "id": 104, - "type": "timeseries", - "title": "XEvent - Duration Trend - By - {${grouping_key}}", - "description": "Sum of durations (seconds) for extended events in the 5-minute window, per ${grouping_key}.", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "gridPos": { - "x": 0, - "y": 33, - "w": 24, - "h": 11 - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "s", - "custom": { - "drawStyle": "line", - "lineInterpolation": "linear", - "lineWidth": 1, - "fillOpacity": 10, - "gradientMode": "none", - "spanNulls": false, - "showPoints": "never", - "pointSize": 5, - "stacking": { - "mode": "none", - "group": "A" - }, - "axisPlacement": "auto", - "axisLabel": "", - "scaleDistribution": { - "type": "linear" - }, - "hideFrom": { - "tooltip": false, - "viz": false, - "legend": false - }, - "thresholdsStyle": { - "mode": "off" - } - } - }, - "overrides": [] - }, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "calcs": [ - "lastNotNull", - "mean", - "max" - ] - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "editorMode": "code", - "expr": "topk($top_n, sum by (${grouping_key}) (mssql_xevent__duration_seconds_last_5m{instance=\"$Server\",database_name=~\"$database\",event_name=~\"$event_name\",result=~\"$result\",client_app_name=~\"$client_app\"}))", - "legendFormat": "{{${grouping_key}}}", - "range": true, - "instant": false, - "format": "time_series", - "refId": "A" - } - ], - "transformations": [], - "pluginVersion": "12.4.1" - } - ], - "refresh": "30s", - "schemaVersion": 42, - "tags": [ - "mssql", - "sqlmonitor", - "XEvent", - "prometheus" - ], - "templating": { - "list": [ - { - "name": "DS_PROMETHEUS", - "type": "datasource", - "label": "Data Source", - "query": "prometheus", - "current": { - "text": "", - "value": "${DS_PROMETHEUS}", - "selected": true - }, - "refresh": 1, - "hide": 0, - "regex": "", - "skipUrlSync": false - }, - { - "name": "Server", - "type": "query", - "label": "SQL Instance", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_up, instance)", - "query": { - "qryType": 1, - "query": "label_values(mssql_up, instance)", - "refId": "PrometheusVariableQueryEditor-Server" - }, - "refresh": 1, - "sort": 1, - "multi": false, - "includeAll": false, - "allValue": null, - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "database", - "type": "query", - "label": "Database", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_xevent__events_last_5m{instance=\"$Server\"}, database_name)", - "query": { - "qryType": 1, - "query": "label_values(mssql_xevent__events_last_5m{instance=\"$Server\"}, database_name)", - "refId": "PrometheusVariableQueryEditor-database" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "event_name", - "type": "query", - "label": "Event", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_xevent__events_last_5m{instance=\"$Server\"}, event_name)", - "query": { - "qryType": 1, - "query": "label_values(mssql_xevent__events_last_5m{instance=\"$Server\"}, event_name)", - "refId": "PrometheusVariableQueryEditor-event_name" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "result", - "type": "query", - "label": "Result", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_xevent__events_last_5m{instance=\"$Server\"}, result)", - "query": { - "qryType": 1, - "query": "label_values(mssql_xevent__events_last_5m{instance=\"$Server\"}, result)", - "refId": "PrometheusVariableQueryEditor-result" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "client_app", - "type": "query", - "label": "Client App", - "datasource": { - "type": "prometheus", - "uid": "${DS_PROMETHEUS}" - }, - "definition": "label_values(mssql_xevent__events_last_5m{instance=\"$Server\"}, client_app_name)", - "query": { - "qryType": 1, - "query": "label_values(mssql_xevent__events_last_5m{instance=\"$Server\"}, client_app_name)", - "refId": "PrometheusVariableQueryEditor-client_app" - }, - "refresh": 1, - "sort": 1, - "multi": true, - "includeAll": true, - "allValue": ".*", - "regex": "", - "current": {}, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "grouping_key", - "type": "custom", - "label": "Group by", - "query": "event_name,database_name,client_app_name,result", - "options": [ - { - "text": "event_name", - "value": "event_name", - "selected": true - }, - { - "text": "database_name", - "value": "database_name", - "selected": false - }, - { - "text": "client_app_name", - "value": "client_app_name", - "selected": false - }, - { - "text": "result", - "value": "result", - "selected": false - } - ], - "current": { - "text": "event_name", - "value": "event_name", - "selected": true - }, - "hide": 0, - "skipUrlSync": false - }, - { - "name": "top_n", - "type": "custom", - "label": "Top N series", - "query": "5,10,15,20,25", - "options": [ - { - "text": "5", - "value": "5", - "selected": false - }, - { - "text": "10", - "value": "10", - "selected": true - }, - { - "text": "15", - "value": "15", - "selected": false - }, - { - "text": "20", - "value": "20", - "selected": false - }, - { - "text": "25", - "value": "25", - "selected": false - } - ], - "current": { - "text": "10", - "value": "10", - "selected": true - }, - "hide": 0, - "skipUrlSync": false - } - ] - }, - "time": { - "from": "now-3h", - "to": "now" - }, - "timepicker": {}, - "timezone": "browser", - "title": "XEvent - Trend", - "uid": "prom_xevent_trend", - "version": 1, - "weekStart": "" -} diff --git a/sql_exporter/Prometheus-Dashboards/_lib/build.py b/sql_exporter/Prometheus-Dashboards/_lib/build.py deleted file mode 100644 index 83df97e..0000000 --- a/sql_exporter/Prometheus-Dashboards/_lib/build.py +++ /dev/null @@ -1,162 +0,0 @@ -"""Dashboard builder: turns :class:`Panel` lists into a full Grafana -dashboard JSON document ready to be imported.""" -from __future__ import annotations - -import json -from pathlib import Path -from typing import Any - -from prom_dashboard import PROM_DS, Panel, Target, ds_var, ROW_TYPE - - -_DEFAULT_THRESHOLDS = { - "mode": "absolute", - "steps": [ - {"color": "green", "value": None}, - {"color": "red", "value": 80}, - ], -} - - -def _panel_json(p: Panel, pid: int) -> dict[str, Any]: - x, y, w, h = p.grid - fc: dict[str, Any] = { - "defaults": { - "color": {"mode": "thresholds"}, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": p.thresholds_steps or [ - {"color": "green", "value": None}, - ], - }, - "unit": p.unit, - }, - "overrides": p.field_overrides, - } - if p.decimals is not None: - fc["defaults"]["decimals"] = p.decimals - if p.min_value is not None: - fc["defaults"]["min"] = p.min_value - if p.max_value is not None: - fc["defaults"]["max"] = p.max_value - - opts: dict[str, Any] - if p.type == "timeseries": - opts = { - "legend": {"displayMode": "table", "placement": "bottom", - "showLegend": True, "calcs": ["lastNotNull", "mean", "max"]}, - "tooltip": {"mode": "multi", "sort": "desc"}, - } - fc["defaults"]["custom"] = { - "drawStyle": "line", "lineInterpolation": "linear", - "lineWidth": 1, "fillOpacity": 10, "gradientMode": "none", - "spanNulls": False, "showPoints": "never", - "pointSize": 5, "stacking": {"mode": "none", "group": "A"}, - "axisPlacement": "auto", "axisLabel": "", - "scaleDistribution": {"type": "linear"}, - "hideFrom": {"tooltip": False, "viz": False, "legend": False}, - "thresholdsStyle": {"mode": "off"}, - } - elif p.type == "stat": - opts = { - "colorMode": "value", "graphMode": "area", - "justifyMode": "auto", "orientation": "auto", - "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": False}, - "textMode": "auto", "wideLayout": True, - } - elif p.type == "table": - opts = {"showHeader": True, "cellHeight": "sm", - "footer": {"countRows": False, "reducer": ["sum"], "show": False, - "fields": ""}} - fc["defaults"]["custom"] = { - "align": "auto", "cellOptions": {"type": "auto"}, - "inspect": False, "filterable": True, - } - elif p.type == "gauge": - opts = { - "orientation": "auto", "showThresholdLabels": False, - "showThresholdMarkers": True, - "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": False}, - } - elif p.type == "bargauge": - opts = { - "orientation": "horizontal", "displayMode": "gradient", - "showUnfilled": True, - "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": False}, - } - elif p.type == "text": - opts = {"mode": "markdown", "content": p.description or p.title} - else: - opts = {} - if p.options_override: - opts.update(p.options_override) - - return { - "id": pid, - "type": p.type, - "title": p.title, - "description": p.description, - "datasource": PROM_DS, - "gridPos": {"x": x, "y": y, "w": w, "h": h}, - "fieldConfig": fc, - "options": opts, - "targets": [t.to_json() for t in p.targets], - "transformations": p.transformations, - "pluginVersion": "12.4.1", - } - - -def build_dashboard(*, uid: str, title: str, tags: list[str], - variables: list[dict[str, Any]], - panels: list[Panel | dict[str, Any]], - description: str = "", - time_from: str = "now-3h", time_to: str = "now", - refresh: str = "30s") -> dict[str, Any]: - pid = 100 - flat: list[dict[str, Any]] = [] - for p in panels: - if isinstance(p, dict) and p.get("type") == ROW_TYPE: - flat.append(p) - continue - pid += 1 - flat.append(_panel_json(p, pid)) - return { - "__inputs": [{"name": "DS_PROMETHEUS", "label": "Prometheus", - "description": "", "type": "datasource", - "pluginId": "prometheus", "pluginName": "Prometheus"}], - "__elements": {}, - "__requires": [ - {"type": "grafana", "id": "grafana", "name": "Grafana", "version": "12.0.0"}, - {"type": "datasource", "id": "prometheus", "name": "Prometheus", "version": "1.0.0"}, - {"type": "panel", "id": "timeseries", "name": "Time series", "version": ""}, - {"type": "panel", "id": "table", "name": "Table", "version": ""}, - {"type": "panel", "id": "stat", "name": "Stat", "version": ""}, - ], - "annotations": {"list": []}, - "description": description, - "editable": True, - "fiscalYearStartMonth": 0, - "graphTooltip": 1, - "id": None, - "links": [], - "liveNow": False, - "panels": flat, - "refresh": refresh, - "schemaVersion": 42, - "tags": tags, - "templating": {"list": [ds_var()] + variables}, - "time": {"from": time_from, "to": time_to}, - "timepicker": {}, - "timezone": "browser", - "title": title, - "uid": uid, - "version": 1, - "weekStart": "", - } - - -def write_dashboard(out_dir: Path, filename: str, dashboard: dict[str, Any]) -> Path: - path = out_dir / filename - path.write_text(json.dumps(dashboard, indent=2) + "\n") - return path diff --git a/sql_exporter/Prometheus-Dashboards/_lib/prom_dashboard.py b/sql_exporter/Prometheus-Dashboards/_lib/prom_dashboard.py deleted file mode 100644 index 7d5f1b0..0000000 --- a/sql_exporter/Prometheus-Dashboards/_lib/prom_dashboard.py +++ /dev/null @@ -1,153 +0,0 @@ -"""Helpers for generating Prometheus-backed Grafana dashboard JSON for -SQLMonitor. Every dashboard in this folder is produced from a small -Python spec by calling :func:`build_dashboard`. - -The helpers aim for consistency with the existing sample dashboard -``sql_exporter/SQL-Exporter-Metrics-Dashboard-External.json`` so all -dashboards share the same datasource picker, schemaVersion, and -``${DS_PROMETHEUS}`` / ``$Server`` variables. -""" -from __future__ import annotations - -from dataclasses import dataclass, field -from typing import Any - - -PROM_DS = {"type": "prometheus", "uid": "${DS_PROMETHEUS}"} - - -def ds_var() -> dict[str, Any]: - return { - "name": "DS_PROMETHEUS", - "type": "datasource", - "label": "Data Source", - "query": "prometheus", - "current": {"text": "", "value": "${DS_PROMETHEUS}", "selected": True}, - "refresh": 1, - "hide": 0, - "regex": "", - "skipUrlSync": False, - } - - -def query_var(name: str, definition: str, *, label: str | None = None, - multi: bool = False, include_all: bool = False, - all_value: str = ".*", hide: int = 0, - regex: str = "") -> dict[str, Any]: - return { - "name": name, - "type": "query", - "label": label or name, - "datasource": PROM_DS, - "definition": definition, - "query": {"qryType": 1, "query": definition, - "refId": f"PrometheusVariableQueryEditor-{name}"}, - "refresh": 1, - "sort": 1, - "multi": multi, - "includeAll": include_all, - "allValue": all_value if include_all else None, - "regex": regex, - "current": {}, - "hide": hide, - "skipUrlSync": False, - } - - -def custom_var(name: str, options: list[str], *, default: str | None = None, - label: str | None = None, hide: int = 0) -> dict[str, Any]: - default = default or options[0] - return { - "name": name, - "type": "custom", - "label": label or name, - "query": ",".join(options), - "options": [ - {"text": o, "value": o, "selected": o == default} for o in options - ], - "current": {"text": default, "value": default, "selected": True}, - "hide": hide, - "skipUrlSync": False, - } - - -def constant_var(name: str, value: str, *, label: str | None = None, - hide: int = 2) -> dict[str, Any]: - return { - "name": name, - "type": "constant", - "label": label or name, - "query": value, - "current": {"text": value, "value": value, "selected": False}, - "hide": hide, - "skipUrlSync": False, - } - - -@dataclass -class Target: - expr: str - legend: str = "__auto" - ref: str = "A" - instant: bool = False - format: str = "time_series" - - def to_json(self) -> dict[str, Any]: - return { - "datasource": PROM_DS, - "editorMode": "code", - "expr": self.expr, - "legendFormat": self.legend, - "range": not self.instant, - "instant": self.instant, - "format": self.format, - "refId": self.ref, - } - - -@dataclass -class Panel: - title: str - type: str = "timeseries" - targets: list[Target] = field(default_factory=list) - grid: tuple[int, int, int, int] = (0, 0, 12, 8) # x, y, w, h - unit: str = "short" - description: str = "" - decimals: int | None = None - min_value: float | None = None - max_value: float | None = None - transformations: list[dict[str, Any]] = field(default_factory=list) - field_overrides: list[dict[str, Any]] = field(default_factory=list) - options_override: dict[str, Any] = field(default_factory=dict) - thresholds_steps: list[dict[str, Any]] | None = None - - -ROW_TYPE = "row" - - -def row(title: str, y: int, *, collapsed: bool = False, - panels: list[dict[str, Any]] | None = None) -> dict[str, Any]: - return { - "type": ROW_TYPE, - "title": title, - "collapsed": collapsed, - "gridPos": {"x": 0, "y": y, "w": 24, "h": 1}, - "panels": panels or [], - } - - -def legacy_link_panel(title: str, grid: tuple[int, int, int, int], - sql_dashboard: str, note: str = "") -> Panel: - """Text panel that deep-links to the original SQL-backed dashboard. - Used wherever a source panel cannot be represented against - Prometheus-only metrics without new collectors.""" - body = ( - f"**Legacy panel** — not yet ported to Prometheus.\n\n" - f"[Open in SQL dashboard: *{sql_dashboard}*](/d/{sql_dashboard})" - ) - if note: - body += f"\n\n_Note:_ {note}" - return Panel( - title=title, type="text", grid=grid, description=body, - options_override={"mode": "markdown", "content": body}, - ) diff --git a/sql_exporter/Prometheus-Dashboards/_specs/ag_health_state.py b/sql_exporter/Prometheus-Dashboards/_specs/ag_health_state.py deleted file mode 100644 index 06a35f4..0000000 --- a/sql_exporter/Prometheus-Dashboards/_specs/ag_health_state.py +++ /dev/null @@ -1,162 +0,0 @@ -"""Spec for ``Ag Health State`` Prometheus port (UID: prom_ag_health_state). - -SQL source dashboard has 3 data panels and one dashlist: - - 1. Table LIVE - AlwaysOn Availability Group Health Metrics - [$server] - -> latest synchronization_health / state / queue sizes / rates. - 2. Table Latest - AlwaysOn Availability Groups - Status - FILTERED - @ ${ag_health_state_collection_time_utc} - -> same columns as (1); SQL version resolves the anchor timestamp to - an exact cached snapshot. Under Prometheus we serve the latest - value within the visible range instead (documented in the panel - description). - 3. Timeseries Trend - AlwaysOn Latency - -> mssql_aghealth__latency_seconds per (replica, database). - -All metrics come from ``mssql_dba_aghealth.collector.yml`` which is -already shipped with the exporter. -""" -from prom_dashboard import Panel, Target, query_var, custom_var - - -UID = "prom_ag_health_state" -TITLE = "Ag Health State" -TAGS = ["mssql", "sqlmonitor", "Ag Health State", "prometheus"] - - -_SYNC_STATE_ALL = ".*" -_SYNC_HEALTH_ALL = ".*" - - -def variables(): - return [ - query_var("Server", "label_values(mssql_up, instance)", - label="SQL Instance", multi=True, include_all=True), - query_var("ag_name", - 'label_values(mssql_aghealth__synchronization_health{instance=~"$Server"}, ag_name)', - label="AG Name", multi=True, include_all=True), - query_var("ag_listener", - 'label_values(mssql_aghealth__synchronization_health{instance=~"$Server"}, ag_listener)', - label="AG Listener", multi=True, include_all=True), - query_var("replica_server_name", - 'label_values(mssql_aghealth__synchronization_health{instance=~"$Server"}, replica_server_name)', - label="Replica Server", multi=True, include_all=True), - query_var("database_name", - 'label_values(mssql_aghealth__synchronization_health{instance=~"$Server"}, database_name)', - label="Database", multi=True, include_all=True), - query_var("sync_state_desc", - 'label_values(mssql_aghealth__synchronization_health{instance=~"$Server"}, synchronization_state_desc)', - label="Sync State", multi=True, include_all=True), - query_var("sync_health_desc", - 'label_values(mssql_aghealth__synchronization_health{instance=~"$Server"}, synchronization_health_desc)', - label="Sync Health", multi=True, include_all=True), - custom_var("replica_type", ["__ALL__", "Primary", "Secondary", "Local"], - default="__ALL__", label="Replica Type"), - custom_var("latency_minutes", - ["-1", "0", "1", "5", "15", "30", "60"], - default="-1", label="Min Latency (min, -1=off)"), - ] - - -def panels(): - ps: list[Panel] = [] - - # Selector string shared by every panel: honours all the filter vars. - sel = ( - '{instance=~"$Server",ag_name=~"$ag_name",' - 'ag_listener=~"$ag_listener",' - 'replica_server_name=~"$replica_server_name",' - 'database_name=~"$database_name",' - 'synchronization_state_desc=~"$sync_state_desc",' - 'synchronization_health_desc=~"$sync_health_desc"}' - ) - # unique_key-only selector for metrics that only carry unique_key labels. - uksel = '{instance=~"$Server"}' - - # ---- Panel 1: LIVE table (multi-metric merge by unique_key + tags) ---- - def t(metric: str, ref: str, has_tags: bool = False) -> Target: - s = sel if has_tags else uksel - return Target(f"{metric}{s}", legend="", ref=ref, - instant=True, format="table") - - ps.append(Panel( - title="LIVE - AlwaysOn Availability Group Health Metrics - [$Server]", - description=("Latest AG replica health joined by unique_key. " - "Sync state / health / queue sizes / rates / latency " - "from mssql_aghealth__*."), - type="table", unit="short", - grid=(0, 0, 24, 14), - targets=[ - t("mssql_aghealth__synchronization_health", "Health", has_tags=True), - t("mssql_aghealth__synchronization_state", "State"), - t("mssql_aghealth__is_primary_replica", "Primary"), - t("mssql_aghealth__is_local", "Local"), - t("mssql_aghealth__is_suspended", "Suspended"), - t("mssql_aghealth__latency_seconds", "Latency"), - t("mssql_aghealth__log_send_queue_size", "LogSendQ"), - t("mssql_aghealth__redo_queue_size", "RedoQ"), - t("mssql_aghealth__log_send_rate", "LogRate"), - t("mssql_aghealth__redo_rate", "RedoRate"), - t("mssql_aghealth__estimated_redo_completion_time_min", "RedoEtaMin"), - t("mssql_aghealth__last_redone_time", "LastRedone"), - t("mssql_aghealth__last_commit_time", "LastCommit"), - ], - transformations=[ - {"id": "merge", "options": {}}, - {"id": "organize", "options": { - "excludeByName": {"Time": True, "__name__": True, "job": True, - "target": True, "exported_job": True}, - "renameByName": { - "replica_server_name": "Replica", - "database_name": "Database", - "ag_name": "AG", - "ag_listener": "Listener", - "synchronization_state_desc": "Sync State", - "synchronization_health_desc": "Sync Health", - "suspend_reason_desc": "Suspend Reason", - "Value #Health": "Health (code)", - "Value #State": "State (code)", - "Value #Primary": "Is Primary", - "Value #Local": "Is Local", - "Value #Suspended": "Is Suspended", - "Value #Latency": "Latency (s)", - "Value #LogSendQ": "Log Send Queue", - "Value #RedoQ": "Redo Queue", - "Value #LogRate": "Log Send Rate", - "Value #RedoRate": "Redo Rate", - "Value #RedoEtaMin": "Est. Redo (min)", - "Value #LastRedone": "Last Redone (epoch s)", - "Value #LastCommit": "Last Commit (epoch s)", - }, - }}, - ], - )) - - # ---- Panel 2: "Latest at anchor" table (best-effort under Prometheus) --- - ps.append(Panel( - title=("Latest - AlwaysOn Availability Groups - Status - FILTERED " - "@ dashboard end"), - description=("SQL version anchors this at a cached collection " - "timestamp. Prometheus serves the latest sample within " - "the visible range instead."), - type="table", unit="short", - grid=(0, 14, 24, 11), - targets=[Target( - f"last_over_time(mssql_aghealth__latency_seconds{sel}[$__range])", - legend="", ref="A", instant=True, format="table")], - )) - - # ---- Panel 3: Latency trend timeseries ---- - ps.append(Panel( - title="Trend - AlwaysOn Latency (seconds)", - description=("Per (replica, database) commit latency vs the primary, " - "from mssql_aghealth__latency_seconds. " - "-1 latency means the probe could not be evaluated."), - type="timeseries", unit="s", - grid=(0, 25, 24, 16), - targets=[Target( - f"mssql_aghealth__latency_seconds{sel}", - legend="{{replica_server_name}} || {{database_name}}", ref="A")], - )) - - return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/backup_history.py b/sql_exporter/Prometheus-Dashboards/_specs/backup_history.py deleted file mode 100644 index 543aa8c..0000000 --- a/sql_exporter/Prometheus-Dashboards/_specs/backup_history.py +++ /dev/null @@ -1,167 +0,0 @@ -"""Spec for ``Backup History`` Prometheus port (UID: prom_backup_history). - -SQL source dashboard ``t___Backup_History.json`` has 2 data panels: - - 1. Table Backup History - [$server] - [$database] - → most recent Full/Diff/Log backup per database with size + duration - and age-since-completion. - 2. Timeseries Backup Size Trend - [$server] - [$database] - → size_bytes over time, grouped by backup_type. - -Backed by the new ``mssql_backup_history.collector.yml``: - - mssql_backup__last_time_utc {database_name, backup_type, - backup_type_desc, recovery_model} - mssql_backup__last_duration_seconds {database_name, backup_type} - mssql_backup__last_size_bytes {database_name, backup_type} - mssql_backup__last_compressed_size_bytes {database_name, backup_type} - mssql_backup__age_seconds {database_name, backup_type} - mssql_backup__count_last_24h {database_name, backup_type} -""" -from prom_dashboard import Panel, Target, query_var, custom_var - - -UID = "prom_backup_history" -TITLE = "Backup History" -TAGS = ["mssql", "sqlmonitor", "Backup", "prometheus"] - - -def variables(): - return [ - query_var("Server", "label_values(mssql_up, instance)", - label="SQL Instance", multi=True, include_all=True), - query_var("database_name", - 'label_values(mssql_backup__last_time_utc{instance=~"$Server"}, database_name)', - label="Database", multi=True, include_all=True), - custom_var("backup_type", - ["__ALL__", "D", "I", "L", "F", "G", "P", "Q"], - default="__ALL__", - label="Backup Type (D=Full, I=Diff, L=Log)"), - custom_var("full_threshold_days", - ["1", "2", "3", "7", "14", "30"], default="7", - label="Full age warn (days)"), - custom_var("diff_threshold_hours", - ["4", "8", "12", "24", "48"], default="24", - label="Diff age warn (hours)"), - custom_var("tlog_threshold_minutes", - ["5", "15", "30", "60", "120", "240"], default="30", - label="Log age warn (minutes)"), - ] - - -def panels(): - ps: list[Panel] = [] - I = ('{instance=~"$Server",database_name=~"$database_name",' - 'backup_type=~"$backup_type"}') - - # Summary stats - ps.append(Panel( - title="Databases - Covered", - description="Number of databases reporting backup history.", - type="stat", unit="short", - grid=(0, 0, 6, 4), - targets=[Target( - f'count(count by (instance, database_name) ' - f'(mssql_backup__last_time_utc{I}))', - legend="", ref="A", instant=True)], - )) - ps.append(Panel( - title="Full Backups older than $full_threshold_days days", - description="Databases whose most recent Full (D) backup is older " - "than the configured threshold.", - type="stat", unit="short", - grid=(6, 0, 6, 4), - thresholds_steps=[{"color": "green", "value": None}, - {"color": "red", "value": 1}], - targets=[Target( - f'count(mssql_backup__age_seconds{{instance=~"$Server",' - f'database_name=~"$database_name",backup_type="D"}} ' - f'> ($full_threshold_days * 86400))', - legend="", ref="A", instant=True)], - )) - ps.append(Panel( - title="Diff Backups older than $diff_threshold_hours hours", - description="Databases whose most recent Differential (I) backup is " - "older than the configured threshold.", - type="stat", unit="short", - grid=(12, 0, 6, 4), - thresholds_steps=[{"color": "green", "value": None}, - {"color": "red", "value": 1}], - targets=[Target( - f'count(mssql_backup__age_seconds{{instance=~"$Server",' - f'database_name=~"$database_name",backup_type="I"}} ' - f'> ($diff_threshold_hours * 3600))', - legend="", ref="A", instant=True)], - )) - ps.append(Panel( - title="Log Backups older than $tlog_threshold_minutes minutes", - description="Databases whose most recent Log (L) backup is older " - "than the configured threshold.", - type="stat", unit="short", - grid=(18, 0, 6, 4), - thresholds_steps=[{"color": "green", "value": None}, - {"color": "red", "value": 1}], - targets=[Target( - f'count(mssql_backup__age_seconds{{instance=~"$Server",' - f'database_name=~"$database_name",backup_type="L"}} ' - f'> ($tlog_threshold_minutes * 60))', - legend="", ref="A", instant=True)], - )) - - # Main detail table - ps.append(Panel( - title="Backup History - [$Server] - [$database_name]", - description=("Latest backup per (database, type): age / duration / " - "size / compressed size / 24h count, joined by the " - "backup_type label."), - type="table", unit="short", - grid=(0, 4, 24, 16), - targets=[ - Target(f"mssql_backup__last_time_utc{I}", - legend="", ref="When", instant=True, format="table"), - Target(f"mssql_backup__age_seconds{I}", - legend="", ref="AgeS", instant=True, format="table"), - Target(f"mssql_backup__last_duration_seconds{I}", - legend="", ref="DurS", instant=True, format="table"), - Target(f"mssql_backup__last_size_bytes{I}", - legend="", ref="Size", instant=True, format="table"), - Target(f"mssql_backup__last_compressed_size_bytes{I}", - legend="", ref="CompSize", instant=True, format="table"), - Target(f"mssql_backup__count_last_24h{I}", - legend="", ref="Cnt24h", instant=True, format="table"), - ], - transformations=[ - {"id": "merge", "options": {}}, - {"id": "organize", "options": { - "excludeByName": {"Time": True, "__name__": True, - "job": True, "target": True, - "exported_job": True}, - "renameByName": { - "instance": "Server", - "database_name": "Database", - "backup_type": "Type", - "backup_type_desc": "Type Description", - "recovery_model": "Recovery Model", - "Value #When": "Last Backup (UTC epoch)", - "Value #AgeS": "Age (s)", - "Value #DurS": "Duration (s)", - "Value #Size": "Size (bytes)", - "Value #CompSize": "Compressed (bytes)", - "Value #Cnt24h": "Count (24h)", - }, - }}, - ], - )) - - # Size trend - ps.append(Panel( - title="Backup Size Trend - [$Server] - [$database_name]", - description="Per-(database, backup_type) backup size over time.", - type="timeseries", unit="bytes", - grid=(0, 20, 24, 12), - targets=[Target( - f"mssql_backup__last_size_bytes{I}", - legend="{{database_name}} / {{backup_type}}", ref="A")], - )) - - return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/core_metrics_trend.py b/sql_exporter/Prometheus-Dashboards/_specs/core_metrics_trend.py deleted file mode 100644 index 929b50e..0000000 --- a/sql_exporter/Prometheus-Dashboards/_specs/core_metrics_trend.py +++ /dev/null @@ -1,225 +0,0 @@ -"""Spec for ``Core Metrics - Trend`` Prometheus port. - -High-fidelity port. Every variable from the SQL dashboard is preserved: - - $Server SQL instance(s) (multi + include-all) - $trend_by Hourly | Daily → sets the aggregation window used - inside ``quantile_over_time``; the SQL dashboard's - ``all_server_volatile_info_history_hourly`` / - ``_daily`` cached tables become 1h / 1d windows here. - $percentile p50 | p75 | p95 | p99 | max → maps to the first - argument of ``quantile_over_time`` (``max`` == 1.0). - $hour_of_day 0..23. Filters at query-evaluation time via - ``hour() == bool $hour_of_day``. NOTE: pure PromQL - cannot retrieve historical data for a specific - hour-of-day; this filter only applies when the - dashboard range is currently at that hour. For the - backfilled version, see the SQL dashboard - ``core_metrics_trend``. See README for details. - $max_servers N → top-N server filter, preserved via - ``topk($max_servers, ...)``. -""" -from prom_dashboard import Panel, Target, query_var, custom_var, constant_var - - -UID = "prom_core_metrics_trend" -TITLE = "Core Metrics - Trend" -TAGS = ["mssql", "sqlmonitor", "core-metrics", "prometheus"] - - -_PCTL_MAP = {"p50": "0.5", "p75": "0.75", "p95": "0.95", - "p99": "0.99", "max": "1.0"} -_TREND_MAP = {"Hourly": "1h", "Daily": "1d"} - - -def variables(): - return [ - query_var("Server", "label_values(mssql_up, instance)", - label="SQL Instance", multi=True, include_all=True), - custom_var("trend_by", ["Hourly", "Daily"], default="Hourly", - label="Trend By"), - custom_var("trend_window", list(_TREND_MAP.values()), - default="1h", label="Trend Window", hide=2), - custom_var("percentile", - list(_PCTL_MAP.keys()), - default="p95", label="Percentile"), - custom_var("percentile_q", - list(_PCTL_MAP.values()), - default="0.95", label="Percentile Q", hide=2), - custom_var("hour_of_day", - [str(i) for i in range(24)] + ["-1"], - default="-1", label="Hour of Day (-1 = any)"), - constant_var("max_servers", "10", label="Max Servers"), - ] - - -def _pct(expr: str, window: str = "$trend_window") -> str: - return f"quantile_over_time($percentile_q, ({expr})[{window}:])" - - -def _hod_gate() -> str: - # Gate an expression on $hour_of_day ≥ 0 and matching the query eval - # hour. When $hour_of_day = -1 the gate is always 1 (no filter). - return ( - "(vector($hour_of_day) == bool -1) " - "or on () (vector($hour_of_day) == bool hour())" - ) - - -def panels(): - ps: list[Panel] = [] - SERVER = '{instance=~"$Server"}' - RI = "[$__rate_interval]" - TW = "$trend_window" - - def pct(expr: str) -> str: - return f"quantile_over_time($percentile_q, ({expr})[{TW}:])" - - def topk(expr: str) -> str: - return f"topk($max_servers, {expr})" - - # 1. Database IO Latency (ms/IO) per (server, db) - $trend_by window - # SQL source: Core Metrics - Trend - Database IO Latency - Server - read_lat = ( - f"rate(mssql_virtualfilestats__io_stall_read_ms{SERVER}{RI}) " - f"/ clamp_min(rate(mssql_virtualfilestats__num_of_reads{SERVER}{RI}), 1)" - ) - write_lat = ( - f"rate(mssql_virtualfilestats__io_stall_write_ms{SERVER}{RI}) " - f"/ clamp_min(rate(mssql_virtualfilestats__num_of_writes{SERVER}{RI}), 1)" - ) - ps.append(Panel( - title="Core Metrics - ${trend_by} TREND - Database IO Latency - Server ___[${Server}]___", - description=("Per-database read/write latency in ms/IO. " - "Aggregated at the $trend_by window using $percentile " - "quantile_over_time."), - type="timeseries", unit="ms", - grid=(0, 0, 24, 8), - targets=[ - Target(pct(f"avg by (instance, database_name) ({read_lat})"), - legend="{{instance}} - {{database_name}} - read", ref="A"), - Target(pct(f"avg by (instance, database_name) ({write_lat})"), - legend="{{instance}} - {{database_name}} - write", ref="B"), - ], - )) - - # 2. Database IO (MB/s) per (server, db) - ps.append(Panel( - title="Core Metrics - ${trend_by} TREND - Database IO - Server ___[${Server}]___", - description="Per-database throughput in MB/s at the $trend_by window.", - type="timeseries", unit="MBs", - grid=(0, 8, 24, 8), - targets=[ - Target(pct( - f"sum by (instance, database_name) (" - f"rate(mssql_virtualfilestats__num_of_bytes_read{SERVER}{RI})) / (1024*1024)" - ), legend="{{instance}} - {{database_name}} - read", ref="A"), - Target(pct( - f"sum by (instance, database_name) (" - f"rate(mssql_virtualfilestats__num_of_bytes_written{SERVER}{RI})) / (1024*1024)" - ), legend="{{instance}} - {{database_name}} - write", ref="B"), - ], - )) - - # 3. Database IOPS per (server, db) - ps.append(Panel( - title="Core Metrics - ${trend_by} TREND - Database IOPS - Server ___[${Server}]___", - description="Per-database reads/writes per second at the $trend_by window.", - type="timeseries", unit="iops", - grid=(0, 16, 24, 8), - targets=[ - Target(pct( - f"sum by (instance, database_name) (" - f"rate(mssql_virtualfilestats__num_of_reads{SERVER}{RI}))" - ), legend="{{instance}} - {{database_name}} - reads", ref="A"), - Target(pct( - f"sum by (instance, database_name) (" - f"rate(mssql_virtualfilestats__num_of_writes{SERVER}{RI}))" - ), legend="{{instance}} - {{database_name}} - writes", ref="B"), - ], - )) - - # 4. OS CPU (%) - top-N servers - os_cpu = ( - f"100 - (avg by (instance) (" - f"rate(windows_cpu_time_total{{mode=\"idle\",instance=~\"$Server\"}}{RI})) * 100)" - ) - ps.append(Panel( - title="Core Metrics - ${trend_by} TREND - OS CPU - Max ${max_servers} Servers", - description="OS CPU % per server, top-N by $percentile at $trend_by window.", - type="timeseries", unit="percent", - grid=(0, 24, 12, 8), - min_value=0, max_value=100, - targets=[Target(topk(pct(os_cpu)), legend="{{instance}}", ref="A")], - )) - - # 5. SQL CPU (%) - top-N servers - sql_cpu = f"avg by (instance) (mssql_cpu_utilization_percentage{SERVER})" - ps.append(Panel( - title="Core Metrics - ${trend_by} TREND - SQL CPU - Max ${max_servers} Servers", - description="SQL CPU % per server, top-N by $percentile at $trend_by window.", - type="timeseries", unit="percent", - grid=(12, 24, 12, 8), - min_value=0, max_value=100, - targets=[Target(topk(pct(sql_cpu)), legend="{{instance}}", ref="A")], - )) - - # 6. Disk Latency - top-N servers - dl_r = ( - f"rate(windows_logical_disk_read_latency_seconds_total{SERVER}{RI}) " - f"/ clamp_min(rate(windows_logical_disk_reads_total{SERVER}{RI}), 1)" - ) - dl_w = ( - f"rate(windows_logical_disk_write_latency_seconds_total{SERVER}{RI}) " - f"/ clamp_min(rate(windows_logical_disk_writes_total{SERVER}{RI}), 1)" - ) - ps.append(Panel( - title="Core Metrics - ${trend_by} TREND - Disk Latency - Max ${max_servers} Servers", - description="OS-level disk latency (s/IO) per volume. top-N by $percentile.", - type="timeseries", unit="s", - grid=(0, 32, 24, 8), - targets=[ - Target(topk(pct(f"avg by (instance, volume) ({dl_r})")), - legend="{{instance}} {{volume}} read", ref="A"), - Target(topk(pct(f"avg by (instance, volume) ({dl_w})")), - legend="{{instance}} {{volume}} write", ref="B"), - ], - )) - - # 7. Batch Requests / sec - top-N servers - ps.append(Panel( - title="Core Metrics - ${trend_by} TREND - Requests - Max ${max_servers} Servers", - description="Batch requests/sec per server, top-N by $percentile.", - type="timeseries", unit="reqps", - grid=(0, 40, 12, 8), - targets=[Target( - topk(pct(f"sum by (instance) (rate(mssql_batch_requests{SERVER}{RI}))")), - legend="{{instance}}", ref="A")], - )) - - # 8. Available Memory (OS) - bottom-N (smallest) servers at $percentile - ps.append(Panel( - title="Core Metrics - ${trend_by} TREND - Available Memory - Max ${max_servers} Servers", - description=("OS available memory per server, bottom-N (smallest) " - "at $percentile quantile over $trend_by window."), - type="timeseries", unit="bytes", - grid=(12, 40, 12, 8), - targets=[Target( - f"bottomk($max_servers, " - f"quantile_over_time($percentile_q, " - f"(avg by (instance) (windows_memory_available_bytes{SERVER}))[{TW}:]))", - legend="{{instance}}", ref="A")], - )) - - # 9. Connections - top-N servers - ps.append(Panel( - title="Core Metrics - ${trend_by} TREND - Connections - Max ${max_servers} Servers", - description="SQL connection count per server, top-N by $percentile.", - type="timeseries", unit="short", - grid=(0, 48, 24, 8), - targets=[Target( - topk(pct(f"sum by (instance) (mssql_connections{SERVER})")), - legend="{{instance}}", ref="A")], - )) - - return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/database_file_io_stats.py b/sql_exporter/Prometheus-Dashboards/_specs/database_file_io_stats.py deleted file mode 100644 index d1c9921..0000000 --- a/sql_exporter/Prometheus-Dashboards/_specs/database_file_io_stats.py +++ /dev/null @@ -1,340 +0,0 @@ -"""Spec for ``Database File IO Stats`` Prometheus port -(UID: prom_database_file_io_stats). - -SQL source dashboard has 16 data panels grouped into nine rows: - - File IO Stats - Since Startup (table) - File IO Stats - Selective (2 tables: @from, @range) - File IO Stats - Reads/Writes histogram - Data (timeseries) - File IO Stats - Reads/Writes histogram - Counts (timeseries) - Database IO Stats - Trend (timeseries) - Database IO Stats - Since Startup (table) - Database IO Stats - Selective (2 tables) - Database IO Stats - Comparison (2 tables, with prior day) - Disk IO Stats - Since Startup (table) - Disk IO Stats - Selective (2 tables) - Disk IO Stats - Comparison (2 tables) - -Metric source: - mssql_virtualfilestats__{num_of_reads,num_of_writes, - num_of_bytes_read,num_of_bytes_written, - io_stall_read_ms,io_stall_write_ms} - are counter-style gauges published by mssql_dba_cached on every scrape. - -PromQL equivalents: - since-startup tables → the raw counter (instant, last-over-range). - selective / range tables → increase(metric[$__range]). - comparison "prior day" → the same increase() but anchored with - @ end() offset $__range so the window is - shifted back one dashboard-range. - trend timeseries → rate(metric[$__rate_interval]). -""" -from prom_dashboard import Panel, Target, query_var, constant_var - - -UID = "prom_database_file_io_stats" -TITLE = "Database File IO Stats" -TAGS = ["mssql", "sqlmonitor", "IO Stats", "prometheus"] - - -def variables(): - return [ - query_var("Server", "label_values(mssql_up, instance)", - label="SQL Instance"), - query_var("database", - 'label_values(mssql_virtualfilestats__num_of_reads{instance="$Server"}, database_name)', - label="Database", multi=True, include_all=True), - query_var("disk_drive", - 'label_values(mssql_virtualfilestats__num_of_reads{instance="$Server"}, disk_volume)', - label="Disk", multi=True, include_all=True), - constant_var("top_n", "25", label="Top N Rows"), - ] - - -I = ('{instance="$Server",database_name=~"$database",' - 'disk_volume=~"$disk_drive"}') - - -def panels(): - ps: list[Panel] = [] - # ---- File IO Stats — Since Startup (table) ---- - ps.append(Panel( - title="File IO Stats ___ Since Startup", - description=("Per-file counters since SQL Server start, straight " - "off mssql_virtualfilestats__*: bytes read/written, " - "IO counts and cumulative stall time (ms)."), - type="table", unit="short", - grid=(0, 0, 24, 10), - targets=[ - Target(f"mssql_virtualfilestats__num_of_bytes_read{I}", - legend="", ref="BR", instant=True, format="table"), - Target(f"mssql_virtualfilestats__num_of_bytes_written{I}", - legend="", ref="BW", instant=True, format="table"), - Target(f"mssql_virtualfilestats__num_of_reads{I}", - legend="", ref="NR", instant=True, format="table"), - Target(f"mssql_virtualfilestats__num_of_writes{I}", - legend="", ref="NW", instant=True, format="table"), - Target(f"mssql_virtualfilestats__io_stall_read_ms{I}", - legend="", ref="SR", instant=True, format="table"), - Target(f"mssql_virtualfilestats__io_stall_write_ms{I}", - legend="", ref="SW", instant=True, format="table"), - ], - transformations=[ - {"id": "merge", "options": {}}, - {"id": "organize", "options": { - "excludeByName": {"Time": True, "__name__": True, - "job": True, "target": True, - "exported_job": True}, - "renameByName": { - "database_name": "Database", - "file_logical_name": "File", - "disk_volume": "Volume", - "Value #BR": "Bytes Read", - "Value #BW": "Bytes Written", - "Value #NR": "# Reads", - "Value #NW": "# Writes", - "Value #SR": "Stall Read (ms)", - "Value #SW": "Stall Write (ms)", - }, - }}, - ], - )) - - # ---- File IO Stats — Since Startup till $__from ---- - ps.append(Panel( - title="File IO Stats ___ Since Startup till ${__from:date:YYYY-MM-DD HH.mm}", - description=("Counter values at the dashboard's `from` time — " - "accumulated IO from SQL startup until the start of " - "the visible range."), - type="table", unit="short", - grid=(0, 10, 24, 10), - targets=[Target( - f"mssql_virtualfilestats__num_of_bytes_read{I} " - f"@ end() offset ($__to - $__from)", - legend="", ref="A", instant=True, format="table")], - )) - - # ---- File IO Stats — In Selected Time Duration ---- - ps.append(Panel( - title=("File IO Stats ___ In Selected Time Duration ___" - "${__from:date:YYYY-MM-DD HH.mm} → " - "${__to:date:YYYY-MM-DD HH.mm}"), - description=("Delta of each virtualfilestats counter over the " - "dashboard's visible range (increase())."), - type="table", unit="short", - grid=(0, 20, 24, 10), - targets=[ - Target(f"increase(mssql_virtualfilestats__num_of_bytes_read{I}[$__range])", - legend="", ref="BR", instant=True, format="table"), - Target(f"increase(mssql_virtualfilestats__num_of_bytes_written{I}[$__range])", - legend="", ref="BW", instant=True, format="table"), - Target(f"increase(mssql_virtualfilestats__num_of_reads{I}[$__range])", - legend="", ref="NR", instant=True, format="table"), - Target(f"increase(mssql_virtualfilestats__num_of_writes{I}[$__range])", - legend="", ref="NW", instant=True, format="table"), - Target(f"increase(mssql_virtualfilestats__io_stall_read_ms{I}[$__range])", - legend="", ref="SR", instant=True, format="table"), - Target(f"increase(mssql_virtualfilestats__io_stall_write_ms{I}[$__range])", - legend="", ref="SW", instant=True, format="table"), - ], - transformations=[ - {"id": "merge", "options": {}}, - {"id": "organize", "options": { - "excludeByName": {"Time": True, "__name__": True, - "job": True, "target": True, - "exported_job": True}, - }}, - ], - )) - - # ---- File IO Stats Reads/Writes (Data - bytes) Histogram ---- - ps.append(Panel( - title="[${Server}] - Db File IO Stats - Read/Writes Data", - description=("Per-file bytes-read and bytes-written rates " - "(bytes/sec), derived from the two underlying " - "counters."), - type="timeseries", unit="Bps", - grid=(0, 30, 24, 12), - targets=[ - Target( - f"rate(mssql_virtualfilestats__num_of_bytes_read{I}[$__rate_interval])", - legend="read • {{database_name}} / {{file_logical_name}}", - ref="Reads"), - Target( - f"rate(mssql_virtualfilestats__num_of_bytes_written{I}[$__rate_interval])", - legend="write • {{database_name}} / {{file_logical_name}}", - ref="Writes"), - ], - )) - - # ---- File IO Stats Reads/Writes (#) Histogram ---- - ps.append(Panel( - title="[${Server}] - Db File IO Stats - # Read/Writes", - description=("Per-file IO operations per second " - "(reads + writes), derived from the operation " - "counters."), - type="timeseries", unit="ops", - grid=(0, 42, 24, 12), - targets=[ - Target( - f"rate(mssql_virtualfilestats__num_of_reads{I}[$__rate_interval])", - legend="reads/s • {{database_name}} / {{file_logical_name}}", - ref="Reads"), - Target( - f"rate(mssql_virtualfilestats__num_of_writes{I}[$__rate_interval])", - legend="writes/s • {{database_name}} / {{file_logical_name}}", - ref="Writes"), - ], - )) - - # ---- Database IO Stats — Trend ---- - ps.append(Panel( - title="[${Server}] - Db IO Stats - Read/Writes Data", - description=("Aggregated per-database read/write throughput " - "(Bps), summed across files."), - type="timeseries", unit="Bps", - grid=(0, 54, 24, 12), - targets=[ - Target( - f"sum by (database_name) (" - f"rate(mssql_virtualfilestats__num_of_bytes_read{I}[$__rate_interval]))", - legend="read • {{database_name}}", ref="R"), - Target( - f"sum by (database_name) (" - f"rate(mssql_virtualfilestats__num_of_bytes_written{I}[$__rate_interval]))", - legend="write • {{database_name}}", ref="W"), - ], - )) - - # ---- Database IO Stats — Since Startup (aggregated) ---- - ps.append(Panel( - title="Database IO Stats ___ Since Startup", - description="Per-database aggregates of the filestats counters " - "from SQL Server startup.", - type="table", unit="short", - grid=(0, 66, 24, 10), - targets=[ - Target( - f"sum by (instance, database_name) (" - f"mssql_virtualfilestats__num_of_bytes_read{I})", - legend="", ref="BR", instant=True, format="table"), - Target( - f"sum by (instance, database_name) (" - f"mssql_virtualfilestats__num_of_bytes_written{I})", - legend="", ref="BW", instant=True, format="table"), - Target( - f"sum by (instance, database_name) (" - f"mssql_virtualfilestats__io_stall_read_ms{I})", - legend="", ref="SR", instant=True, format="table"), - Target( - f"sum by (instance, database_name) (" - f"mssql_virtualfilestats__io_stall_write_ms{I})", - legend="", ref="SW", instant=True, format="table"), - ], - transformations=[{"id": "merge", "options": {}}], - )) - - # ---- Database IO Stats — In Selected Time Duration ---- - ps.append(Panel( - title="Database IO Stats ___ In Selected Time Duration", - description="Per-database delta over the dashboard range.", - type="table", unit="short", - grid=(0, 76, 24, 10), - targets=[ - Target( - f"sum by (instance, database_name) (" - f"increase(mssql_virtualfilestats__num_of_bytes_read{I}[$__range]))", - legend="", ref="BR", instant=True, format="table"), - Target( - f"sum by (instance, database_name) (" - f"increase(mssql_virtualfilestats__num_of_bytes_written{I}[$__range]))", - legend="", ref="BW", instant=True, format="table"), - ], - transformations=[{"id": "merge", "options": {}}], - )) - - # ---- Database IO Stats — Comparison (prior window) ---- - ps.append(Panel( - title="Database IO Stats ___ Prior Window ___ DAY(+/-)", - description=("Same aggregate delta as above but over the time " - "window immediately *before* the dashboard range. " - "Use side-by-side with the previous panel for " - "day-over-day comparison."), - type="table", unit="short", - grid=(0, 86, 24, 10), - targets=[ - Target( - f"sum by (instance, database_name) (" - f"increase(mssql_virtualfilestats__num_of_bytes_read{I}[$__range] " - f"@ end() offset $__range))", - legend="", ref="BR", instant=True, format="table"), - Target( - f"sum by (instance, database_name) (" - f"increase(mssql_virtualfilestats__num_of_bytes_written{I}[$__range] " - f"@ end() offset $__range))", - legend="", ref="BW", instant=True, format="table"), - ], - transformations=[{"id": "merge", "options": {}}], - )) - - # ---- Disk IO Stats — Since Startup (by disk_volume) ---- - ps.append(Panel( - title="Disk IO Stats ___ Since Startup", - description="Per-volume aggregates of the filestats counters.", - type="table", unit="short", - grid=(0, 96, 24, 10), - targets=[ - Target( - f"sum by (instance, disk_volume) (" - f"mssql_virtualfilestats__num_of_bytes_read{I})", - legend="", ref="BR", instant=True, format="table"), - Target( - f"sum by (instance, disk_volume) (" - f"mssql_virtualfilestats__num_of_bytes_written{I})", - legend="", ref="BW", instant=True, format="table"), - ], - transformations=[{"id": "merge", "options": {}}], - )) - - # ---- Disk IO Stats — In Selected Time Duration ---- - ps.append(Panel( - title="Disk IO Stats ___ In Selected Time Duration", - description="Per-volume delta over the dashboard range.", - type="table", unit="short", - grid=(0, 106, 24, 10), - targets=[ - Target( - f"sum by (instance, disk_volume) (" - f"increase(mssql_virtualfilestats__num_of_bytes_read{I}[$__range]))", - legend="", ref="BR", instant=True, format="table"), - Target( - f"sum by (instance, disk_volume) (" - f"increase(mssql_virtualfilestats__num_of_bytes_written{I}[$__range]))", - legend="", ref="BW", instant=True, format="table"), - ], - transformations=[{"id": "merge", "options": {}}], - )) - - # ---- Disk IO Stats — Prior window comparison ---- - ps.append(Panel( - title="Disk IO Stats ___ Prior Window", - description="Per-volume delta over the window immediately before " - "the dashboard range.", - type="table", unit="short", - grid=(0, 116, 24, 10), - targets=[ - Target( - f"sum by (instance, disk_volume) (" - f"increase(mssql_virtualfilestats__num_of_bytes_read{I}[$__range] " - f"@ end() offset $__range))", - legend="", ref="BR", instant=True, format="table"), - Target( - f"sum by (instance, disk_volume) (" - f"increase(mssql_virtualfilestats__num_of_bytes_written{I}[$__range] " - f"@ end() offset $__range))", - legend="", ref="BW", instant=True, format="table"), - ], - transformations=[{"id": "merge", "options": {}}], - )) - - return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/dba_inventory.py b/sql_exporter/Prometheus-Dashboards/_specs/dba_inventory.py deleted file mode 100644 index 98a23b2..0000000 --- a/sql_exporter/Prometheus-Dashboards/_specs/dba_inventory.py +++ /dev/null @@ -1,204 +0,0 @@ -"""Spec for ``DBA Inventory`` Prometheus port (UID: prom_dba_inventory). - -Source dashboard ``DBA Inventory.json`` has 10 data panels, all driven -off the SQLMonitor inventory schema (dbo.servers, dbo.sql_instances, -dbo.sql_cluster_nodes, etc). That schema is *not* exposed to -Prometheus — those tables are live in SQL Server and the exporter does -not publish row-level inventory rows. - -Strategy: - • Panels that *can* be rebuilt from the `mssql_up`, `mssql_service_info`, - and `mssql_aghealth__*` metrics are implemented as stat/table panels. - • The rest link back to the original SQL dashboard with - ``legacy_link_panel`` so the Prometheus dashboard still lists every - source section and does not pretend inventory data has been ported. -""" -from prom_dashboard import ( - Panel, Target, query_var, legacy_link_panel, -) - - -UID = "prom_dba_inventory" -TITLE = "DBA Inventory" -TAGS = ["mssql", "sqlmonitor", "Inventory", "prometheus"] - - -_LEGACY_UID = "dba-inventory" - - -def variables(): - return [ - query_var("Server", "label_values(mssql_up, instance)", - label="SQL Instance", multi=True, include_all=True), - ] - - -def panels(): - ps: list[Panel] = [] - - # Summary row — real Prometheus data - ps.append(Panel( - title="SQL Instances - Online", - description="Count of SQL Server targets currently scraping " - "successfully (mssql_up == 1).", - type="stat", unit="short", - grid=(0, 0, 6, 4), - thresholds_steps=[{"color": "red", "value": None}, - {"color": "green", "value": 1}], - targets=[Target('sum(mssql_up == 1)', legend="", ref="A", - instant=True)], - )) - ps.append(Panel( - title="SQL Instances - Offline", - description="Count of SQL Server targets with mssql_up == 0.", - type="stat", unit="short", - grid=(6, 0, 6, 4), - thresholds_steps=[{"color": "green", "value": None}, - {"color": "red", "value": 1}], - targets=[Target('sum(mssql_up == 0)', legend="", ref="A", - instant=True)], - )) - ps.append(Panel( - title="Availability Groups", - description="Distinct AG names observed across scrape targets.", - type="stat", unit="short", - grid=(12, 0, 6, 4), - targets=[Target( - 'count(count by (ag_name) (mssql_aghealth__synchronization_health))', - legend="", ref="A", instant=True)], - )) - ps.append(Panel( - title="Hosts", - description="Distinct hostnames observed via mssql_service_info.", - type="stat", unit="short", - grid=(18, 0, 6, 4), - targets=[Target( - 'count(count by (host_name) (mssql_service_info))', - legend="", ref="A", instant=True)], - )) - - # Combined Info table (instance-level) - ps.append(Panel( - title="SQL Servers - Combined Info - FILTERED", - description=("Per-instance combined info from mssql_service_info " - "(host/service/product) and mssql_up for online state."), - type="table", unit="short", - grid=(0, 4, 24, 9), - targets=[ - Target('mssql_service_info{instance=~"$Server"}', - legend="", ref="Info", instant=True, format="table"), - Target('mssql_up{instance=~"$Server"}', - legend="", ref="Up", instant=True, format="table"), - ], - transformations=[ - {"id": "merge", "options": {}}, - {"id": "organize", "options": { - "excludeByName": {"Time": True, "__name__": True, - "job": True, "target": True, - "exported_job": True}, - "renameByName": { - "instance": "Server", - "host_name": "Host", - "product_version": "Version", - "service_name": "Service", - "Value #Info": "Info", - "Value #Up": "Up?", - }, - }}, - ], - )) - - # SQL Instance Details → inventory-only (legacy link) - ps.append(legacy_link_panel( - "SQLMonitor - Instance Details - FILTERED", - grid=(0, 13, 24, 7), - sql_dashboard=_LEGACY_UID, - note="Inventory-DB columns (alias, linked-server-name, " - "major/minor version breakdown) are not exposed to " - "Prometheus. Use the SQL dashboard for the full detail row.", - )) - - # All Servers - Basic Info → inventory - ps.append(legacy_link_panel( - "All Servers - Basic Info", - grid=(0, 20, 24, 7), - sql_dashboard=_LEGACY_UID, - note="dbo.vw_all_servers_basic_info (SMA agents, OS hosts, " - "service accounts) is not mirrored in Prometheus.", - )) - - # SQL Servers - Extended Info → inventory - ps.append(legacy_link_panel( - "SQL Servers - Extended Info", - grid=(0, 27, 24, 7), - sql_dashboard=_LEGACY_UID, - note="SKU / license / feature matrix — inventory table.", - )) - - # SQL Server Hosts → inventory - ps.append(legacy_link_panel( - "SQL Server Hosts", - grid=(0, 34, 24, 7), - sql_dashboard=_LEGACY_UID, - note="Host-level inventory (IP/FQDN/domain) is only in the " - "SQLMonitor inventory DB.", - )) - - # SQL Server Availability Groups - ps.append(Panel( - title="SQL Server Availability Groups - Online", - description=("Per-AG replica count and distinct databases, " - "derived from mssql_aghealth__synchronization_health " - "labels."), - type="table", unit="short", - grid=(0, 41, 24, 9), - targets=[ - Target( - 'count by (ag_name, ag_listener) ' - '(mssql_aghealth__synchronization_health{instance=~"$Server"})', - legend="", ref="Replicas", instant=True, format="table"), - Target( - 'count by (ag_name, database_name) ' - '(mssql_aghealth__synchronization_health{instance=~"$Server"})', - legend="", ref="Dbs", instant=True, format="table"), - ], - transformations=[ - {"id": "merge", "options": {}}, - ], - )) - - # SQL Clusters → legacy (no cluster-topology metrics) - ps.append(legacy_link_panel( - "SQL Clusters", - grid=(0, 50, 24, 8), - sql_dashboard=_LEGACY_UID, - note="WSFC node / resource-group ownership is inventory-only.", - )) - - # Login Expiry → inventory - ps.append(legacy_link_panel( - "SQL Servers - Login Expiry", - grid=(0, 58, 24, 8), - sql_dashboard=_LEGACY_UID, - note="Login-expiry warnings come from the security-collection " - "SQL Agent job and are stored in the inventory DB.", - )) - - # Login Email Mapping → inventory - ps.append(legacy_link_panel( - "Login Email Mapping", - grid=(0, 66, 24, 8), - sql_dashboard=_LEGACY_UID, - note="dbo.login_email_mapping is an inventory-only lookup table.", - )) - - # Config Changes → inventory/lama - ps.append(legacy_link_panel( - "Config Changes", - grid=(0, 74, 24, 8), - sql_dashboard=_LEGACY_UID, - note="LAMA (Look-At-My-Analysis) config-change deltas come from " - "dbo.lama_computed_metrics — not exposed to Prometheus.", - )) - - return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/disk_space.py b/sql_exporter/Prometheus-Dashboards/_specs/disk_space.py deleted file mode 100644 index 866529d..0000000 --- a/sql_exporter/Prometheus-Dashboards/_specs/disk_space.py +++ /dev/null @@ -1,156 +0,0 @@ -"""Spec for ``Disk Space`` Prometheus port (UID: prom_disk_space). - -SQL source dashboard has 5 data panels: - - 1. Table Disk Space - [$server] - [$perfmon_host_name] - → latest free/used/capacity per volume. - 2. Timeseries Used Disk Space - [$server] - → GB used per volume over time. - 3. Timeseries % Used Disk Space - [$server] - → percent used per volume over time. - 4. Table Db File Space Usage - [$server] - [$host_name] - → per database file: size, used, free (all MB). - 5. Timeseries Db File Size - Trend - [$server] - [$host_name] - → per database file size over time. - -Metric sources: - windows_logical_disk_{size,free}_bytes (1, 2, 3) - mssql_virtualfilestats__disk_{capacity,free,used}_mb (fallback for 1-3 - when windows_exporter is - unavailable on the host) - mssql_virtualfilestats__size_on_disk_bytes (4, 5) - mssql_database_file_size_bytes (4 - reported size) -""" -from prom_dashboard import Panel, Target, query_var - - -UID = "prom_disk_space" -TITLE = "Disk Space" -TAGS = ["mssql", "sqlmonitor", "Disk Space", "prometheus"] - - -def variables(): - return [ - query_var("Server", "label_values(mssql_up, instance)", - label="SQL Instance"), - query_var("perfmon_host_name", - 'label_values(mssql_service_info{instance="$Server"}, host_name)', - label="Perfmon Host Name", hide=2), - ] - - -def panels(): - ps: list[Panel] = [] - I = '{instance="$Server"}' - WI = '{instance="$Server"}' - - # 1. Latest Disk Space table (volume, capacity, free, used, % used) - ps.append(Panel( - title="Disk Space - [$Server] - [$perfmon_host_name]", - description=("Current capacity / free / used / % used per volume " - "from windows_exporter. Uses logical_disk metrics."), - type="table", unit="bytes", - grid=(0, 0, 24, 10), - targets=[ - Target(f"windows_logical_disk_size_bytes{WI}", - legend="{{volume}}", ref="Size", instant=True, format="table"), - Target(f"windows_logical_disk_free_bytes{WI}", - legend="{{volume}}", ref="Free", instant=True, format="table"), - Target( - f"windows_logical_disk_size_bytes{WI} " - f"- windows_logical_disk_free_bytes{WI}", - legend="{{volume}}", ref="Used", instant=True, format="table"), - Target( - f"100 * (windows_logical_disk_size_bytes{WI} " - f"- windows_logical_disk_free_bytes{WI}) " - f"/ clamp_min(windows_logical_disk_size_bytes{WI}, 1)", - legend="{{volume}}", ref="PctUsed", instant=True, format="table"), - ], - transformations=[ - {"id": "merge", "options": {}}, - {"id": "organize", "options": { - "excludeByName": {"Time": True, "__name__": True, - "job": True, "target": True}, - "renameByName": { - "volume": "Volume", - "instance": "Host", - "Value #Size": "Size (bytes)", - "Value #Free": "Free (bytes)", - "Value #Used": "Used (bytes)", - "Value #PctUsed": "% Used", - }, - }}, - ], - )) - - # 2. Used Disk Space over time (per volume) - ps.append(Panel( - title="Used Disk Space - [$Server] - [$perfmon_host_name]", - description="Used bytes per logical volume over time.", - type="timeseries", unit="bytes", - grid=(0, 10, 24, 12), - targets=[Target( - f"windows_logical_disk_size_bytes{WI} " - f"- windows_logical_disk_free_bytes{WI}", - legend="{{volume}}", ref="A")], - )) - - # 3. % Used Disk Space over time (per volume) - ps.append(Panel( - title="% Used Disk Space - [$Server] - [$perfmon_host_name]", - description="Percent used per logical volume over time.", - type="timeseries", unit="percent", - grid=(0, 22, 24, 12), - min_value=0, max_value=100, - targets=[Target( - f"100 * (windows_logical_disk_size_bytes{WI} " - f"- windows_logical_disk_free_bytes{WI}) " - f"/ clamp_min(windows_logical_disk_size_bytes{WI}, 1)", - legend="{{volume}}", ref="A")], - )) - - # 4. Db File Space Usage (per file: size, used, free MB) - ps.append(Panel( - title="Db File Space Usage - [$Server] - [$perfmon_host_name]", - description=("Per database file: allocated size, size on disk, " - "and computed free space. From " - "mssql_virtualfilestats__* and mssql_database_file_size_bytes."), - type="table", unit="bytes", - grid=(0, 34, 24, 16), - targets=[ - Target(f"mssql_database_file_size_bytes{I}", - legend="{{database}}/{{file_id}}", ref="Size", instant=True, - format="table"), - Target(f"mssql_virtualfilestats__size_on_disk_bytes{I}", - legend="{{database_name}}/{{file_logical_name}}", ref="OnDisk", - instant=True, format="table"), - ], - transformations=[ - {"id": "merge", "options": {}}, - {"id": "organize", "options": { - "excludeByName": {"Time": True, "__name__": True, - "job": True, "target": True}, - "renameByName": { - "database_name": "Database", - "file_logical_name": "Logical Name", - "file_location": "Physical Name", - "disk_volume": "Volume", - "Value #Size": "Allocated (bytes)", - "Value #OnDisk": "Size on Disk (bytes)", - }, - }}, - ], - )) - - # 5. Db File Size Trend (per file, over time) - ps.append(Panel( - title="Db File Size - Trend - [$Server] - [$perfmon_host_name]", - description="Per database file size_on_disk over time.", - type="timeseries", unit="bytes", - grid=(0, 50, 24, 16), - targets=[Target( - f"mssql_virtualfilestats__size_on_disk_bytes{I}", - legend="{{database_name}} / {{file_logical_name}}", ref="A")], - )) - - return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/monitoring_live_all_servers.py b/sql_exporter/Prometheus-Dashboards/_specs/monitoring_live_all_servers.py deleted file mode 100644 index 93e987f..0000000 --- a/sql_exporter/Prometheus-Dashboards/_specs/monitoring_live_all_servers.py +++ /dev/null @@ -1,291 +0,0 @@ -"""Spec for ``Monitoring - Live - All Servers`` Prometheus port -(UID: prom_monitoring_live_all_servers). - -Source dashboard has 15 data panels covering: - - Basic Info, Collection Latency, OFFLINE instances/aliases, - SQLAgent service OFFLINE, Backup issues (non-AG + AG), - SQLMonitor Jobs attention list, Disk Utilization, - AlwaysOn Latency, Log/Tempdb space issues, - Alert History (aggregated + detail) and a Health Metrics table. - -Most of these aggregate across the whole fleet via the SQLMonitor -central DB. Panels that can be reconstructed from per-instance -Prometheus series use real PromQL; the inventory-join panels -(alert-history, alias/linked-server mapping) link back to the SQL -dashboard instead. -""" -from prom_dashboard import ( - Panel, Target, query_var, constant_var, legacy_link_panel, -) - - -UID = "prom_monitoring_live_all_servers" -TITLE = "Monitoring - Live - All Servers" -TAGS = ["mssql", "sqlmonitor", "Live", "All Servers", "prometheus"] -_LEGACY_UID = "monitoring-live-all-servers" - - -def variables(): - return [ - query_var("Server", "label_values(mssql_up, instance)", - label="SQL Instance", multi=True, include_all=True), - constant_var("full_threshold_days", "7"), - constant_var("diff_threshold_hours", "24"), - constant_var("tlog_threshold_minutes", "30"), - constant_var("disk_warning_pct", "80"), - constant_var("disk_critical_pct", "90"), - ] - - -def panels(): - ps: list[Panel] = [] - S = '{instance=~"$Server"}' - - # Summary stats row - ps.append(Panel( - title="Basic Info - Online", - description="Instances with mssql_up==1 matching the filter.", - type="stat", unit="short", - grid=(0, 0, 4, 4), - targets=[Target(f'sum(mssql_up{S} == 1)', legend="", ref="A", - instant=True)], - )) - ps.append(Panel( - title="OFFLINE Instances", - description="mssql_up==0.", - type="stat", unit="short", - grid=(4, 0, 4, 4), - thresholds_steps=[{"color": "green", "value": None}, - {"color": "red", "value": 1}], - targets=[Target(f'sum(mssql_up{S} == 0)', legend="", ref="A", - instant=True)], - )) - ps.append(Panel( - title="Disks - CRITICAL", - description=("Logical disks with >$disk_critical_pct% used, via " - "windows_logical_disk metrics."), - type="stat", unit="short", - grid=(8, 0, 4, 4), - thresholds_steps=[{"color": "green", "value": None}, - {"color": "red", "value": 1}], - targets=[Target( - f'count(100 * (1 - windows_logical_disk_free_bytes{S} ' - f'/ clamp_min(windows_logical_disk_size_bytes{S}, 1)) ' - f'> $disk_critical_pct)', - legend="", ref="A", instant=True)], - )) - ps.append(Panel( - title="Disks - WARNING", - description="Logical disks between warning and critical thresholds.", - type="stat", unit="short", - grid=(12, 0, 4, 4), - thresholds_steps=[{"color": "green", "value": None}, - {"color": "orange", "value": 1}], - targets=[Target( - f'count(100 * (1 - windows_logical_disk_free_bytes{S} ' - f'/ clamp_min(windows_logical_disk_size_bytes{S}, 1)) ' - f'> $disk_warning_pct < $disk_critical_pct)', - legend="", ref="A", instant=True)], - )) - ps.append(Panel( - title="Failed Jobs", - description="Jobs whose most recent completed run failed " - "(requires the mssql_sqlagent_jobs collector).", - type="stat", unit="short", - grid=(16, 0, 4, 4), - thresholds_steps=[{"color": "green", "value": None}, - {"color": "red", "value": 1}], - targets=[Target( - f'count(mssql_sqlagent_job__last_run_outcome{S} == 0)', - legend="", ref="A", instant=True)], - )) - ps.append(Panel( - title="Full Backups Overdue", - description="Databases with a Full backup older than " - "$full_threshold_days days.", - type="stat", unit="short", - grid=(20, 0, 4, 4), - thresholds_steps=[{"color": "green", "value": None}, - {"color": "red", "value": 1}], - targets=[Target( - f'count(mssql_backup__age_seconds{{instance=~"$Server",' - f'backup_type="D"}} > ($full_threshold_days * 86400))', - legend="", ref="A", instant=True)], - )) - - # Basic Details table - ps.append(Panel( - title="All Servers - Basic Details", - description="Per-instance mssql_service_info joined with mssql_up.", - type="table", unit="short", - grid=(0, 4, 24, 8), - targets=[ - Target(f'mssql_service_info{S}', legend="", ref="Info", - instant=True, format="table"), - Target(f'mssql_up{S}', legend="", ref="Up", - instant=True, format="table"), - ], - transformations=[{"id": "merge", "options": {}}], - )) - - # Servers with Data Collection Issues - ps.append(Panel( - title="Servers with Data Collection Issues", - description=("Instances whose last successful scrape is more " - "than 5 minutes old, based on scrape_samples_scraped " - "and the `up` metric."), - type="table", unit="short", - grid=(0, 12, 24, 8), - targets=[Target( - f'(time() - timestamp(up{S} == 1)) > 300', - legend="", ref="A", instant=True, format="table")], - )) - - # OFFLINE detail tables - ps.append(Panel( - title="CRITICAL - OFFLINE Instances", - description="Instances currently reporting mssql_up==0.", - type="table", unit="short", - grid=(0, 20, 12, 6), - targets=[Target(f'mssql_up{S} == 0', legend="", ref="A", - instant=True, format="table")], - )) - ps.append(legacy_link_panel( - "CRITICAL - OFFLINE Aliases", - grid=(12, 20, 12, 6), - sql_dashboard=_LEGACY_UID, - note="Alias-instance topology is stored in the inventory DB " - "(dbo.sql_instances.alias) — Prometheus labels only carry " - "the primary endpoint.", - )) - - # SQLAgent service offline (requires windows_exporter service probe) - ps.append(Panel( - title="SQLAgent Service OFFLINE", - description=("Instances where the SQL Agent Windows service is " - "not running (windows_service_state{name=~\"SQLSERVERAGENT.*\",state!=\"running\"})."), - type="table", unit="short", - grid=(0, 26, 24, 6), - targets=[Target( - 'windows_service_state{name=~"SQLSERVERAGENT.*",state!="running"} == 1', - legend="", ref="A", instant=True, format="table")], - )) - - # Backup issues - ps.append(Panel( - title="Backups - Non-AG Databases - Issues", - description=("Databases whose most recent Full/Diff/Log backup is " - "older than the configured thresholds. Driven by " - "mssql_backup__age_seconds."), - type="table", unit="short", - grid=(0, 32, 24, 8), - targets=[ - Target( - f'mssql_backup__age_seconds{{instance=~"$Server",' - f'backup_type="D"}} > ($full_threshold_days * 86400)', - legend="", ref="Full", instant=True, format="table"), - Target( - f'mssql_backup__age_seconds{{instance=~"$Server",' - f'backup_type="L"}} > ($tlog_threshold_minutes * 60)', - legend="", ref="Log", instant=True, format="table"), - ], - transformations=[{"id": "merge", "options": {}}], - )) - ps.append(legacy_link_panel( - "Backups - AG Databases - Issues", - grid=(0, 40, 24, 8), - sql_dashboard=_LEGACY_UID, - note="Distinguishing AG vs non-AG databases requires the " - "inventory DB. Use the SQL dashboard for the AG-split view.", - )) - - # SQLMonitor Jobs attention - ps.append(Panel( - title="SQLMonitor Jobs - Require Attention", - description=("SQL Agent jobs whose latest run did not succeed, or " - "whose next run is more than 12h overdue."), - type="table", unit="short", - grid=(0, 48, 24, 8), - targets=[Target( - f'mssql_sqlagent_job__last_run_outcome{S} != 1', - legend="", ref="A", instant=True, format="table")], - )) - - # Disk Space all servers - ps.append(Panel( - title="Disk Space - All Servers", - description="Per-volume % used across all selected instances.", - type="table", unit="percent", - grid=(0, 56, 24, 10), - targets=[Target( - f'100 * (1 - windows_logical_disk_free_bytes{S} ' - f'/ clamp_min(windows_logical_disk_size_bytes{S}, 1))', - legend="", ref="A", instant=True, format="table")], - )) - - # AlwaysOn Latency - ps.append(Panel( - title="All Servers - AlwaysOn Latency", - description=("Per-(replica, database) commit latency seconds " - "from mssql_aghealth__latency_seconds."), - type="table", unit="s", - grid=(0, 66, 24, 8), - targets=[Target( - f'mssql_aghealth__latency_seconds{S}', - legend="", ref="A", instant=True, format="table")], - )) - - # Log Space Consumers — legacy (requires Inventory + tempdb_log collector) - ps.append(legacy_link_panel( - "Log Space Consumers", - grid=(0, 74, 24, 8), - sql_dashboard=_LEGACY_UID, - note="log_space_consumers collector not yet ported to " - "Prometheus. Relies on dbo.log_space_consumers cache table.", - )) - ps.append(legacy_link_panel( - "TempDb Usage", - grid=(0, 82, 24, 8), - sql_dashboard=_LEGACY_UID, - note="tempdb_space_usage collector not yet ported.", - )) - - # Alert History - ps.append(legacy_link_panel( - "Alerts - Aggregated by Type", - grid=(0, 90, 12, 10), - sql_dashboard=_LEGACY_UID, - note="Alert history rows live in dbo.alert_history — accessible " - "only from the SQLMonitor inventory DB.", - )) - ps.append(legacy_link_panel( - "All Servers - Alert History", - grid=(12, 90, 12, 10), - sql_dashboard=_LEGACY_UID, - note="Same source as above (dbo.alert_history).", - )) - - # Health Metrics (last panel) - ps.append(Panel( - title="Servers Need Help - Health Metrics", - description=("Servers where any of the core health gauges is " - "outside the expected range: PLE < 300, or memory " - "grants pending > 0, or blocking > 0."), - type="table", unit="short", - grid=(0, 100, 24, 12), - targets=[ - Target( - f'mssql_perfmon__page_life_expectancy_seconds{S} < 300', - legend="", ref="PLE", instant=True, format="table"), - Target( - f'mssql_perfmon__memory_grants_pending{S} > 0', - legend="", ref="Grants", instant=True, format="table"), - Target( - f'mssql_perfmon__processes_blocked{S} > 0', - legend="", ref="Blocked", instant=True, format="table"), - ], - transformations=[{"id": "merge", "options": {}}], - )) - - return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/monitoring_live_distributed.py b/sql_exporter/Prometheus-Dashboards/_specs/monitoring_live_distributed.py deleted file mode 100644 index 3198909..0000000 --- a/sql_exporter/Prometheus-Dashboards/_specs/monitoring_live_distributed.py +++ /dev/null @@ -1,475 +0,0 @@ -"""Spec for ``Monitoring - Live - Distributed`` Prometheus port -(UID: prom_monitoring_live_distributed). - -Source dashboard has 60 data panels across 22 rows covering OS, SQL -instance and AlwaysOn state for a *single* server selected via -``$Server``. The layout mirrors the original dashboard row-for-row; -panels map to: - - OS / Host metrics → windows_exporter + mssql_service_info - SQL Server state → mssql_standard + mssql_dba_cached - WhoIsActive / blocking → mssql_whoisactive__* (mssql_dba_whoisactive) - AlwaysOn → mssql_aghealth__* - Disk / Wait stats → windows_logical_disk_* / mssql_waits__* - Perfmon trends → mssql_perfmon__* - -Panels that depend on the SQLMonitor cache tables (Server/Database -config change history, sqlagent job activity detail with duration -history, tempdb_space / log_space consumers, Lead Blockers rolled-up -tables) use ``legacy_link_panel`` so they remain visible without -pretending that inventory data has been ported to Prometheus. -""" -from prom_dashboard import ( - Panel, Target, query_var, constant_var, legacy_link_panel, row, -) - - -UID = "prom_monitoring_live_distributed" -TITLE = "Monitoring - Live - Distributed" -TAGS = ["mssql", "sqlmonitor", "Live", "Distributed", "prometheus"] -_LEGACY_UID = "monitoring-live-distributed" - - -def variables(): - return [ - query_var("Server", "label_values(mssql_up, instance)", - label="SQL Instance"), - constant_var("blocked_threshold_seconds", "30"), - constant_var("memory_grant_threshold_mb", "100"), - ] - - -def _stat(title, expr, grid, unit="short", decimals=0, - description="", thresholds=None): - return Panel( - title=title, type="stat", unit=unit, decimals=decimals, - description=description, grid=grid, - thresholds_steps=thresholds, - targets=[Target(expr, legend="", ref="A", instant=True)], - ) - - -def panels(): - ps: list[Panel] = [] - S = '{instance="$Server"}' - - # ==== Row 1: OS Info stat tiles ==== - ps.append(_stat("Memory Model", - f'mssql_service_info{S}', (0, 0, 2, 2), - description="Memory model reported by mssql_service_info.")) - ps.append(_stat("Memory Status", - f'windows_memory_available_bytes{S} > 0', (2, 0, 2, 2), - description="1 when OS reports available memory.")) - ps.append(_stat("OS Uptime", - f'windows_system_system_up_time{S}', - (4, 0, 3, 2), unit="s", - description="Seconds since OS boot (windows_exporter).")) - ps.append(_stat("OS Processes", - f'windows_system_processes{S}', (7, 0, 4, 2))) - ps.append(_stat("OS CPU %", - f'100 - (avg without(cpu,mode) ' - f'(rate(windows_cpu_time_total{{instance="$Server",' - f'mode="idle"}}[$__rate_interval])) * 100)', - (11, 0, 3, 3), unit="percent", decimals=1)) - ps.append(_stat("Idle CPU %", - f'avg without(cpu,mode) ' - f'(rate(windows_cpu_time_total{{instance="$Server",' - f'mode="idle"}}[$__rate_interval])) * 100', - (14, 0, 3, 3), unit="percent", decimals=1)) - ps.append(_stat("PLE", - f'mssql_perfmon__page_life_expectancy_seconds{S}', - (17, 0, 2, 3), unit="s", - thresholds=[{"color": "red", "value": None}, - {"color": "green", "value": 300}])) - ps.append(Panel( - title="AG Details", - description="Replica/DB sync state from mssql_aghealth__*.", - type="table", unit="short", - grid=(19, 0, 5, 5), - targets=[Target( - f'mssql_aghealth__synchronization_health{S}', - legend="", ref="A", instant=True, format="table")], - )) - ps.append(_stat("Box Memory", - f'windows_cs_physical_memory_bytes{S}', - (0, 3, 2, 3), unit="bytes")) - ps.append(_stat("Available Memory", - f'windows_memory_available_bytes{S}', - (2, 3, 2, 3), unit="bytes")) - ps.append(_stat("CPU (OS/SQL)", - f'mssql_sqlserver_cpu_count{S}', - (8, 3, 3, 3))) - ps.append(_stat("Processor", - f'windows_cs_logical_processors{S}', - (11, 4, 5, 2))) - ps.append(_stat("Machine Type", - f'windows_cs_hypervisor{S}', - (16, 4, 3, 2), - description="1 if hypervisor detected (VM).")) - - # ==== Row 2: Live Metrics ==== - ps.append(row("LIVE Metrics - [$Server]", y=6)) - ps.append(_stat( - "Blocked > $blocked_threshold_seconds s", - f'sum(mssql_whoisactive__avg_elapsed_time{{instance="$Server",' - f'blocked_session_count!="0"}} > $blocked_threshold_seconds) or ' - f'vector(0)', - (0, 7, 3, 3), - thresholds=[{"color": "green", "value": None}, - {"color": "red", "value": 1}])) - ps.append(_stat("SQL Used Memory", - f'mssql_perfmon__total_server_memory_bytes{S}', - (3, 7, 2, 3), unit="bytes")) - ps.append(_stat("Allocated M/r %", - f'100 * mssql_perfmon__total_server_memory_bytes{S} ' - f'/ clamp_min(mssql_perfmon__target_server_memory_bytes{S}, 1)', - (5, 7, 2, 3), unit="percent", decimals=1)) - ps.append(_stat("Connections", - f'mssql_perfmon__user_connections{S}', - (7, 7, 2, 3))) - ps.append(_stat("Active Requests", - f'mssql_sqlserver_active_requests{S}', - (9, 7, 2, 3))) - ps.append(_stat("SQL CPU %", - f'mssql_cpu_utilization__sql_cpu_utilization{S}', - (11, 7, 3, 3), unit="percent", decimals=1)) - ps.append(_stat("IsHadrEnabled", - f'mssql_sqlserver_is_hadr_enabled{S}', - (14, 7, 2, 3))) - ps.append(_stat("IsClustered", - f'mssql_sqlserver_is_clustered{S}', - (16, 7, 2, 3))) - ps.append(_stat("SQL Version", - f'mssql_service_info{S}', (18, 7, 6, 3), - description="Value is 1; label `product_version` holds the version string.")) - - ps.append(_stat("Longest Blocking (s)", - f'max(mssql_whoisactive__avg_elapsed_time{S}) or vector(0)', - (0, 10, 3, 3), unit="s")) - ps.append(_stat("Memory Grants Pending", - f'mssql_perfmon__memory_grants_pending{S}', - (3, 10, 3, 3), - thresholds=[{"color": "green", "value": None}, - {"color": "red", "value": 1}])) - ps.append(_stat("Page Faults/sec", - f'rate(windows_memory_page_faults_total{S}[$__rate_interval])', - (6, 10, 3, 3))) - ps.append(_stat("% User Mode", - f'avg without(cpu) (rate(windows_cpu_time_total' - f'{{instance="$Server",mode="user"}}[$__rate_interval])) * 100', - (9, 10, 3, 3), unit="percent", decimals=1)) - ps.append(_stat("Disk Latency (avg ms)", - f'avg(rate(windows_logical_disk_read_seconds_total{S}[$__rate_interval]) ' - f'/ clamp_min(rate(windows_logical_disk_reads_total{S}[$__rate_interval]), 1) ' - f'* 1000)', - (12, 10, 3, 3), unit="ms", decimals=1)) - ps.append(_stat("Waits / Core / Minute", - f'60 * sum(rate(mssql_waits__wait_time_seconds{S}[$__rate_interval])) ' - f'/ clamp_min(mssql_sqlserver_cpu_count{S}, 1)', - (15, 10, 3, 3), unit="short", decimals=1)) - ps.append(_stat("SQL Uptime", - f'mssql_sqlserver_uptime_seconds{S}', - (18, 10, 3, 3), unit="s")) - ps.append(_stat("SQL Start Time UTC", - f'time() - mssql_sqlserver_uptime_seconds{S}', - (21, 10, 3, 3), unit="dateTimeAsIso")) - - # Patch details - ps.append(legacy_link_panel( - "SQL Server Patching Details", - grid=(0, 13, 24, 4), - sql_dashboard=_LEGACY_UID, - note="CU/KB/patch history is stored in the inventory DB " - "(dbo.sql_server_patching) — not a Prometheus metric.")) - - # ==== AlwaysOn AG Status ==== - ps.append(row("AlwaysOn Availability Groups - Status", y=17)) - ps.append(Panel( - title="AlwaysOn Availability Group Health Metrics", - description="Per-(replica, database) AG health: state / queues / " - "rates / latency, from mssql_aghealth__*.", - type="table", unit="short", grid=(0, 18, 24, 9), - targets=[ - Target(f'mssql_aghealth__synchronization_health{S}', - legend="", ref="Health", instant=True, format="table"), - Target(f'mssql_aghealth__latency_seconds{S}', - legend="", ref="Lat", instant=True, format="table"), - Target(f'mssql_aghealth__log_send_queue_size{S}', - legend="", ref="LSQ", instant=True, format="table"), - Target(f'mssql_aghealth__redo_queue_size{S}', - legend="", ref="RQ", instant=True, format="table"), - ], - transformations=[{"id": "merge", "options": {}}], - )) - - # ==== CPU Trend ==== - ps.append(row("Trend - CPU Utilization", y=27)) - ps.append(Panel( - title="CPU %", type="timeseries", unit="percent", - description="SQL vs OS CPU from ring-buffer metrics.", - grid=(0, 28, 24, 8), - targets=[ - Target(f'mssql_cpu_utilization__sql_cpu_utilization{S}', - legend="SQL CPU", ref="Sql"), - Target(f'mssql_cpu_utilization__system_idle_process{S}', - legend="Idle", ref="Idle"), - Target(f'100 - mssql_cpu_utilization__system_idle_process{S}', - legend="OS CPU", ref="Os"), - ], - min_value=0, max_value=100, - )) - ps.append(Panel( - title="OS Processes CPU Utilization", type="timeseries", - description="Per-process CPU from windows_exporter.", - unit="percent", grid=(0, 36, 24, 8), - targets=[Target( - f'topk(10, rate(windows_process_cpu_time_total{S}[$__rate_interval]) * 100)', - legend="{{process}}", ref="A")], - )) - - # ==== Memory Trend ==== - ps.append(row("Trend - Memory Utilization", y=44)) - ps.append(Panel( - title="SQL Server Process Memory", type="timeseries", unit="bytes", - description="mssql_perfmon__total_server_memory_bytes and " - "target_server_memory_bytes.", - grid=(0, 45, 24, 10), - targets=[ - Target(f'mssql_perfmon__total_server_memory_bytes{S}', - legend="Total Server Memory", ref="Total"), - Target(f'mssql_perfmon__target_server_memory_bytes{S}', - legend="Target Server Memory", ref="Target"), - ], - )) - ps.append(Panel( - title="OS Processes Memory Utilization", type="timeseries", - unit="bytes", - description="Top 10 processes by working-set memory.", - grid=(0, 55, 24, 10), - targets=[Target( - f'topk(10, windows_process_working_set_bytes{S})', - legend="{{process}}", ref="A")], - )) - - # ==== Config Changes (legacy) ==== - ps.append(row("Server & Database Config Changes", y=65)) - ps.append(legacy_link_panel( - "Server Configuration Changes", grid=(0, 66, 24, 8), - sql_dashboard=_LEGACY_UID, - note="dbo.server_config_history (LAMA) is inventory-only.")) - ps.append(legacy_link_panel( - "Database Configuration Changes", grid=(0, 74, 24, 8), - sql_dashboard=_LEGACY_UID, - note="dbo.database_config_history is inventory-only.")) - - # ==== Blocking Tree (WhoIsActive) ==== - ps.append(row("Blocking Tree - ACTIVE", y=82)) - ps.append(Panel( - title="Blocking Details - ACTIVE - [sp_WhoIsActive]", - description="Live blocking info from mssql_whoisactive.", - type="table", unit="short", grid=(0, 83, 24, 8), - targets=[Target( - f'mssql_whoisactive__start_time{{instance="$Server",' - f'blocked_session_count!="0"}}', - legend="", ref="A", instant=True, format="table")], - )) - - # ==== Lead Blockers ==== - ps.append(row("Lead Blockers", y=91)) - ps.append(Panel( - title="Lead Blockers - Logins - Blocked Count", - description="Count of blocked sessions grouped by login_name " - "from mssql_whoisactive.", - type="timeseries", unit="short", grid=(0, 92, 24, 11), - targets=[Target( - f'count by (login_name) (' - f'mssql_whoisactive__blocking_session_id{{instance="$Server",' - f'blocked_session_count!="0"}})', - legend="{{login_name}}", ref="A")], - )) - ps.append(Panel( - title="Lead Blockers - Programs - Blocked Count", - description="Blocked sessions grouped by program_name.", - type="timeseries", unit="short", grid=(0, 103, 24, 11), - targets=[Target( - f'count by (program_name) (' - f'mssql_whoisactive__blocking_session_id{{instance="$Server",' - f'blocked_session_count!="0"}})', - legend="{{program_name}}", ref="A")], - )) - - # ==== Memory Grants Pending ==== - ps.append(row("Trend - Memory Grants Pending", y=114)) - ps.append(Panel( - title="Memory Grants Pending", type="timeseries", unit="short", - description="mssql_perfmon__memory_grants_pending — anything >0 " - "indicates grant pressure.", - grid=(0, 115, 24, 7), - targets=[Target(f'mssql_perfmon__memory_grants_pending{S}', - legend="pending grants", ref="A")], - )) - - # ==== Memory Consumers ==== - ps.append(row("Memory Consumers - ACTIVE", y=122)) - ps.append(Panel( - title="Memory Consumers Over $memory_grant_threshold_mb MB", - description="Sessions holding memory grants above the threshold.", - type="table", unit="short", grid=(0, 123, 24, 11), - targets=[Target( - f'mssql_whoisactive__memory_info{{instance="$Server"}}', - legend="", ref="A", instant=True, format="table")], - )) - - # ==== TempdbSaver / LogSaver (legacy) ==== - ps.append(row("TempdbSaver - Latest", y=134)) - ps.append(legacy_link_panel( - "TempdbSaver - tempdb_space_usage", grid=(0, 135, 12, 4), - sql_dashboard=_LEGACY_UID, - note="tempdb_space_usage collector is not yet ported.")) - ps.append(legacy_link_panel( - "TempdbSaver - tempdb_space_consumers", grid=(12, 135, 12, 4), - sql_dashboard=_LEGACY_UID, - note="tempdb_space_consumers collector is not yet ported.")) - ps.append(row("LogSaver - Latest", y=139)) - ps.append(legacy_link_panel( - "LogSaver - log_space_consumers", grid=(0, 140, 24, 8), - sql_dashboard=_LEGACY_UID, - note="log_space_consumers collector is not yet ported.")) - - # ==== Connections / Winsock Rejections ==== - ps.append(row("SQL Connections & Winsock Rejections", y=148)) - ps.append(Panel( - title="microsoft winsock bsp -> rejected connections/sec", - type="timeseries", unit="short", - description="Winsock BSP rejected connections; counter delta.", - grid=(0, 149, 24, 8), - targets=[Target( - f'rate(windows_net_packets_outbound_errors_total{S}[$__rate_interval])', - legend="{{nic}}", ref="A")], - )) - - # ==== Long Running Queries ==== - ps.append(row("Long Running Queries", y=157)) - ps.append(Panel( - title="WhoIsActive Data", type="table", unit="short", - description="Current sp_WhoIsActive snapshot from mssql_whoisactive.", - grid=(0, 158, 24, 9), - targets=[Target( - f'mssql_whoisactive__start_time{{instance="$Server"}}', - legend="", ref="A", instant=True, format="table")], - )) - - # ==== Page Life Expectancy ==== - ps.append(row("Trend - Page Life Expectancy", y=167)) - ps.append(Panel( - title="Page Life Expectancy", type="timeseries", unit="s", - grid=(0, 168, 24, 10), - targets=[Target( - f'mssql_perfmon__page_life_expectancy_seconds{S}', - legend="PLE (s)", ref="A")], - )) - - # ==== Batch Request/sec ==== - ps.append(row("Trend - Batch Request/Sec", y=178)) - ps.append(Panel( - title="Batch Requests Per Second", type="timeseries", unit="short", - grid=(0, 179, 24, 7), - targets=[Target( - f'rate(mssql_perfmon__batch_requests_total{S}[$__rate_interval])', - legend="batch req/s", ref="A")], - )) - - # ==== Connection Distribution ==== - ps.append(row("SQL Connections - Distribution", y=186)) - ps.append(Panel( - title="Connections by Interface", type="table", unit="short", - description="Connections grouped by net_transport / auth_scheme.", - grid=(0, 187, 8, 6), - targets=[Target( - f'count by (net_transport) (' - f'mssql_whoisactive__start_time{{instance="$Server"}})', - legend="", ref="A", instant=True, format="table")], - )) - ps.append(Panel( - title="Host Connections", type="table", unit="short", - grid=(8, 187, 8, 12), - targets=[Target( - f'count by (host_name) (' - f'mssql_whoisactive__start_time{{instance="$Server"}})', - legend="", ref="A", instant=True, format="table")], - )) - ps.append(Panel( - title="Login Connections", type="table", unit="short", - grid=(16, 187, 8, 12), - targets=[Target( - f'count by (login_name) (' - f'mssql_whoisactive__start_time{{instance="$Server"}})', - legend="", ref="A", instant=True, format="table")], - )) - ps.append(Panel( - title="Connections By Status", type="table", unit="short", - grid=(0, 193, 8, 6), - targets=[Target( - f'count by (status) (' - f'mssql_whoisactive__start_time{{instance="$Server"}})', - legend="", ref="A", instant=True, format="table")], - )) - - # ==== Running Jobs / WhoIsActive latest ==== - ps.append(row("Running Jobs & Maintenance Workloads", y=199)) - ps.append(Panel( - title="WhoIsActive Latest Captured Data", type="table", unit="short", - grid=(0, 200, 24, 8), - targets=[Target( - f'mssql_whoisactive__start_time{{instance="$Server"}}', - legend="", ref="A", instant=True, format="table")], - )) - - # ==== SQL Agent Job Activity ==== - ps.append(row("SQLAgent Job Activity Monitor - [$Server]", y=208)) - ps.append(Panel( - title="Job Activity Monitor", - description="SQL Agent jobs for this instance — outcome / duration " - "/ running state from mssql_sqlagent_job__*.", - type="table", unit="short", grid=(0, 209, 24, 16), - targets=[ - Target(f'mssql_sqlagent_job__enabled{S}', legend="", - ref="En", instant=True, format="table"), - Target(f'mssql_sqlagent_job__last_run_outcome{S}', legend="", - ref="Out", instant=True, format="table"), - Target(f'mssql_sqlagent_job__last_run_duration_seconds{S}', - legend="", ref="Dur", instant=True, format="table"), - Target(f'mssql_sqlagent_job__is_running{S}', legend="", - ref="Run", instant=True, format="table"), - ], - transformations=[{"id": "merge", "options": {}}], - )) - - # ==== Disk Space ==== - ps.append(row("Disk Space - [$Server]", y=225)) - ps.append(Panel( - title="Disk Space Utilization", type="table", unit="bytes", - description="Per-volume size / free / used from windows_exporter.", - grid=(0, 226, 24, 16), - targets=[ - Target(f'windows_logical_disk_size_bytes{S}', legend="", - ref="Size", instant=True, format="table"), - Target(f'windows_logical_disk_free_bytes{S}', legend="", - ref="Free", instant=True, format="table"), - ], - transformations=[{"id": "merge", "options": {}}], - )) - - # ==== WaitStats ==== - ps.append(row("WaitStats", y=242)) - ps.append(Panel( - title="[${Server}] - WaitStats", type="timeseries", unit="s", - description="rate(mssql_waits__wait_time_seconds) per wait_type.", - grid=(0, 243, 24, 15), - targets=[Target( - f'topk(20, sum by (wait_type) (' - f'rate(mssql_waits__wait_time_seconds{S}[$__rate_interval])))', - legend="{{wait_type}}", ref="A")], - )) - - return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/monitoring_perfmon_quest.py b/sql_exporter/Prometheus-Dashboards/_specs/monitoring_perfmon_quest.py deleted file mode 100644 index 78fb6f9..0000000 --- a/sql_exporter/Prometheus-Dashboards/_specs/monitoring_perfmon_quest.py +++ /dev/null @@ -1,421 +0,0 @@ -"""Spec for ``Monitoring - Perfmon Counters - Quest Softwares - Distributed`` -Prometheus port (UID: prom_monitoring_perfmon_quest). - -The source dashboard is a 53-timeseries perfmon catalogue for a single -server. Every panel maps to either ``mssql_perfmon__*`` (from -mssql_standard / mssql_dba_cached) or ``windows_*`` (from -windows_exporter). Rows that rely on the SQLMonitor dbo.os_task_list -cache table or dbo.memory_clerks snapshot are rendered as -``legacy_link_panel`` so every source row is accounted for. -""" -from prom_dashboard import ( - Panel, Target, query_var, legacy_link_panel, row, -) - - -UID = "prom_monitoring_perfmon_quest" -TITLE = "Monitoring - Perfmon Counters - Quest Softwares - Distributed" -TAGS = ["mssql", "sqlmonitor", "Perfmon", "Quest", "prometheus"] -_LEGACY_UID = "monitoring-perfmon-counters-quest-softwares-distributed" - - -def variables(): - return [ - query_var("Server", "label_values(mssql_up, instance)", - label="SQL Instance"), - query_var("database", - 'label_values(mssql_perfmon__log_bytes_flushed_total{instance="$Server"}, database_name)', - label="Database", multi=True, include_all=True), - query_var("disk_drive", - 'label_values(windows_logical_disk_size_bytes{instance="$Server"}, volume)', - label="Disk", multi=True, include_all=True), - ] - - -def _ts(title, exprs_legend, grid, unit="short", description=""): - return Panel( - title=title, type="timeseries", unit=unit, - description=description, grid=grid, - targets=[Target(e, legend=l, ref=chr(65 + i)) - for i, (e, l) in enumerate(exprs_legend)], - ) - - -def panels(): - ps: list[Panel] = [] - S = '{instance="$Server"}' - Sd = '{instance="$Server",database_name=~"$database"}' - Svol = '{instance="$Server",volume=~"$disk_drive"}' - rate = "$__rate_interval" - - y = 0 - # 1. CPU & Processor - ps.append(row("CPU & Processor", y)); y += 1 - ps.append(_ts("%Processor Time (SQL Server)", - [(f'mssql_cpu_utilization__sql_cpu_utilization{S}', - 'SQL CPU'), - (f'100 - mssql_cpu_utilization__system_idle_process{S}', - 'OS CPU')], - (0, y, 24, 7), unit="percent", - description="SQL vs OS CPU %.")); y += 7 - ps.append(_ts("System: Processor Queue Length", - [(f'windows_system_processor_queue_length{S}', - 'queue length')], - (0, y, 24, 5))); y += 5 - - # 2. OS Memory & Paging - ps.append(row("OS Memory & Paging Performance Counters", y)); y += 1 - ps.append(_ts("Memory - Available Mbytes", - [(f'windows_memory_available_bytes{S} / 1024 / 1024', - 'Available MB')], - (0, y, 24, 6), unit="decmbytes")); y += 6 - ps.append(_ts("Memory - Pages Input/sec, Pages/sec", - [(f'rate(windows_memory_swap_page_operations_total{S}[{rate}])', - 'Pages/sec'), - (f'rate(windows_memory_swap_page_reads_total{S}[{rate}])', - 'Pages Input/sec')], - (0, y, 24, 11))); y += 11 - ps.append(_ts("Paging File Usage", - [(f'windows_paging_file_usage_percent{S}', 'usage %')], - (0, y, 24, 7), unit="percent")); y += 7 - - # 3. SQL Server: Memory Manager - ps.append(row("SQL Server: Memory Manager Counters", y)); y += 1 - ps.append(_ts("SQL Server Process Memory", - [(f'mssql_perfmon__total_server_memory_bytes{S}', - 'Total Server Memory'), - (f'mssql_perfmon__target_server_memory_bytes{S}', - 'Target Server Memory')], - (0, y, 24, 11), unit="bytes")); y += 11 - ps.append(_ts("SQL Server: Memory Manager", - [(f'mssql_perfmon__memory_grants_pending{S}', - 'Memory Grants Pending'), - (f'mssql_perfmon__memory_grants_outstanding{S}', - 'Memory Grants Outstanding')], - (0, y, 24, 11))); y += 11 - ps.append(_ts("Memory Grants", - [(f'mssql_perfmon__memory_grants_pending{S}', 'pending'), - (f'mssql_perfmon__memory_grants_outstanding{S}', - 'outstanding')], - (0, y, 24, 8))); y += 8 - - # 4. MSSQL Data Access - ps.append(row("MSSQL Data Access Performance Counters", y)); y += 1 - ps.append(_ts("Batch Requests/sec", - [(f'rate(mssql_perfmon__batch_requests_total{S}[{rate}])', - 'Batch Req/sec')], - (0, y, 24, 6))); y += 6 - ps.append(_ts("SQLServer:Access Methods", - [(f'rate(mssql_perfmon__page_splits_total{S}[{rate}])', - 'Page Splits/sec'), - (f'rate(mssql_perfmon__full_scans_total{S}[{rate}])', - 'Full Scans/sec'), - (f'rate(mssql_perfmon__index_searches_total{S}[{rate}])', - 'Index Searches/sec'), - (f'rate(mssql_perfmon__forwarded_records_total{S}[{rate}])', - 'Forwarded Records/sec')], - (0, y, 24, 15))); y += 15 - Svol = '{instance="$Server",volume=~"$disk_drive"}' - Sd = '{instance="$Server",database_name=~"$database"}' - _extend_disk_network(ps, S, Sd, Svol, rate, y) - return ps - - -def _extend_disk_network(ps, S, Sd, Svol, rate, y): - # 5. Logical Disk - ps.append(row("Logical Disk Counters", y)); y += 1 - ps.append(_ts("Logical Disk (Disk Queue Length)", - [(f'windows_logical_disk_avg_read_requests_queued{Svol}', - 'read queue {{volume}}'), - (f'windows_logical_disk_avg_write_requests_queued{Svol}', - 'write queue {{volume}}')], - (0, y, 24, 5))); y += 5 - ps.append(_ts("Logical Disk - Latency (ms)", - [(f'1000 * rate(windows_logical_disk_read_seconds_total{Svol}[{rate}]) ' - f'/ clamp_min(rate(windows_logical_disk_reads_total{Svol}[{rate}]), 1)', - 'read ms {{volume}}'), - (f'1000 * rate(windows_logical_disk_write_seconds_total{Svol}[{rate}]) ' - f'/ clamp_min(rate(windows_logical_disk_writes_total{Svol}[{rate}]), 1)', - 'write ms {{volume}}')], - (0, y, 24, 6), unit="ms")); y += 6 - ps.append(_ts("Logical Disk - IOPS", - [(f'rate(windows_logical_disk_reads_total{Svol}[{rate}])', - 'reads/s {{volume}}'), - (f'rate(windows_logical_disk_writes_total{Svol}[{rate}])', - 'writes/s {{volume}}')], - (0, y, 24, 8), unit="ops")); y += 8 - ps.append(_ts("Logical Disk - Throughput", - [(f'rate(windows_logical_disk_read_bytes_total{Svol}[{rate}])', - 'read B/s {{volume}}'), - (f'rate(windows_logical_disk_write_bytes_total{Svol}[{rate}])', - 'write B/s {{volume}}')], - (0, y, 24, 7), unit="Bps")); y += 7 - - # 6. Physical Disk - ps.append(row("Physical Disk Counters", y)); y += 1 - ps.append(_ts("Physical Disk (Disk Queue Length)", - [(f'windows_physical_disk_avg_read_requests_queued{S}', - 'read queue {{disk}}'), - (f'windows_physical_disk_avg_write_requests_queued{S}', - 'write queue {{disk}}')], - (0, y, 24, 5))); y += 5 - ps.append(_ts("Physical Disk - Latency (ms)", - [(f'1000 * rate(windows_physical_disk_read_seconds_total{S}[{rate}]) ' - f'/ clamp_min(rate(windows_physical_disk_reads_total{S}[{rate}]), 1)', - 'read ms {{disk}}'), - (f'1000 * rate(windows_physical_disk_write_seconds_total{S}[{rate}]) ' - f'/ clamp_min(rate(windows_physical_disk_writes_total{S}[{rate}]), 1)', - 'write ms {{disk}}')], - (0, y, 24, 6), unit="ms")); y += 6 - ps.append(_ts("Physical Disk - Throughput", - [(f'rate(windows_physical_disk_read_bytes_total{S}[{rate}])', - 'read B/s {{disk}}'), - (f'rate(windows_physical_disk_write_bytes_total{S}[{rate}])', - 'write B/s {{disk}}')], - (0, y, 24, 7), unit="Bps")); y += 7 - ps.append(_ts("Physical Disk - IOPS", - [(f'rate(windows_physical_disk_reads_total{S}[{rate}])', - 'reads/s {{disk}}'), - (f'rate(windows_physical_disk_writes_total{S}[{rate}])', - 'writes/s {{disk}}')], - (0, y, 24, 8), unit="ops")); y += 8 - - # 7. Network - ps.append(row("Network Interface Counters", y)); y += 1 - ps.append(_ts("Network Interface - Bytes Total/sec", - [(f'rate(windows_net_bytes_total{S}[{rate}])', - '{{nic}}')], - (0, y, 24, 7), unit="Bps")); y += 7 - - # 8. MSSQL Databases - Size - ps.append(row("MSSQL Databases - Size Counters", y)); y += 1 - ps.append(_ts("SQLServer:Databases - Log File Size", - [(f'mssql_perfmon__log_file_used_size_kb{Sd} * 1024', - '{{database_name}} log used (B)'), - (f'mssql_perfmon__log_file_size_kb{Sd} * 1024', - '{{database_name}} log size (B)')], - (0, y, 24, 15), unit="bytes")); y += 15 - ps.append(_ts("SQLServer:Databases - Data File Size", - [(f'mssql_perfmon__data_file_size_kb{Sd} * 1024', - '{{database_name}} data (B)')], - (0, y, 24, 12), unit="bytes")); y += 12 - - _extend_sql_statistics(ps, S, Sd, rate, y) - - -def _extend_sql_statistics(ps, S, Sd, rate, y): - # 9. User Database Performance - ps.append(row("MSSQL User Database - Performance Counters", y)); y += 1 - ps.append(_ts("SqlServer:Databases - Log Bytes Flushed/sec", - [(f'rate(mssql_perfmon__log_bytes_flushed_total{Sd}[{rate}])', - '{{database_name}}')], - (0, y, 24, 9), unit="Bps")); y += 9 - ps.append(_ts("SqlServer:Databases - Log Flush Wait Time", - [(f'rate(mssql_perfmon__log_flush_wait_time_ms_total{Sd}[{rate}])', - '{{database_name}}')], - (0, y, 24, 10), unit="ms")); y += 10 - ps.append(_ts("SqlServer:Databases - Others", - [(f'rate(mssql_perfmon__transactions_total{Sd}[{rate}])', - 'tx/s {{database_name}}'), - (f'rate(mssql_perfmon__write_transactions_total{Sd}[{rate}])', - 'write-tx/s {{database_name}}')], - (0, y, 24, 15))); y += 15 - - # 10. SQL Statistics — Auto Parameterization - ps.append(row("SQL Server - SQL Statistics - Auto Parameterization", y)) - y += 1 - ps.append(_ts("SQLServer:SQL Statistics - Auto Parameterization", - [(f'rate(mssql_perfmon__auto_param_attempts_total{S}[{rate}])', - 'auto-param attempts/s'), - (f'rate(mssql_perfmon__failed_auto_params_total{S}[{rate}])', - 'failed auto-params/s'), - (f'rate(mssql_perfmon__safe_auto_params_total{S}[{rate}])', - 'safe auto-params/s')], - (0, y, 24, 10))); y += 10 - - # 11. Buffer Manager & Memory - ps.append(row("MSSQL Buffer Manager & Memory Performance Counters", y)) - y += 1 - ps.append(_ts("Batch Requests/sec", - [(f'rate(mssql_perfmon__batch_requests_total{S}[{rate}])', - 'batch req/s')], - (0, y, 24, 6))); y += 6 - ps.append(_ts("Page Life Expectancy", - [(f'mssql_perfmon__page_life_expectancy_seconds{S}', 'PLE')], - (0, y, 24, 7), unit="s")); y += 7 - ps.append(_ts("SQLServer:Buffer Manager", - [(f'mssql_perfmon__buffer_cache_hit_ratio{S}', - 'buffer cache hit %'), - (f'rate(mssql_perfmon__page_reads_total{S}[{rate}])', - 'page reads/s'), - (f'rate(mssql_perfmon__page_writes_total{S}[{rate}])', - 'page writes/s'), - (f'rate(mssql_perfmon__lazy_writes_total{S}[{rate}])', - 'lazy writes/s')], - (0, y, 24, 17))); y += 17 - - # 12. Memory Consumers (legacy) - ps.append(row("Memory Consumers - sys.dm_os_memory_clerks", y)); y += 1 - ps.append(legacy_link_panel( - "Memory Consumers", grid=(0, y, 24, 13), - sql_dashboard=_LEGACY_UID, - note="dm_os_memory_clerks snapshot is cached in the SQLMonitor " - "memory_clerks table and is not exposed as a Prometheus metric.", - )); y += 13 - - # 13. "How is My Memory Being Used" - ps.append(row("MSSQL Memory Breakdown Counters", y)); y += 1 - ps.append(_ts("SQLServer:Memory Manager - Connection/Lock/Opt", - [(f'mssql_perfmon__connection_memory_kb{S} * 1024', - 'connection mem (B)'), - (f'mssql_perfmon__lock_memory_kb{S} * 1024', - 'lock mem (B)'), - (f'mssql_perfmon__optimizer_memory_kb{S} * 1024', - 'optimizer mem (B)')], - (0, y, 24, 9), unit="bytes")); y += 9 - ps.append(_ts("SQLServer:Memory Manager - Granted Workspace", - [(f'mssql_perfmon__granted_workspace_memory_kb{S} * 1024', - 'granted workspace (B)'), - (f'mssql_perfmon__reserved_server_memory_kb{S} * 1024', - 'reserved server mem (B)')], - (0, y, 24, 12), unit="bytes")); y += 12 - - _extend_workload(ps, S, rate, y) - - -def _extend_workload(ps, S, rate, y): - # 14. Workload - ps.append(row("MSSQL Workload Performance Counters", y)); y += 1 - ps.append(_ts("SQLServer:SQL Statistics - CPU Stuff", - [(f'rate(mssql_perfmon__sql_compilations_total{S}[{rate}])', - 'compilations/s'), - (f'rate(mssql_perfmon__sql_re_compilations_total{S}[{rate}])', - 're-compilations/s')], - (0, y, 24, 6))); y += 6 - ps.append(_ts("SQLServer:SQL Statistics - Cursors & Errors", - [(f'rate(mssql_perfmon__errors_total{S}[{rate}])', - 'errors/s')], - (0, y, 24, 8))); y += 8 - ps.append(_ts("SQLServer:SQL Errors", - [(f'rate(mssql_perfmon__errors_total{S}[{rate}])', - 'errors/s')], - (0, y, 24, 7))); y += 7 - ps.append(legacy_link_panel( - "SQLServer: Deprecated Features", - grid=(0, y, 24, 7), - sql_dashboard=_LEGACY_UID, - note="Deprecated-features counter not currently published by " - "mssql_standard.")); y += 7 - - # 15. Plan Cache - ps.append(row("SQL Server : Plan Cache : Cache Manager Instance", y)) - y += 1 - ps.append(_ts("SQLServer: Plan Cache - Totals", - [(f'mssql_perfmon__cache_pages{S}', 'cache pages'), - (f'mssql_perfmon__cache_object_counts{S}', - 'cache object counts'), - (f'mssql_perfmon__cache_objects_in_use{S}', - 'cache objects in use')], - (0, y, 24, 5))); y += 5 - ps.append(_ts("SQLServer: Plan Cache - cache object counts", - [(f'mssql_perfmon__cache_object_counts{S}', - '{{cache_type}}')], - (0, y, 24, 6))); y += 6 - ps.append(_ts("SQLServer: Plan Cache - cache pages", - [(f'mssql_perfmon__cache_pages{S}', '{{cache_type}}')], - (0, y, 24, 6))); y += 6 - ps.append(_ts("SQLServer: Plan Cache - cache objects in use", - [(f'mssql_perfmon__cache_objects_in_use{S}', - '{{cache_type}}')], - (0, y, 24, 6))); y += 6 - - # 16. Transactions - ps.append(row("SQLServer:Transactions", y)); y += 1 - ps.append(_ts("Longest Transaction Running Time", - [(f'mssql_perfmon__longest_transaction_running_time_seconds{S}', - 'longest tx (s)')], - (0, y, 11, 5), unit="s")) - ps.append(_ts("Free Space in tempdb (KB)", - [(f'mssql_perfmon__free_space_in_tempdb_kb{S}', - 'free tempdb (KB)')], - (11, y, 13, 5), unit="kbytes")); y += 5 - ps.append(_ts("Transactions", - [(f'mssql_perfmon__transactions{S}', 'tx')], - (0, y, 11, 5))) - ps.append(_ts("Version Store Size (KB)", - [(f'mssql_perfmon__version_store_size_kb{S}', - 'version store (KB)')], - (11, y, 13, 5), unit="kbytes")); y += 5 - - # 17. General Stats - ps.append(row("SQLServer:General Statistics", y)); y += 1 - ps.append(_ts("Winsock BSP rejected connections/sec", - [(f'rate(windows_net_packets_outbound_errors_total{S}[{rate}])', - '{{nic}}')], - (0, y, 24, 8))); y += 8 - ps.append(_ts("SQLServer:General Statistics - Login/Logout", - [(f'rate(mssql_perfmon__logins_total{S}[{rate}])', - 'logins/s'), - (f'rate(mssql_perfmon__logouts_total{S}[{rate}])', - 'logouts/s')], - (0, y, 24, 7))); y += 7 - - # 18. Locks - ps.append(row("MSSQL Locks Performance Counters", y)); y += 1 - ps.append(_ts("SqlServer:Locks - Lock Wait Time (ms)", - [(f'rate(mssql_perfmon__lock_wait_time_ms_total{S}[{rate}])', - '{{resource_type}}')], - (0, y, 24, 8), unit="ms")); y += 8 - ps.append(_ts("SqlServer:Locks - Average Wait Time (ms)", - [(f'mssql_perfmon__average_wait_time_ms{S}', - '{{resource_type}}')], - (0, y, 24, 8), unit="ms")); y += 8 - ps.append(_ts("SqlServer:Locks - Waits/sec", - [(f'rate(mssql_perfmon__lock_waits_total{S}[{rate}])', - '{{resource_type}}')], - (0, y, 24, 8))); y += 8 - - # 19. Latches - ps.append(row("MSSQL Latches Performance Counters", y)); y += 1 - ps.append(_ts("Latch Waits/sec", - [(f'rate(mssql_perfmon__latch_waits_total{S}[{rate}])', - 'latch waits/s')], - (0, y, 24, 6))); y += 6 - ps.append(_ts("Latch Wait Time (ms)", - [(f'rate(mssql_perfmon__latch_wait_time_ms_total{S}[{rate}])', - 'latch wait ms/s')], - (0, y, 24, 8), unit="ms")); y += 8 - - # 20. Replication - ps.append(row("SQLServer:Replication", y)); y += 1 - ps.append(_ts("Replication - Latency", - [(f'mssql_perfmon__replication_latency_seconds{S}', - '{{publication}}')], - (0, y, 24, 8), unit="s")); y += 8 - ps.append(_ts("Replication - Transfer Rate", - [(f'rate(mssql_perfmon__replication_delivered_commands_total{S}[{rate}])', - '{{publication}}')], - (0, y, 24, 8))); y += 8 - - # 21. SQLAgent:Jobs - ps.append(row("SQLAgent:Jobs", y)); y += 1 - ps.append(_ts("SQLAgent: Jobs", - [(f'sum by (instance) (mssql_sqlagent_job__is_running{S})', - 'jobs running'), - (f'sum by (instance) (mssql_sqlagent_job__enabled{S})', - 'jobs enabled')], - (0, y, 24, 5))); y += 5 - - # 22/23. Mirroring / Resource Pool — no metrics published - ps.append(row("SQLServer:Database Mirroring", y)); y += 1 - ps.append(legacy_link_panel( - "Database Mirroring", grid=(0, y, 24, 5), - sql_dashboard=_LEGACY_UID, - note="Mirroring counters are not currently exposed by " - "mssql_standard; use the SQL dashboard.")); y += 5 - ps.append(row("SQLServer:Resource Pool Stats", y)); y += 1 - ps.append(legacy_link_panel( - "Resource Pool Stats", grid=(0, y, 24, 5), - sql_dashboard=_LEGACY_UID, - note="Resource Governor pool counters are not currently exposed " - "by mssql_standard.")) diff --git a/sql_exporter/Prometheus-Dashboards/_specs/sql_agent_jobs.py b/sql_exporter/Prometheus-Dashboards/_specs/sql_agent_jobs.py deleted file mode 100644 index e39f399..0000000 --- a/sql_exporter/Prometheus-Dashboards/_specs/sql_agent_jobs.py +++ /dev/null @@ -1,154 +0,0 @@ -"""Spec for ``SQL Agent Jobs`` Prometheus port (UID: prom_sql_agent_jobs). - -SQL source dashboards: - - - Monitoring - Live - All Servers - Job Activity Monitor.json (5 data) - - Monitoring - Live - All Servers.json (failed-jobs summary rows) - -Backed by the new ``mssql_sqlagent_jobs.collector.yml``: - - mssql_sqlagent_job__enabled {job_name, job_id, - category_name, owner_name} - mssql_sqlagent_job__last_run_outcome {..., last_run_outcome_desc} - mssql_sqlagent_job__last_run_duration_seconds {job_name, job_id} - mssql_sqlagent_job__last_run_end_time_utc {job_name, job_id} - mssql_sqlagent_job__next_run_time_utc {job_name, job_id} - mssql_sqlagent_job__is_running {job_name, job_id} - mssql_sqlagent_job__step_failures_last_24h {job_name, job_id} -""" -from prom_dashboard import Panel, Target, query_var, custom_var - - -UID = "prom_sql_agent_jobs" -TITLE = "SQL Agent Jobs" -TAGS = ["mssql", "sqlmonitor", "SQL Agent", "prometheus"] - - -def variables(): - return [ - query_var("Server", "label_values(mssql_up, instance)", - label="SQL Instance", multi=True, include_all=True), - query_var("job_category", - 'label_values(mssql_sqlagent_job__enabled{instance=~"$Server"}, category_name)', - label="Category", multi=True, include_all=True), - query_var("job_name", - 'label_values(mssql_sqlagent_job__enabled{instance=~"$Server",category_name=~"$job_category"}, job_name)', - label="Job Name", multi=True, include_all=True), - custom_var("enabled", ["__ALL__", "1", "0"], default="__ALL__", - label="Enabled"), - custom_var("last_outcome", - ["__ALL__", "Succeeded", "Failed", "Retry", - "Canceled", "Unknown"], - default="__ALL__", label="Last Outcome"), - ] - - -def panels(): - ps: list[Panel] = [] - I = ('{instance=~"$Server",category_name=~"$job_category",' - 'job_name=~"$job_name"}') - # Selector for metrics that only carry the job_name/job_id pair. - IJ = '{instance=~"$Server",job_name=~"$job_name"}' - - # 1 - Summary stats - ps.append(Panel( - title="Jobs - Total", - description="Total number of SQL Agent jobs matching the filters.", - type="stat", unit="short", - grid=(0, 0, 6, 4), - targets=[Target(f"count(mssql_sqlagent_job__enabled{I})", - legend="", ref="A", instant=True)], - )) - ps.append(Panel( - title="Jobs - Enabled", - description="Number of enabled jobs matching the filters.", - type="stat", unit="short", - grid=(6, 0, 6, 4), - thresholds_steps=[{"color": "red", "value": None}, - {"color": "green", "value": 1}], - targets=[Target(f"sum(mssql_sqlagent_job__enabled{I})", - legend="", ref="A", instant=True)], - )) - ps.append(Panel( - title="Jobs - Running Now", - description="Jobs whose latest sysjobactivity row shows " - "start_execution_date set and stop_execution_date NULL.", - type="stat", unit="short", - grid=(12, 0, 6, 4), - targets=[Target(f"sum(mssql_sqlagent_job__is_running{IJ})", - legend="", ref="A", instant=True)], - )) - ps.append(Panel( - title="Jobs - Last Outcome = Failed", - description="Jobs whose most recent completed run failed.", - type="stat", unit="short", - grid=(18, 0, 6, 4), - thresholds_steps=[{"color": "green", "value": None}, - {"color": "red", "value": 1}], - targets=[Target( - f'count(mssql_sqlagent_job__last_run_outcome{I} == 0)', - legend="", ref="A", instant=True)], - )) - - # 2 - Main table: join everything by (instance, job_name) - ps.append(Panel( - title="SQL Agent Jobs - Status Detail - [$Server]", - description=("Per-job roll-up of enabled/outcome/duration/next-run/" - "running/24h-step-failures, joined on (instance, job_name)."), - type="table", unit="short", - grid=(0, 4, 24, 18), - targets=[ - Target(f"mssql_sqlagent_job__enabled{I}", - legend="", ref="Enabled", instant=True, format="table"), - Target( - f"mssql_sqlagent_job__last_run_outcome{I}", - legend="", ref="Outcome", instant=True, format="table"), - Target(f"mssql_sqlagent_job__last_run_duration_seconds{IJ}", - legend="", ref="Duration", instant=True, format="table"), - Target(f"mssql_sqlagent_job__last_run_end_time_utc{IJ}", - legend="", ref="LastEnd", instant=True, format="table"), - Target(f"mssql_sqlagent_job__next_run_time_utc{IJ}", - legend="", ref="NextRun", instant=True, format="table"), - Target(f"mssql_sqlagent_job__is_running{IJ}", - legend="", ref="Running", instant=True, format="table"), - Target(f"mssql_sqlagent_job__step_failures_last_24h{IJ}", - legend="", ref="Fails24h", instant=True, format="table"), - ], - transformations=[ - {"id": "merge", "options": {}}, - {"id": "organize", "options": { - "excludeByName": {"Time": True, "__name__": True, - "job": True, "target": True, - "exported_job": True, "job_id": True}, - "renameByName": { - "instance": "Server", - "job_name": "Job", - "category_name": "Category", - "owner_name": "Owner", - "last_run_outcome_desc": "Last Outcome", - "Value #Enabled": "Enabled", - "Value #Outcome": "Outcome (code)", - "Value #Duration": "Duration (s)", - "Value #LastEnd": "Last Run End (UTC)", - "Value #NextRun": "Next Run (UTC)", - "Value #Running": "Running", - "Value #Fails24h": "Step Failures (24h)", - }, - }}, - ], - )) - - # 3 - Trend: recent failed-job count - ps.append(Panel( - title="Failed Jobs - Trend", - description="Number of jobs whose last completed run was Failed " - "(outcome=0), tracked across time.", - type="timeseries", unit="short", - grid=(0, 22, 24, 10), - targets=[Target( - f'count(mssql_sqlagent_job__last_run_outcome{I} == 0) ' - f'by (instance)', - legend="{{instance}}", ref="A")], - )) - - return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/wait_stats.py b/sql_exporter/Prometheus-Dashboards/_specs/wait_stats.py deleted file mode 100644 index c561ba3..0000000 --- a/sql_exporter/Prometheus-Dashboards/_specs/wait_stats.py +++ /dev/null @@ -1,135 +0,0 @@ -"""Spec for ``Wait Stats`` Prometheus port (UID: prom_wait_stats). - -SQL source dashboard has 4 data panels: - - 1. Table "Wait Stats with ${sql_schedulers} CPUs since Startup" - → top waits ranked by wait_percentage with resource/signal splits. - 2. Table "Wait Stats Since Startup till ${__from}" - → same as (1) but evaluated at the dashboard's start time. - 3. Table "Wait Stats In Selected Time Duration" - → deltas between ${__from} and ${__to}. - 4. Timeseries "[${server}] - WaitStats" - → per-wait_type wait_time_seconds rate over the range. - -All panels port 1:1 using ``mssql_waits__*`` counter metrics which are -already produced by ``mssql_dba_cached.collector.yml``. -""" -from prom_dashboard import Panel, Target, query_var, constant_var - - -UID = "prom_wait_stats" -TITLE = "Wait Stats" -TAGS = ["mssql", "sqlmonitor", "Wait Stats", "prometheus"] - - -def variables(): - return [ - query_var("Server", "label_values(mssql_up, instance)", - label="SQL Instance", multi=False, include_all=False), - query_var("sql_schedulers", - 'query_result(mssql_sqlserver_cpu_count{instance="$Server"})', - label="SQL Schedulers", hide=2), - query_var("sqlserver_start_time_utc", - 'query_result((time() - mssql_sqlserver_uptime_seconds{instance="$Server"}) * 1000)', - label="SQL Start Time UTC (ms)", hide=2), - constant_var("top_n", "20", label="Top N Waits"), - ] - - -def panels(): - ps: list[Panel] = [] - I = '{instance="$Server"}' - - # Panel 1 - table "Wait Stats with $sql_schedulers CPUs since Startup" - # Uses the raw counter values (since startup = counter-to-date). - ps.append(Panel( - title=("Wait Stats with \"__${sql_schedulers} CPUs__\" since Startup"), - description=("Top wait_types ranked by wait_time since SQL Server " - "last started. Matches the SQL dashboard's first table."), - type="table", unit="s", - grid=(0, 0, 24, 11), - targets=[ - Target(f"topk($top_n, mssql_waits__wait_time_seconds{I})", - legend="{{wait_type}}", ref="WaitSec", instant=True, - format="table"), - Target(f"mssql_waits__resource_time_seconds{I}", - legend="{{wait_type}}", ref="ResSec", instant=True, - format="table"), - Target(f"mssql_waits__signal_time_seconds{I}", - legend="{{wait_type}}", ref="SigSec", instant=True, - format="table"), - Target(f"mssql_waits__waiting_tasks_count{I}", - legend="{{wait_type}}", ref="Waiters", instant=True, - format="table"), - Target(f"mssql_waits__wait_percentage{I}", - legend="{{wait_type}}", ref="Pct", instant=True, - format="table"), - Target(f"mssql_waits__wait_rank_no{I}", - legend="{{wait_type}}", ref="Rank", instant=True, - format="table"), - ], - transformations=[ - {"id": "merge", "options": {}}, - {"id": "organize", "options": { - "excludeByName": {"Time": True, "__name__": True, - "instance": True, "job": True, - "exported_job": True, "target": True}, - "renameByName": { - "wait_type": "Wait Type", - "Value #Rank": "Rank", - "Value #WaitSec": "Wait (s)", - "Value #ResSec": "Resource (s)", - "Value #SigSec": "Signal (s)", - "Value #Waiters": "Waiting Tasks", - "Value #Pct": "Wait %", - }, - "indexByName": {"Rank": 0, "Wait Type": 1, "Wait (s)": 2, - "Resource (s)": 3, "Signal (s)": 4, - "Waiting Tasks": 5, "Wait %": 6}, - }}, - ], - )) - - # Panel 2 - Since Startup till $__from (historical snapshot) - ps.append(Panel( - title="Wait Stats ____Since Startup ___ till ___ ${__from:date:YYYY-MM-DD HH.mm}___", - description=("Counter value at dashboard `from` time — " - "waits accumulated from SQL startup until the start of " - "the visible range."), - type="table", unit="s", - grid=(0, 11, 24, 7), - targets=[Target( - f"topk($top_n, mssql_waits__wait_time_seconds{I} @ end() offset ($__to - $__from))", - legend="{{wait_type}}", ref="A", instant=True, format="table")], - )) - - # Panel 3 - Delta over selected time duration - ps.append(Panel( - title=("Wait Stats ____In Selected Time Duration____Since____" - "${__from:date:YYYY-MM-DD HH.mm}___till___" - "${__to:date:YYYY-MM-DD HH.mm}____"), - description=("Wait time accrued between `from` and `to`. " - "Uses increase() on the counter, so wait type = " - "additional seconds waited in the visible range."), - type="table", unit="s", - grid=(0, 18, 24, 7), - targets=[Target( - f"topk($top_n, sum by (wait_type) (" - f"increase(mssql_waits__wait_time_seconds{I}[$__range])))", - legend="{{wait_type}}", ref="A", instant=True, format="table")], - )) - - # Panel 4 - Timeseries of wait_time rate per wait_type - ps.append(Panel( - title="[${Server}] - WaitStats", - description=("rate(mssql_waits__wait_time_seconds) per wait_type — " - "top N by average rate over the visible range."), - type="timeseries", unit="s", - grid=(0, 25, 24, 19), - targets=[Target( - f"topk($top_n, sum by (wait_type) (" - f"rate(mssql_waits__wait_time_seconds{I}[$__rate_interval])))", - legend="{{wait_type}}", ref="A")], - )) - - return ps diff --git a/sql_exporter/Prometheus-Dashboards/_specs/xevent_trend.py b/sql_exporter/Prometheus-Dashboards/_specs/xevent_trend.py deleted file mode 100644 index 59a6da4..0000000 --- a/sql_exporter/Prometheus-Dashboards/_specs/xevent_trend.py +++ /dev/null @@ -1,124 +0,0 @@ -"""Spec for ``XEvent - Trend`` Prometheus port (UID: prom_xevent_trend). - -SQL source dashboard ``XEvent - Trend.json`` has 3 data panels: - - 1. Timeseries CPU Trend by {grouping_key} - 2. Timeseries Counts Trend by {grouping_key} - 3. Timeseries Reads Trend by {grouping_key} - -Backed by the new ``mssql_xevent.collector.yml``: - - mssql_xevent__events_last_5m {event_name, database_name, - result, client_app_name} - mssql_xevent__cpu_time_ms_last_5m (same labels) - mssql_xevent__duration_seconds_last_5m - mssql_xevent__logical_reads_last_5m - mssql_xevent__physical_reads_last_5m - mssql_xevent__writes_last_5m - -The SQL dashboard lets the user toggle the grouping key (event / db / -login / program). Prometheus has no SUM(CASE ...) GROUP BY, so we ship -one variable ``$grouping_key`` and build the ``sum by (<key>)`` expr -with a templated label name. -""" -from prom_dashboard import Panel, Target, query_var, custom_var - - -UID = "prom_xevent_trend" -TITLE = "XEvent - Trend" -TAGS = ["mssql", "sqlmonitor", "XEvent", "prometheus"] - - -def variables(): - return [ - query_var("Server", "label_values(mssql_up, instance)", - label="SQL Instance"), - query_var("database", - 'label_values(mssql_xevent__events_last_5m{instance="$Server"}, database_name)', - label="Database", multi=True, include_all=True), - query_var("event_name", - 'label_values(mssql_xevent__events_last_5m{instance="$Server"}, event_name)', - label="Event", multi=True, include_all=True), - query_var("result", - 'label_values(mssql_xevent__events_last_5m{instance="$Server"}, result)', - label="Result", multi=True, include_all=True), - query_var("client_app", - 'label_values(mssql_xevent__events_last_5m{instance="$Server"}, client_app_name)', - label="Client App", multi=True, include_all=True), - custom_var("grouping_key", - ["event_name", "database_name", - "client_app_name", "result"], - default="event_name", label="Group by"), - custom_var("top_n", - ["5", "10", "15", "20", "25"], default="10", - label="Top N series"), - ] - - -def panels(): - ps: list[Panel] = [] - I = ('{instance="$Server",database_name=~"$database",' - 'event_name=~"$event_name",result=~"$result",' - 'client_app_name=~"$client_app"}') - - # 1 - CPU Trend (cpu_time_ms → seconds) - ps.append(Panel( - title="XEvent - CPU Trend - By - {${grouping_key}}", - description=("CPU time (seconds) attributed to extended events, " - "summed per ${grouping_key}. Uses the 5-minute " - "aggregate gauge published by mssql_xevent; rendered " - "as a rate since the gauge resets each collection."), - type="timeseries", unit="s", - grid=(0, 0, 24, 11), - targets=[Target( - f"topk($top_n, sum by (${{grouping_key}}) (" - f"mssql_xevent__cpu_time_ms_last_5m{I} / 1000))", - legend="{{${grouping_key}}}", ref="A")], - )) - - # 2 - Counts Trend - ps.append(Panel( - title="XEvent - Counts Trend - By - {${grouping_key}}", - description=("Count of extended events in the most recent " - "5-minute window, summed per ${grouping_key}."), - type="timeseries", unit="short", - grid=(0, 11, 24, 11), - targets=[Target( - f"topk($top_n, sum by (${{grouping_key}}) (" - f"mssql_xevent__events_last_5m{I}))", - legend="{{${grouping_key}}}", ref="A")], - )) - - # 3 - Reads Trend (logical + physical) - ps.append(Panel( - title="XEvent - Reads Trend - By - {${grouping_key}}", - description=("Logical + physical reads attributed to extended " - "events, summed per ${grouping_key}."), - type="timeseries", unit="short", - grid=(0, 22, 24, 11), - targets=[ - Target( - f"topk($top_n, sum by (${{grouping_key}}) (" - f"mssql_xevent__logical_reads_last_5m{I}))", - legend="logical • {{${grouping_key}}}", ref="Logical"), - Target( - f"topk($top_n, sum by (${{grouping_key}}) (" - f"mssql_xevent__physical_reads_last_5m{I}))", - legend="physical • {{${grouping_key}}}", ref="Physical"), - ], - )) - - # 4 - Duration (bonus panel; useful complement to the SQL original) - ps.append(Panel( - title="XEvent - Duration Trend - By - {${grouping_key}}", - description=("Sum of durations (seconds) for extended events in " - "the 5-minute window, per ${grouping_key}."), - type="timeseries", unit="s", - grid=(0, 33, 24, 11), - targets=[Target( - f"topk($top_n, sum by (${{grouping_key}}) (" - f"mssql_xevent__duration_seconds_last_5m{I}))", - legend="{{${grouping_key}}}", ref="A")], - )) - - return ps diff --git a/sql_exporter/Prometheus-Dashboards/_tools/inspect_panels.py b/sql_exporter/Prometheus-Dashboards/_tools/inspect_panels.py deleted file mode 100644 index 308a489..0000000 --- a/sql_exporter/Prometheus-Dashboards/_tools/inspect_panels.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env python3 -"""Helper: list panels (title+type+grid) for a source dashboard JSON. -Usage: python3 inspect_panels.py <file.json> -""" -import json -import sys - -def walk(panels, prefix=""): - for p in panels: - t = p.get("type", "?") - title = p.get("title", "") - g = p.get("gridPos", {}) - coord = f"({g.get('x',0)},{g.get('y',0)},{g.get('w',0)},{g.get('h',0)})" - print(f"{prefix}[{t:10}] {coord:18} {title}") - if p.get("panels"): - walk(p["panels"], prefix + " ") - -d = json.load(open(sys.argv[1])) -walk(d.get("panels", [])) diff --git a/sql_exporter/Prometheus-Dashboards/_tools/validate.py b/sql_exporter/Prometheus-Dashboards/_tools/validate.py deleted file mode 100644 index a83f875..0000000 --- a/sql_exporter/Prometheus-Dashboards/_tools/validate.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python3 -"""Validate every generated Prometheus dashboard JSON in this folder. - -Checks: - - parses as JSON - - schemaVersion >= 41 - - contains a DS_PROMETHEUS datasource input - - every non-row/non-text panel has >= 1 target with a non-empty expr - - prints (uid, #panels total, #data panels, #rows, #text panels, #vars) -""" -import json -import os -import sys - -ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - - -def walk(panels): - for p in panels: - yield p - if p.get("panels"): - yield from walk(p["panels"]) - - -def validate(path: str) -> bool: - d = json.load(open(path)) - assert d.get("schemaVersion", 0) >= 41, f"{path}: schemaVersion too old" - assert any(i["name"] == "DS_PROMETHEUS" for i in d.get("__inputs", [])), \ - f"{path}: missing DS_PROMETHEUS input" - all_p = list(walk(d.get("panels", []))) - rows = sum(1 for p in all_p if p.get("type") == "row") - text = sum(1 for p in all_p if p.get("type") == "text") - data = [p for p in all_p - if p.get("type") not in ("row", "text", "dashlist")] - for p in data: - tgts = p.get("targets", []) - if not tgts: - print(f" WARN {path}: panel '{p.get('title')}' has 0 targets") - continue - for t in tgts: - if not t.get("expr", "").strip(): - print(f" WARN {path}: panel '{p.get('title')}' " - f"target {t.get('refId')} has empty expr") - vars_ = len(d.get("templating", {}).get("list", [])) - print(f"{os.path.basename(path):60s} uid={d['uid']:40s} " - f"panels={len(all_p):3d} data={len(data):3d} rows={rows:2d} " - f"text={text:2d} vars={vars_:2d}") - return True - - -if __name__ == "__main__": - files = sorted(f for f in os.listdir(ROOT) if f.endswith(".json")) - ok = True - for f in files: - try: - validate(os.path.join(ROOT, f)) - except Exception as e: - print(f"FAIL {f}: {e}") - ok = False - sys.exit(0 if ok else 1) diff --git a/sql_exporter/Prometheus-Dashboards/generate.py b/sql_exporter/Prometheus-Dashboards/generate.py deleted file mode 100644 index 6a73c1c..0000000 --- a/sql_exporter/Prometheus-Dashboards/generate.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python3 -"""Generate all Prometheus-backed SQLMonitor Grafana dashboards. - -Run from this folder: - - python3 generate.py # regenerate every dashboard - python3 generate.py core # regenerate only the Core Metrics - Trend port - -Each ``*.json`` written here is importable directly into Grafana via the -standard "New -> Import" dialog; Grafana will prompt you for the -Prometheus datasource to bind to the ``${DS_PROMETHEUS}`` placeholder. -""" -from __future__ import annotations - -import importlib -import sys -from pathlib import Path - -ROOT = Path(__file__).resolve().parent -sys.path.insert(0, str(ROOT / "_lib")) -sys.path.insert(0, str(ROOT / "_specs")) - -from build import build_dashboard, write_dashboard # noqa: E402 - - -SPECS = [ - # (spec_module, output_filename) - ("core_metrics_trend", "Core Metrics - Trend.json"), - ("wait_stats", "Wait Stats.json"), - ("disk_space", "Disk Space.json"), - ("ag_health_state", "Ag Health State.json"), - ("sql_agent_jobs", "SQL Agent Jobs.json"), - ("backup_history", "Backup History.json"), - ("xevent_trend", "XEvent - Trend.json"), - ("database_file_io_stats", "Database File IO Stats.json"), - ("dba_inventory", "DBA Inventory.json"), - ("monitoring_live_all_servers", - "Monitoring - Live - All Servers.json"), - ("monitoring_live_distributed", - "Monitoring - Live - Distributed.json"), - ("monitoring_perfmon_quest", - "Monitoring - Perfmon Counters - Quest Softwares - Distributed.json"), -] - - -def regenerate(filter_: str | None = None) -> list[Path]: - out: list[Path] = [] - for mod_name, filename in SPECS: - if filter_ and filter_ not in mod_name: - continue - spec = importlib.import_module(mod_name) - dashboard = build_dashboard( - uid=spec.UID, - title=spec.TITLE, - tags=spec.TAGS, - variables=spec.variables(), - panels=spec.panels(), - description=getattr(spec, "DESCRIPTION", ""), - ) - out.append(write_dashboard(ROOT, filename, dashboard)) - return out - - -if __name__ == "__main__": - flt = sys.argv[1] if len(sys.argv) > 1 else None - for p in regenerate(flt): - print(f"wrote {p.relative_to(ROOT)}") diff --git a/sql_exporter/SQL-Exporter-Metrics-Documentation.md b/sql_exporter/SQL-Exporter-Metrics-Documentation.md deleted file mode 100644 index 4c7b39f..0000000 --- a/sql_exporter/SQL-Exporter-Metrics-Documentation.md +++ /dev/null @@ -1,228 +0,0 @@ -# SQL Server Exporter Metrics Dashboard Documentation - -## Overview - -This repository now contains the current Grafana dashboard for SQL Server metrics exposed by `sql_exporter`: - -- `sql_exporter/SQL-Exporter-Metrics-Dashboard.json` - - cleaner operational layout intended for day-to-day use - -The current dashboard details are: - -- **Title:** `SQL Exporter Metrics` -- **UID:** `sql-exporter-metrics` -- **Panels:** 53 -- **Rows:** 10 -- **Metric families covered:** 74 `mssql_*` metrics from `sql_exporter/sql_exporter_metrics.txt` - -Every panel includes a description so the dashboard remains self-documenting inside Grafana. - -## Which Dashboard Should You Use? - -### Use `SQL-Exporter-Metrics-Dashboard.json` when you want - -- a cleaner operational layout -- a stronger top-level overview row -- better grouping for troubleshooting -- easier side-by-side monitoring of workload, waits, memory, I/O, and log pressure - -## Dashboard Structure - -### 1. Overview - -Top-row KPIs for fast triage: - -- **SQL Instance Up**: `mssql_up` -- **SQL Agent Service**: `mssql_service_info` filtered to SQL Server Agent -- **User Connections**: `mssql_user_connections` -- **Batch Req/sec**: rate of `mssql_batch_requests` -- **SQL CPU %**: `mssql_cpu_utilization_percentage` -- **Memory Util %**: `mssql_memory_utilization_percentage` -- **PLE (sec)**: `mssql_page_life_expectancy_seconds` -- **Max Log Used %**: max of `mssql_database_percent_log_used` - -This row is intended to answer: **Is the instance up, busy, pressured, or approaching a log-space issue?** - -### 2. Availability & Inventory - -- Instance & service availability trend -- HA / replica queue gauges -- Exporter local time -- Service & instance metadata snapshot table -- Database inventory snapshot table - -Use this row to confirm exporter coverage, instance availability, service state, and discovered database metadata. - -### 3. Workload, Sessions & Connections - -- connections by database -- login / logout / reset rates -- active cursors and SQL attentions - -Use this row to understand connection churn and session pressure. - -### 4. CPU, Compilation & Execution Patterns - -- CPU by scope, resource pool, and workload group -- batch requests, compilations, recompilations, and auto-parameterization -- access methods activity - -Use this row to identify CPU pressure, heavy compilation churn, and scan-heavy behavior. - -### 5. Memory & Buffer Pool - -- host / OS / page file memory -- SQL process memory and grant pressure -- memory manager breakdown -- buffer pool capacity -- buffer cache health -- buffer manager operations / checkpoints - -Use this row for memory pressure analysis and buffer pool behavior. - -### 6. I/O, Pages & Latches - -- page lookup / read / write rates -- I/O stall by database -- latch, network I/O, and page I/O wait gauges - -Use this row to correlate read/write patterns with storage or latch bottlenecks. - -### 7. Transactions, Locks & Waits - -- transaction activity -- blocking, lock waits, and deadlocks -- waits in progress - -Use this row for contention investigations and long-running transaction analysis. - -### 8. Database Storage & File Layout - -- database file sizes -- database log used % -- XTP memory by database - -Use this row for capacity review and per-database file footprint tracking. - -### 9. Transaction Log, Redo & Data Movement - -- log flushes / bytes / waits -- log wait time / events / growths -- mirroring / redo movement - -Use this row when diagnosing log write pressure, AG / redo issues, or database growth events. - -### 10. Errors & Tempdb - -- SQL errors and connection kills -- tempdb space and temp objects -- misc operational counters - -Use this row for application-facing issues, tempdb pressure, and general anomaly detection. - -## Single-Server Selection - -Both dashboards intentionally allow **one server at a time**. - -### Variable details - -- **Variable name:** `Server` -- **Query:** `label_values(mssql_up, instance)` -- **Multi-select:** `false` -- **Include All:** `false` - -The `Server` selector still comes from `mssql_up` because it is now the clean instance-level availability metric and always carries the Prometheus `instance` target label. - -### How it works - -1. Select one target from the `Server` dropdown. -2. Every panel filters on `instance="$Server"`. -3. This prevents mixed-server graphs and makes troubleshooting clearer. - -## Panel Descriptions - -Every panel in the dashboard JSON includes a description that references the underlying metric family or families. - -This is especially useful when: - -- importing the dashboard into a new Grafana environment -- handing the dashboard to another DBA or SRE -- troubleshooting unfamiliar counters directly from the Grafana UI - -## Metric Coverage - -The dashboards were generated from the metrics reference file: - -- `sql_exporter/sql_exporter_metrics.txt` - -The current generated dashboards are intended to cover all discovered `mssql_*` metric families from that file. - -Key domains represented include: - -- availability -- connections and sessions -- workload and compilations -- CPU and memory -- buffer pool and page activity -- I/O and latch waits -- transactions, locks, and waits -- database file and log usage -- tempdb and errors - -## Operational Interpretation Guide - -### Healthy signals - -- `mssql_up = 1` for the selected SQL instance -- `mssql_service_info = 1` for expected services such as SQL Server Agent -- CPU generally below sustained saturation -- memory utilization stable relative to your baseline -- page life expectancy stable or improving -- deadlocks near zero -- blocked processes near zero -- log used % comfortably below critical thresholds - -### Warning signals - -- rising recompilation rates -- falling PLE -- increasing blocked processes -- recurring deadlocks -- growing I/O stall rates -- rising tempdb usage -- persistent log growth events - -### Critical signals - -- SQL instance down (`mssql_up = 0` or absent) -- expected SQL services not reporting through `mssql_service_info` -- sustained high CPU or memory pressure -- log space nearing full -- sharp spike in waits / deadlocks / blocking -- rapid rise in SQL errors or kill-connection errors - -## Import and Customization - -### Recommended import target - -Import this file: - -- `sql_exporter/SQL-Exporter-Metrics-Dashboard.json` - -### After import - -1. select your Prometheus datasource -2. select a single `Server` -3. compare observed values against your own environment baseline -4. tune thresholds if your workload profile needs different warning levels - -## Related Files - -- `sql_exporter/SQL-Exporter-Metrics-Dashboard.json` -- `sql_exporter/SQL-Exporter-Metrics-QuickRef.md` -- `sql_exporter/sql_exporter_metrics.txt` - -## References - -- SQL Server DMV documentation: https://learn.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/system-dynamic-management-views -- Grafana dashboard documentation: https://grafana.com/docs/grafana/latest/dashboards/ diff --git a/sql_exporter/SQL-Exporter-Metrics-QuickRef.md b/sql_exporter/SQL-Exporter-Metrics-QuickRef.md deleted file mode 100644 index d827fe0..0000000 --- a/sql_exporter/SQL-Exporter-Metrics-QuickRef.md +++ /dev/null @@ -1,154 +0,0 @@ -# SQL Server Metrics Quick Reference - -## Recommended Dashboard - -Use: - -- `sql_exporter/SQL-Exporter-Metrics-Dashboard.json` - -This is the cleaner operational dashboard. - -### Current dashboard facts - -- **Grafana title:** `SQL Exporter Metrics` -- **UID:** `sql-exporter-metrics` -- **Panels:** 53 -- **Rows:** 10 -- **Metrics covered:** 74 `mssql_*` metric families -- **Server selector:** single-select only - -## Key Features - -✅ **Single Server Selection** - one instance at a time -✅ **Overview KPIs** - fast operational triage -✅ **Category Rows** - organized by troubleshooting domain -✅ **Trend Panels** - time-series views for operational drift -✅ **Panel Descriptions** - each panel documents its metric source -✅ **Inventory Tables** - service and database snapshots - ---- - -## Row-by-Row Layout - -| Row | Purpose | Example Panels | -|-----|---------|----------------| -| Overview | Fast health check | SQL Instance Up, SQL Agent Service, User Connections, SQL CPU %, PLE | -| Availability & Inventory | Instance/service state and discovered objects | Instance & Service Availability, Metadata Snapshot, Database Inventory Snapshot | -| Workload, Sessions & Connections | Connection churn and session pressure | Connections by Database, Login/Logout/Reset Rates | -| CPU, Compilation & Execution Patterns | CPU pressure and plan churn | CPU by Scope, Batch/Compilation Trends, Access Methods | -| Memory & Buffer Pool | Memory pressure and cache behavior | Host/OS Memory, Memory Grants, Buffer Cache Health | -| I/O, Pages & Latches | Disk and latch bottlenecks | Page Read/Write Rates, I/O Stall by Database | -| Transactions, Locks & Waits | Contention analysis | Transaction Activity, Blocking/Deadlocks, Waits in Progress | -| Database Storage & File Layout | Capacity and file footprint | File Sizes, Log Used %, XTP Memory | -| Transaction Log, Redo & Data Movement | Log write and HA flow analysis | Log Flushes, Log Events/Growths, Mirroring/Redo | -| Errors & Tempdb | Error spikes and tempdb pressure | SQL Errors, Tempdb Space, Temp Objects | - ---- - -## Overview KPIs to Watch First - -| KPI | Metric Basis | Healthy Direction | -|-----|--------------|------------------| -| SQL Instance Up | `mssql_up` | should be `1` | -| SQL Agent Service | `mssql_service_info{service_name="SQLSERVERAGENT"}` | should be `1` when expected | -| User Connections | `mssql_user_connections` | stable around baseline | -| Batch Req/sec | `rate(mssql_batch_requests)` | workload-dependent baseline | -| SQL CPU % | `mssql_cpu_utilization_percentage` | avoid sustained high values | -| Memory Util % | `mssql_memory_utilization_percentage` | stable relative to baseline | -| PLE (sec) | `mssql_page_life_expectancy_seconds` | stable / higher is generally better | -| Max Log Used % | `mssql_database_percent_log_used` | keep comfortably below critical | - ---- - -## Single-Server Filtering - -The dashboard intentionally restricts analysis to **one server at a time**. - -- **Variable:** `Server` -- **Query:** `label_values(mssql_up, instance)` -- **Multi-select:** disabled -- **Include All:** disabled - -The selector uses `mssql_up` because it is now the instance-level metric, while `mssql_service_info` holds service-specific state and metadata. - -All Prometheus queries filter on: - -- `instance="$Server"` - -This prevents cross-server mixing in the same graph. - ---- - -## Quick Triage Guide - -### If CPU is high - -Check these rows in order: - -1. **Overview** - confirm CPU spike -2. **CPU, Compilation & Execution Patterns** - compilations, recompilations, scans -3. **Workload, Sessions & Connections** - connection surge - -### If memory pressure is suspected - -Check: - -1. **Overview** - Memory Util % and PLE -2. **Memory & Buffer Pool** - grants, cache health, page faults -3. **I/O, Pages & Latches** - rising physical reads / page activity - -### If blocking or slowness is reported - -Check: - -1. **Transactions, Locks & Waits** -2. **I/O, Pages & Latches** -3. **Transaction Log, Redo & Data Movement** - -### If log growth is a concern - -Check: - -1. **Overview** - Max Log Used % -2. **Database Storage & File Layout** - per-database log used % -3. **Transaction Log, Redo & Data Movement** - flush waits, events, growths - ---- - -## Baseline Template - -Record these against a known-good period: - -- Batch Requests/sec -- SQL CPU % -- Memory Util % -- Page Life Expectancy -- Max Log Used % -- I/O Stall by Database -- Deadlocks/sec -- Lock Waits/sec -- User Connections - ---- - -## File Locations - -- `sql_exporter/SQL-Exporter-Metrics-Dashboard.json` -- `sql_exporter/SQL-Exporter-Metrics-Documentation.md` -- `sql_exporter/SQL-Exporter-Metrics-QuickRef.md` -- `sql_exporter/sql_exporter_metrics.txt` - ---- - -## Recommended Import Choice - -Import this dashboard: - -- `sql_exporter/SQL-Exporter-Metrics-Dashboard.json` - ---- - -**Last Updated:** 2026-03-17 -**Dashboard Version:** 2.0 -**Metrics Covered:** 74 -**Panels:** 53 diff --git a/sql_exporter/mssql_dba_stableinfo.collector.yml b/sql_exporter/mssql_dba_stableinfo.collector.yml index 25a86e6..59c3e34 100644 --- a/sql_exporter/mssql_dba_stableinfo.collector.yml +++ b/sql_exporter/mssql_dba_stableinfo.collector.yml @@ -610,18 +610,36 @@ metrics: queries: - query_name: mssql_sys_databases query: | + -- Dynamic SQL: substitute CAST(0 AS bigint) for columns that do not + -- exist on the running SQL Server version so the same metric schema + -- is emitted on SQL 2016 through SQL 2025. The following columns are + -- present only on SQL Server 2022 (16.x) or later. + DECLARE @c_tempdb_spill_to_remote_store nvarchar(200) = IIF( + COL_LENGTH('sys.databases','is_tempdb_spill_to_remote_store') IS NOT NULL, + N'CAST(d.is_tempdb_spill_to_remote_store AS bigint)', N'CAST(0 AS bigint)'); + DECLARE @c_stale_page_detection_on nvarchar(200) = IIF( + COL_LENGTH('sys.databases','is_stale_page_detection_on') IS NOT NULL, + N'CAST(d.is_stale_page_detection_on AS bigint)', N'CAST(0 AS bigint)'); + DECLARE @c_memory_optimized_enabled nvarchar(200) = IIF( + COL_LENGTH('sys.databases','is_memory_optimized_enabled') IS NOT NULL, + N'CAST(d.is_memory_optimized_enabled AS bigint)', N'CAST(0 AS bigint)'); + DECLARE @c_data_retention_enabled nvarchar(200) = IIF( + COL_LENGTH('sys.databases','is_data_retention_enabled') IS NOT NULL, + N'CAST(d.is_data_retention_enabled AS bigint)', N'CAST(0 AS bigint)'); + + DECLARE @sql nvarchar(max) = N' SELECT - CAST(DATEDIFF_BIG(second, CONVERT(datetime2, '19700101'), GETUTCDATE()) AS bigint) as collection_time_utc, + CAST(DATEDIFF_BIG(second, CONVERT(datetime2, ''19700101''), GETUTCDATE()) AS bigint) as collection_time_utc, d.name AS db_name, - COALESCE(sys.fn_varbintohexstr(d.owner_sid), N'') AS owner_sid, - CAST(DATEDIFF_BIG(second, CONVERT(datetime2, '19700101'), d.create_date) AS bigint) AS create_date, - COALESCE(d.collation_name, N'') AS collation_name, - COALESCE(CONVERT(nvarchar(36), d.service_broker_guid), N'') AS service_broker_guid, - COALESCE(CONVERT(nvarchar(36), d.replica_id), N'') AS replica_id, - COALESCE(CONVERT(nvarchar(36), d.group_database_id), N'') AS group_database_id, - COALESCE(d.default_language_name, N'') AS default_language_name, - COALESCE(d.default_fulltext_language_name, N'') AS default_fulltext_language_name, - COALESCE(d.physical_database_name, N'') AS physical_database_name, + COALESCE(sys.fn_varbintohexstr(d.owner_sid), N'''') AS owner_sid, + CAST(DATEDIFF_BIG(second, CONVERT(datetime2, ''19700101''), d.create_date) AS bigint) AS create_date, + COALESCE(d.collation_name, N'''') AS collation_name, + COALESCE(CONVERT(nvarchar(36), d.service_broker_guid), N'''') AS service_broker_guid, + COALESCE(CONVERT(nvarchar(36), d.replica_id), N'''') AS replica_id, + COALESCE(CONVERT(nvarchar(36), d.group_database_id), N'''') AS group_database_id, + COALESCE(d.default_language_name, N'''') AS default_language_name, + COALESCE(d.default_fulltext_language_name, N'''') AS default_fulltext_language_name, + COALESCE(d.physical_database_name, N'''') AS physical_database_name, d.database_id AS database_id, d.source_database_id AS source_database_id, d.compatibility_level AS compatibility_level, @@ -685,20 +703,22 @@ queries: d.catalog_collation_type AS catalog_collation_type, CAST(d.is_result_set_caching_on AS bigint) AS is_result_set_caching_on, CAST(d.is_accelerated_database_recovery_on AS bigint) AS is_accelerated_database_recovery_on, - CAST(d.is_tempdb_spill_to_remote_store AS bigint) AS is_tempdb_spill_to_remote_store, - CAST(d.is_stale_page_detection_on AS bigint) AS is_stale_page_detection_on, - CAST(d.is_memory_optimized_enabled AS bigint) AS is_memory_optimized_enabled, - CAST(d.is_data_retention_enabled AS bigint) AS is_data_retention_enabled, - COALESCE(d.user_access_desc, N'') AS user_access_desc, - COALESCE(d.state_desc, N'') AS state_desc, - COALESCE(d.snapshot_isolation_state_desc, N'') AS snapshot_isolation_state_desc, - COALESCE(d.recovery_model_desc, N'') AS recovery_model_desc, - COALESCE(d.page_verify_option_desc, N'') AS page_verify_option_desc, - COALESCE(d.containment_desc, N'') AS containment_desc, - COALESCE(d.delayed_durability_desc, N'') AS delayed_durability_desc, - COALESCE(d.catalog_collation_type_desc, N'') AS catalog_collation_type_desc + ' + @c_tempdb_spill_to_remote_store + N' AS is_tempdb_spill_to_remote_store, + ' + @c_stale_page_detection_on + N' AS is_stale_page_detection_on, + ' + @c_memory_optimized_enabled + N' AS is_memory_optimized_enabled, + ' + @c_data_retention_enabled + N' AS is_data_retention_enabled, + COALESCE(d.user_access_desc, N'''') AS user_access_desc, + COALESCE(d.state_desc, N'''') AS state_desc, + COALESCE(d.snapshot_isolation_state_desc, N'''') AS snapshot_isolation_state_desc, + COALESCE(d.recovery_model_desc, N'''') AS recovery_model_desc, + COALESCE(d.page_verify_option_desc, N'''') AS page_verify_option_desc, + COALESCE(d.containment_desc, N'''') AS containment_desc, + COALESCE(d.delayed_durability_desc, N'''') AS delayed_durability_desc, + COALESCE(d.catalog_collation_type_desc, N'''') AS catalog_collation_type_desc FROM sys.databases AS d - ORDER BY d.name + ORDER BY d.name'; + + EXEC sp_executesql @sql; - query_name: mssql_sys_configurations query: | diff --git a/sql_exporter/mssql_sqlagent_jobs.collector.yml b/sql_exporter/mssql_sqlagent_jobs.collector.yml index 1d47d25..83d9f36 100644 --- a/sql_exporter/mssql_sqlagent_jobs.collector.yml +++ b/sql_exporter/mssql_sqlagent_jobs.collector.yml @@ -64,62 +64,13 @@ metrics: query_ref: mssql_sqlagent_jobs_latest queries: + # NOTE: sql_exporter (go-mssqldb) only reads the FIRST result-set from a + # batch and treats `SELECT INTO #tmp` statements as zero-column resultsets + # that interleave with the final SELECT -- which causes silent scrape + # failures. So this query is deliberately a SINGLE SELECT using derived + # tables instead of temp tables. - query_name: mssql_sqlagent_jobs_latest query: | - SET NOCOUNT ON; - - IF OBJECT_ID('tempdb..#latest_outcome') IS NOT NULL DROP TABLE #latest_outcome; - IF OBJECT_ID('tempdb..#step_fails_24h') IS NOT NULL DROP TABLE #step_fails_24h; - IF OBJECT_ID('tempdb..#running') IS NOT NULL DROP TABLE #running; - IF OBJECT_ID('tempdb..#next_run') IS NOT NULL DROP TABLE #next_run; - - -- Latest outcome-row per job (step_id = 0 in sysjobhistory). - WITH h AS ( - SELECT job_id, run_status, run_duration, - run_end_dt = msdb.dbo.agent_datetime(run_date, run_time), - run_seconds = (run_duration / 10000) * 3600 - + ((run_duration / 100) % 100) * 60 - + (run_duration % 100), - rn = ROW_NUMBER() OVER (PARTITION BY job_id - ORDER BY run_date DESC, run_time DESC, - instance_id DESC) - FROM msdb.dbo.sysjobhistory - WHERE step_id = 0 - ) - SELECT job_id, run_status, run_seconds, run_end_dt - INTO #latest_outcome - FROM h WHERE rn = 1; - - -- Step failures in the last 24 hours. - SELECT h.job_id, failures_24h = COUNT(*) - INTO #step_fails_24h - FROM msdb.dbo.sysjobhistory h - WHERE h.step_id > 0 AND h.run_status = 0 - AND msdb.dbo.agent_datetime(h.run_date, h.run_time) - >= DATEADD(hour, -24, GETDATE()) - GROUP BY h.job_id; - - -- Currently running (sysjobactivity row with start_execution_date set and stop_execution_date NULL). - SELECT a.job_id, is_running = 1 - INTO #running - FROM msdb.dbo.sysjobactivity a - INNER JOIN ( - SELECT job_id, max_ts = MAX(session_id) - FROM msdb.dbo.sysjobactivity GROUP BY job_id - ) m ON m.job_id = a.job_id AND m.max_ts = a.session_id - WHERE a.start_execution_date IS NOT NULL - AND a.stop_execution_date IS NULL; - - -- Earliest next-run time per job across active schedules. - SELECT js.job_id, - next_run_dt = MIN(msdb.dbo.agent_datetime( - NULLIF(js.next_run_date, 0), NULLIF(js.next_run_time, 0))) - INTO #next_run - FROM msdb.dbo.sysjobschedules js - INNER JOIN msdb.dbo.sysschedules s ON s.schedule_id = js.schedule_id - WHERE s.enabled = 1 AND js.next_run_date > 0 - GROUP BY js.job_id; - SELECT job_name = CAST(j.name AS nvarchar(256)), job_id = CONVERT(nvarchar(36), j.job_id), category_name = ISNULL(c.name, N''), @@ -133,19 +84,61 @@ queries: WHEN 3 THEN N'Canceled' ELSE N'Unknown' END, last_run_duration_seconds = ISNULL(lo.run_seconds, 0), - last_run_end_time_utc = CAST(ISNULL( + last_run_end_time_utc = CAST(ISNULL( DATEDIFF_BIG(second, CONVERT(datetime2, '19700101'), DATEADD(mi, DATEDIFF(mi, GETDATE(), GETUTCDATE()), lo.run_end_dt)), 0) AS bigint), - next_run_time_utc = CAST(ISNULL( + next_run_time_utc = CAST(ISNULL( DATEDIFF_BIG(second, CONVERT(datetime2, '19700101'), DATEADD(mi, DATEDIFF(mi, GETDATE(), GETUTCDATE()), nr.next_run_dt)), 0) AS bigint), - is_running = ISNULL(r.is_running, 0), - step_failures_last_24h = ISNULL(sf.failures_24h, 0) + is_running = ISNULL(r.is_running, 0), + step_failures_last_24h = ISNULL(sf.failures_24h, 0) FROM msdb.dbo.sysjobs j - LEFT JOIN msdb.dbo.syscategories c ON c.category_id = j.category_id - LEFT JOIN #latest_outcome lo ON lo.job_id = j.job_id - LEFT JOIN #step_fails_24h sf ON sf.job_id = j.job_id - LEFT JOIN #running r ON r.job_id = j.job_id - LEFT JOIN #next_run nr ON nr.job_id = j.job_id; + LEFT JOIN msdb.dbo.syscategories c + ON c.category_id = j.category_id + LEFT JOIN ( + SELECT job_id, run_status, run_end_dt, run_seconds + FROM ( + SELECT job_id, run_status, + run_end_dt = msdb.dbo.agent_datetime(run_date, run_time), + run_seconds = (run_duration / 10000) * 3600 + + ((run_duration / 100) % 100) * 60 + + (run_duration % 100), + rn = ROW_NUMBER() OVER ( + PARTITION BY job_id + ORDER BY run_date DESC, run_time DESC, instance_id DESC) + FROM msdb.dbo.sysjobhistory + WHERE step_id = 0 + ) x + WHERE rn = 1 + ) lo ON lo.job_id = j.job_id + LEFT JOIN ( + SELECT h.job_id, failures_24h = COUNT(*) + FROM msdb.dbo.sysjobhistory h + WHERE h.step_id > 0 AND h.run_status = 0 + AND msdb.dbo.agent_datetime(h.run_date, h.run_time) + >= DATEADD(hour, -24, GETDATE()) + GROUP BY h.job_id + ) sf ON sf.job_id = j.job_id + LEFT JOIN ( + SELECT a.job_id, is_running = 1 + FROM msdb.dbo.sysjobactivity a + INNER JOIN ( + SELECT job_id, max_ts = MAX(session_id) + FROM msdb.dbo.sysjobactivity GROUP BY job_id + ) m ON m.job_id = a.job_id AND m.max_ts = a.session_id + WHERE a.start_execution_date IS NOT NULL + AND a.stop_execution_date IS NULL + ) r ON r.job_id = j.job_id + LEFT JOIN ( + SELECT js.job_id, + next_run_dt = MIN(msdb.dbo.agent_datetime( + NULLIF(js.next_run_date, 0), + NULLIF(js.next_run_time, 0))) + FROM msdb.dbo.sysjobschedules js + INNER JOIN msdb.dbo.sysschedules s + ON s.schedule_id = js.schedule_id + WHERE s.enabled = 1 AND js.next_run_date > 0 + GROUP BY js.job_id + ) nr ON nr.job_id = j.job_id; diff --git a/sql_exporter/mssql_xevent.collector.yml b/sql_exporter/mssql_xevent.collector.yml index 0264089..a6247d9 100644 --- a/sql_exporter/mssql_xevent.collector.yml +++ b/sql_exporter/mssql_xevent.collector.yml @@ -69,54 +69,54 @@ metrics: query_ref: mssql_xevent_recent queries: + # NOTE: sql_exporter (go-mssqldb) reads only the first result-set from a + # batch. IF / ELSE branches + a stand-alone `SELECT TOP 0` gate upstream + # of sp_executesql confuse the driver and cause silent scrape failures. + # We collapse the query into a single sp_executesql call whose dynamic + # SQL is chosen up front (real query if DBA.dbo.xevent_metrics exists, + # otherwise a TOP 0 shim). Exactly one result-set, always. - query_name: mssql_xevent_recent query: | - SET NOCOUNT ON; - SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - - IF DB_ID('DBA') IS NULL - OR OBJECT_ID('DBA.dbo.xevent_metrics') IS NULL - BEGIN - -- Emit an empty result set so the exporter marks the query OK - -- but publishes no samples on instances that do not run the - -- xevent_metrics collector. - SELECT TOP 0 - CAST(N'' AS nvarchar(128)) AS event_name, - CAST(N'' AS nvarchar(128)) AS database_name, - CAST(N'' AS nvarchar(32)) AS result, - CAST(N'' AS nvarchar(256)) AS client_app_name, - CAST(0 AS bigint) AS events_count, - CAST(0 AS bigint) AS cpu_time_ms_sum, - CAST(0 AS bigint) AS duration_seconds_sum, - CAST(0 AS bigint) AS logical_reads_sum, - CAST(0 AS bigint) AS physical_reads_sum, - CAST(0 AS bigint) AS writes_sum, - CAST(0 AS bigint) AS collection_time_utc; - RETURN; - END; - DECLARE @now datetime2 = SYSDATETIME(); DECLARE @from datetime2 = DATEADD(minute, -5, @now); DECLARE @now_utc bigint = DATEDIFF_BIG(second, CONVERT(datetime2, '19700101'), SYSUTCDATETIME()); + DECLARE @have_xev bit = CASE WHEN DB_ID('DBA') IS NOT NULL + AND OBJECT_ID('DBA.dbo.xevent_metrics') IS NOT NULL + THEN 1 ELSE 0 END; - DECLARE @sql nvarchar(max) = N' - SELECT TOP 500 - event_name = CAST(COALESCE(x.event_name, N'''') AS nvarchar(128)), - database_name = CAST(COALESCE(x.database_name, N'''') AS nvarchar(128)), - result = CAST(COALESCE(x.result, N'''') AS nvarchar(32)), - client_app_name = CAST(COALESCE(x.client_app_name, N'''') AS nvarchar(256)), - events_count = CAST(COUNT_BIG(*) AS bigint), - cpu_time_ms_sum = CAST(SUM(CAST(x.cpu_time_ms AS bigint)) AS bigint), - duration_seconds_sum = CAST(SUM(CAST(x.duration_seconds AS bigint)) AS bigint), - logical_reads_sum = CAST(SUM(CAST(x.logical_reads AS bigint)) AS bigint), - physical_reads_sum = CAST(SUM(CAST(x.physical_reads AS bigint)) AS bigint), - writes_sum = CAST(SUM(CAST(x.writes AS bigint)) AS bigint), - collection_time_utc = @now_utc - FROM [DBA].[dbo].[xevent_metrics] AS x WITH (NOLOCK) - WHERE x.event_time >= @from AND x.event_time <= @now - GROUP BY x.event_name, x.database_name, x.result, x.client_app_name - ORDER BY events_count DESC'; + DECLARE @sql nvarchar(max) = + CASE WHEN @have_xev = 1 THEN N' + SELECT TOP 500 + event_name = CAST(COALESCE(x.event_name, N'''') AS nvarchar(128)), + database_name = CAST(COALESCE(x.database_name, N'''') AS nvarchar(128)), + result = CAST(COALESCE(x.result, N'''') AS nvarchar(32)), + client_app_name = CAST(COALESCE(x.client_app_name, N'''') AS nvarchar(256)), + events_count = CAST(COUNT_BIG(*) AS bigint), + cpu_time_ms_sum = CAST(SUM(CAST(x.cpu_time_ms AS bigint)) AS bigint), + duration_seconds_sum = CAST(SUM(CAST(x.duration_seconds AS bigint)) AS bigint), + logical_reads_sum = CAST(SUM(CAST(x.logical_reads AS bigint)) AS bigint), + physical_reads_sum = CAST(SUM(CAST(x.physical_reads AS bigint)) AS bigint), + writes_sum = CAST(SUM(CAST(x.writes AS bigint)) AS bigint), + collection_time_utc = @now_utc + FROM [DBA].[dbo].[xevent_metrics] AS x WITH (NOLOCK) + WHERE x.event_time >= @from AND x.event_time <= @now + GROUP BY x.event_name, x.database_name, x.result, x.client_app_name + ORDER BY events_count DESC' + ELSE N' + SELECT TOP 0 + CAST(N'''' AS nvarchar(128)) AS event_name, + CAST(N'''' AS nvarchar(128)) AS database_name, + CAST(N'''' AS nvarchar(32)) AS result, + CAST(N'''' AS nvarchar(256)) AS client_app_name, + CAST(0 AS bigint) AS events_count, + CAST(0 AS bigint) AS cpu_time_ms_sum, + CAST(0 AS bigint) AS duration_seconds_sum, + CAST(0 AS bigint) AS logical_reads_sum, + CAST(0 AS bigint) AS physical_reads_sum, + CAST(0 AS bigint) AS writes_sum, + CAST(@now_utc AS bigint) AS collection_time_utc' + END; EXEC sp_executesql @sql, diff --git a/sql_exporter/sql_exporter_metrics.txt b/sql_exporter/sql_exporter_metrics.txt deleted file mode 100644 index 2b6a57f..0000000 --- a/sql_exporter/sql_exporter_metrics.txt +++ /dev/null @@ -1,501 +0,0 @@ -# HELP mssql_access_methods_total Access methods counters since SQL Server startup. -# TYPE mssql_access_methods_total counter -mssql_access_methods_total{operation="forwarded_records"} 0 -mssql_access_methods_total{operation="full_scans"} 31299 -mssql_access_methods_total{operation="index_searches"} 1.367884e+06 -mssql_access_methods_total{operation="page_splits"} 1228 -mssql_access_methods_total{operation="table_lock_escalations"} 0 -mssql_access_methods_total{operation="workfiles_created"} 5100 -mssql_access_methods_total{operation="worktables_created"} 2667 -# HELP mssql_active_cursors Current active cursors by cursor type. -# TYPE mssql_active_cursors gauge -mssql_active_cursors{cursor_type="API Cursor"} 0 -mssql_active_cursors{cursor_type="TSQL Global Cursor"} 0 -mssql_active_cursors{cursor_type="TSQL Local Cursor"} 2 -# HELP mssql_active_transactions_count Count of active transactions from sys.dm_tran_active_transactions. -# TYPE mssql_active_transactions_count gauge -mssql_active_transactions_count 19 -# HELP mssql_average_latch_wait_time_ms Average latch wait time metric from SQL Server performance counters. -# TYPE mssql_average_latch_wait_time_ms gauge -mssql_average_latch_wait_time_ms 15838 -# HELP mssql_batch_requests Number of command batches received. -# TYPE mssql_batch_requests counter -mssql_batch_requests 7927 -# HELP mssql_buffer_cache_hit_ratio Ratio of requests that hit the buffer cache -# TYPE mssql_buffer_cache_hit_ratio gauge -mssql_buffer_cache_hit_ratio 16773 -# HELP mssql_buffer_database_pages Database pages in the SQL Server buffer pool. -# TYPE mssql_buffer_database_pages gauge -mssql_buffer_database_pages 62189 -# HELP mssql_buffer_manager_operations_total Buffer manager operation counters since SQL Server startup. -# TYPE mssql_buffer_manager_operations_total counter -mssql_buffer_manager_operations_total{operation="free_list_stalls"} 0 -mssql_buffer_manager_operations_total{operation="lazy_writes"} 0 -mssql_buffer_manager_operations_total{operation="readahead_pages"} 21454 -# HELP mssql_buffer_target_pages Target pages in the SQL Server buffer pool. -# TYPE mssql_buffer_target_pages gauge -mssql_buffer_target_pages 1.32448e+06 -# HELP mssql_checkpoint_pages_sec Checkpoint Pages Per Second -# TYPE mssql_checkpoint_pages_sec gauge -mssql_checkpoint_pages_sec 13 -# HELP mssql_connection_reset Connection resets since SQL Server startup. -# TYPE mssql_connection_reset counter -mssql_connection_reset 1775 -# HELP mssql_connections Number of active connections. -# TYPE mssql_connections gauge -mssql_connections{db="AdventureWorksDW2025"} 1 -mssql_connections{db="DBA"} 11 -mssql_connections{db="master"} 66 -mssql_connections{db="msdb"} 11 -# HELP mssql_cpu_utilization_percentage CPU utilization percentages from the SQL Server scheduler monitor ring buffer. -# TYPE mssql_cpu_utilization_percentage gauge -mssql_cpu_utilization_percentage{scope="sqlserver"} 1 -mssql_cpu_utilization_percentage{scope="system"} 7 -# HELP mssql_database_active_transactions Current active transactions per database. -# TYPE mssql_database_active_transactions gauge -mssql_database_active_transactions{db="AdventureWorks2025"} 0 -mssql_database_active_transactions{db="AdventureWorksDW2025"} 0 -mssql_database_active_transactions{db="CDCDemo"} 0 -mssql_database_active_transactions{db="DBA"} 0 -mssql_database_active_transactions{db="ScratchPad"} 0 -mssql_database_active_transactions{db="StackOverflow2013"} 0 -mssql_database_active_transactions{db="TutorialDB"} 0 -mssql_database_active_transactions{db="master"} 0 -mssql_database_active_transactions{db="model"} 0 -mssql_database_active_transactions{db="model_msdb"} 0 -mssql_database_active_transactions{db="model_replicatedmaster"} 0 -mssql_database_active_transactions{db="msdb"} 0 -mssql_database_active_transactions{db="sqlnexus"} 0 -mssql_database_active_transactions{db="tempdb"} 0 -# HELP mssql_database_file_size_bytes Database file sizes in bytes. -# TYPE mssql_database_file_size_bytes gauge -mssql_database_file_size_bytes{db="AdventureWorks2025",state="data"} 1.5711862784e+10 -mssql_database_file_size_bytes{db="AdventureWorks2025",state="log"} 1.015013376e+09 -mssql_database_file_size_bytes{db="AdventureWorks2025",state="log_used"} 5.6605696e+07 -mssql_database_file_size_bytes{db="AdventureWorksDW2025",state="data"} 1.42606336e+08 -mssql_database_file_size_bytes{db="AdventureWorksDW2025",state="log"} 7.548928e+07 -mssql_database_file_size_bytes{db="AdventureWorksDW2025",state="log_used"} 8.670208e+06 -mssql_database_file_size_bytes{db="CDCDemo",state="data"} 1.048576e+09 -mssql_database_file_size_bytes{db="CDCDemo",state="log"} 5.24279808e+08 -mssql_database_file_size_bytes{db="CDCDemo",state="log_used"} 3.7390336e+07 -mssql_database_file_size_bytes{db="DBA",state="data"} 1.0510925824e+10 -mssql_database_file_size_bytes{db="DBA",state="log"} 1.4680055808e+10 -mssql_database_file_size_bytes{db="DBA",state="log_used"} 8.505522176e+09 -mssql_database_file_size_bytes{db="ScratchPad",state="data"} 1.048576e+09 -mssql_database_file_size_bytes{db="ScratchPad",state="log"} 5.24279808e+08 -mssql_database_file_size_bytes{db="ScratchPad",state="log_used"} 3.2442368e+07 -mssql_database_file_size_bytes{db="StackOverflow2013",state="data"} 5.4525952e+10 -mssql_database_file_size_bytes{db="StackOverflow2013",state="log"} 7.98941184e+08 -mssql_database_file_size_bytes{db="StackOverflow2013",state="log_used"} 6.764032e+07 -mssql_database_file_size_bytes{db="TutorialDB",state="data"} 1.048576e+09 -mssql_database_file_size_bytes{db="TutorialDB",state="log"} 5.24279808e+08 -mssql_database_file_size_bytes{db="TutorialDB",state="log_used"} 3.7608448e+07 -mssql_database_file_size_bytes{db="master",state="data"} 1.1206656e+07 -mssql_database_file_size_bytes{db="master",state="log"} 2.351104e+06 -mssql_database_file_size_bytes{db="master",state="log_used"} 829440 -mssql_database_file_size_bytes{db="model",state="data"} 1.048576e+09 -mssql_database_file_size_bytes{db="model",state="log"} 5.24279808e+08 -mssql_database_file_size_bytes{db="model",state="log_used"} 1.7152e+06 -mssql_database_file_size_bytes{db="model_msdb",state="data"} 1.4811136e+07 -mssql_database_file_size_bytes{db="model_msdb",state="log"} 778240 -mssql_database_file_size_bytes{db="model_msdb",state="log_used"} 391168 -mssql_database_file_size_bytes{db="model_replicatedmaster",state="data"} 4.9152e+06 -mssql_database_file_size_bytes{db="model_replicatedmaster",state="log"} 2.351104e+06 -mssql_database_file_size_bytes{db="model_replicatedmaster",state="log_used"} 823296 -mssql_database_file_size_bytes{db="msdb",state="data"} 9.44439296e+08 -mssql_database_file_size_bytes{db="msdb",state="log"} 3.61684992e+08 -mssql_database_file_size_bytes{db="msdb",state="log_used"} 5.885952e+06 -mssql_database_file_size_bytes{db="sqlnexus",state="data"} 1.048576e+09 -mssql_database_file_size_bytes{db="sqlnexus",state="log"} 5.24279808e+08 -mssql_database_file_size_bytes{db="sqlnexus",state="log_used"} 4.6893056e+07 -mssql_database_file_size_bytes{db="tempdb",state="data"} 1.3631488e+09 -mssql_database_file_size_bytes{db="tempdb",state="log"} 2.28917248e+08 -mssql_database_file_size_bytes{db="tempdb",state="log_used"} 7.196672e+06 -# HELP mssql_database_info Info metric with database state and AG status. Value is always 1. -# TYPE mssql_database_info gauge -mssql_database_info{database_name="AdventureWorks2025",is_ha_instance="false",is_in_ag="0",state="0",state_desc="ONLINE"} 1 -mssql_database_info{database_name="AdventureWorksDW2025",is_ha_instance="false",is_in_ag="0",state="0",state_desc="ONLINE"} 1 -mssql_database_info{database_name="CDCDemo",is_ha_instance="false",is_in_ag="0",state="0",state_desc="ONLINE"} 1 -mssql_database_info{database_name="DBA",is_ha_instance="false",is_in_ag="0",state="0",state_desc="ONLINE"} 1 -mssql_database_info{database_name="ScratchPad",is_ha_instance="false",is_in_ag="0",state="0",state_desc="ONLINE"} 1 -mssql_database_info{database_name="StackOverflow2013",is_ha_instance="false",is_in_ag="0",state="0",state_desc="ONLINE"} 1 -mssql_database_info{database_name="TutorialDB",is_ha_instance="false",is_in_ag="0",state="0",state_desc="ONLINE"} 1 -mssql_database_info{database_name="master",is_ha_instance="false",is_in_ag="0",state="0",state_desc="ONLINE"} 1 -mssql_database_info{database_name="model",is_ha_instance="false",is_in_ag="0",state="0",state_desc="ONLINE"} 1 -mssql_database_info{database_name="msdb",is_ha_instance="false",is_in_ag="0",state="0",state_desc="ONLINE"} 1 -mssql_database_info{database_name="sqlnexus",is_ha_instance="false",is_in_ag="0",state="0",state_desc="ONLINE"} 1 -mssql_database_info{database_name="tempdb",is_ha_instance="false",is_in_ag="0",state="0",state_desc="ONLINE"} 1 -# HELP mssql_database_log_bytes_flushed_total Database log bytes flushed since SQL Server startup. -# TYPE mssql_database_log_bytes_flushed_total counter -mssql_database_log_bytes_flushed_total{db="AdventureWorks2025"} 411136 -mssql_database_log_bytes_flushed_total{db="AdventureWorksDW2025"} 2048 -mssql_database_log_bytes_flushed_total{db="CDCDemo"} 1024 -mssql_database_log_bytes_flushed_total{db="DBA"} 2.36032e+06 -mssql_database_log_bytes_flushed_total{db="ScratchPad"} 4608 -mssql_database_log_bytes_flushed_total{db="StackOverflow2013"} 512 -mssql_database_log_bytes_flushed_total{db="TutorialDB"} 512 -mssql_database_log_bytes_flushed_total{db="master"} 132608 -mssql_database_log_bytes_flushed_total{db="model"} 1536 -mssql_database_log_bytes_flushed_total{db="model_msdb"} 0 -mssql_database_log_bytes_flushed_total{db="model_replicatedmaster"} 0 -mssql_database_log_bytes_flushed_total{db="msdb"} 1.654784e+06 -mssql_database_log_bytes_flushed_total{db="sqlnexus"} 2048 -mssql_database_log_bytes_flushed_total{db="tempdb"} 6.454272e+06 -# HELP mssql_database_log_events_total Database log event counts since SQL Server startup. -# TYPE mssql_database_log_events_total counter -mssql_database_log_events_total{db="AdventureWorks2025",event="growths"} 0 -mssql_database_log_events_total{db="AdventureWorks2025",event="shrinks"} 0 -mssql_database_log_events_total{db="AdventureWorks2025",event="truncations"} 0 -mssql_database_log_events_total{db="AdventureWorksDW2025",event="growths"} 0 -mssql_database_log_events_total{db="AdventureWorksDW2025",event="shrinks"} 0 -mssql_database_log_events_total{db="AdventureWorksDW2025",event="truncations"} 0 -mssql_database_log_events_total{db="CDCDemo",event="growths"} 0 -mssql_database_log_events_total{db="CDCDemo",event="shrinks"} 0 -mssql_database_log_events_total{db="CDCDemo",event="truncations"} 0 -mssql_database_log_events_total{db="DBA",event="growths"} 0 -mssql_database_log_events_total{db="DBA",event="shrinks"} 0 -mssql_database_log_events_total{db="DBA",event="truncations"} 0 -mssql_database_log_events_total{db="ScratchPad",event="growths"} 0 -mssql_database_log_events_total{db="ScratchPad",event="shrinks"} 0 -mssql_database_log_events_total{db="ScratchPad",event="truncations"} 0 -mssql_database_log_events_total{db="StackOverflow2013",event="growths"} 0 -mssql_database_log_events_total{db="StackOverflow2013",event="shrinks"} 0 -mssql_database_log_events_total{db="StackOverflow2013",event="truncations"} 0 -mssql_database_log_events_total{db="TutorialDB",event="growths"} 0 -mssql_database_log_events_total{db="TutorialDB",event="shrinks"} 0 -mssql_database_log_events_total{db="TutorialDB",event="truncations"} 0 -mssql_database_log_events_total{db="master",event="growths"} 0 -mssql_database_log_events_total{db="master",event="shrinks"} 0 -mssql_database_log_events_total{db="master",event="truncations"} 0 -mssql_database_log_events_total{db="model",event="growths"} 0 -mssql_database_log_events_total{db="model",event="shrinks"} 0 -mssql_database_log_events_total{db="model",event="truncations"} 0 -mssql_database_log_events_total{db="model_msdb",event="growths"} 0 -mssql_database_log_events_total{db="model_msdb",event="shrinks"} 0 -mssql_database_log_events_total{db="model_msdb",event="truncations"} 0 -mssql_database_log_events_total{db="model_replicatedmaster",event="growths"} 0 -mssql_database_log_events_total{db="model_replicatedmaster",event="shrinks"} 0 -mssql_database_log_events_total{db="model_replicatedmaster",event="truncations"} 0 -mssql_database_log_events_total{db="msdb",event="growths"} 0 -mssql_database_log_events_total{db="msdb",event="shrinks"} 0 -mssql_database_log_events_total{db="msdb",event="truncations"} 0 -mssql_database_log_events_total{db="sqlnexus",event="growths"} 0 -mssql_database_log_events_total{db="sqlnexus",event="shrinks"} 0 -mssql_database_log_events_total{db="sqlnexus",event="truncations"} 0 -mssql_database_log_events_total{db="tempdb",event="growths"} 0 -mssql_database_log_events_total{db="tempdb",event="shrinks"} 0 -mssql_database_log_events_total{db="tempdb",event="truncations"} 0 -# HELP mssql_database_log_flush_wait_time_ms_total Accumulated database log flush wait time in milliseconds since SQL Server startup. -# TYPE mssql_database_log_flush_wait_time_ms_total counter -mssql_database_log_flush_wait_time_ms_total{db="AdventureWorks2025"} 163 -mssql_database_log_flush_wait_time_ms_total{db="AdventureWorksDW2025"} 0 -mssql_database_log_flush_wait_time_ms_total{db="CDCDemo"} 0 -mssql_database_log_flush_wait_time_ms_total{db="DBA"} 601 -mssql_database_log_flush_wait_time_ms_total{db="ScratchPad"} 1 -mssql_database_log_flush_wait_time_ms_total{db="StackOverflow2013"} 0 -mssql_database_log_flush_wait_time_ms_total{db="TutorialDB"} 0 -mssql_database_log_flush_wait_time_ms_total{db="master"} 67 -mssql_database_log_flush_wait_time_ms_total{db="model"} 48 -mssql_database_log_flush_wait_time_ms_total{db="model_msdb"} 0 -mssql_database_log_flush_wait_time_ms_total{db="model_replicatedmaster"} 0 -mssql_database_log_flush_wait_time_ms_total{db="msdb"} 1840 -mssql_database_log_flush_wait_time_ms_total{db="sqlnexus"} 0 -mssql_database_log_flush_wait_time_ms_total{db="tempdb"} 0 -# HELP mssql_database_log_flushes_total Database log flushes since SQL Server startup. -# TYPE mssql_database_log_flushes_total counter -mssql_database_log_flushes_total{db="AdventureWorks2025"} 23 -mssql_database_log_flushes_total{db="AdventureWorksDW2025"} 1 -mssql_database_log_flushes_total{db="CDCDemo"} 1 -mssql_database_log_flushes_total{db="DBA"} 216 -mssql_database_log_flushes_total{db="ScratchPad"} 8 -mssql_database_log_flushes_total{db="StackOverflow2013"} 1 -mssql_database_log_flushes_total{db="TutorialDB"} 1 -mssql_database_log_flushes_total{db="master"} 30 -mssql_database_log_flushes_total{db="model"} 3 -mssql_database_log_flushes_total{db="model_msdb"} 0 -mssql_database_log_flushes_total{db="model_replicatedmaster"} 0 -mssql_database_log_flushes_total{db="msdb"} 1129 -mssql_database_log_flushes_total{db="sqlnexus"} 3 -mssql_database_log_flushes_total{db="tempdb"} 111 -# HELP mssql_database_log_waits_total Database log flush waits since SQL Server startup. -# TYPE mssql_database_log_waits_total counter -mssql_database_log_waits_total{db="AdventureWorks2025"} 17 -mssql_database_log_waits_total{db="AdventureWorksDW2025"} 1 -mssql_database_log_waits_total{db="CDCDemo"} 1 -mssql_database_log_waits_total{db="DBA"} 220 -mssql_database_log_waits_total{db="ScratchPad"} 8 -mssql_database_log_waits_total{db="StackOverflow2013"} 1 -mssql_database_log_waits_total{db="TutorialDB"} 1 -mssql_database_log_waits_total{db="master"} 30 -mssql_database_log_waits_total{db="model"} 3 -mssql_database_log_waits_total{db="model_msdb"} 0 -mssql_database_log_waits_total{db="model_replicatedmaster"} 0 -mssql_database_log_waits_total{db="msdb"} 1146 -mssql_database_log_waits_total{db="sqlnexus"} 3 -mssql_database_log_waits_total{db="tempdb"} 6 -# HELP mssql_database_percent_log_used Transaction log space used as a percentage per database. -# TYPE mssql_database_percent_log_used gauge -mssql_database_percent_log_used{db="AdventureWorks2025"} 5 -mssql_database_percent_log_used{db="AdventureWorksDW2025"} 11 -mssql_database_percent_log_used{db="CDCDemo"} 7 -mssql_database_percent_log_used{db="DBA"} 57 -mssql_database_percent_log_used{db="ScratchPad"} 6 -mssql_database_percent_log_used{db="StackOverflow2013"} 8 -mssql_database_percent_log_used{db="TutorialDB"} 7 -mssql_database_percent_log_used{db="master"} 35 -mssql_database_percent_log_used{db="model"} 0 -mssql_database_percent_log_used{db="model_msdb"} 50 -mssql_database_percent_log_used{db="model_replicatedmaster"} 35 -mssql_database_percent_log_used{db="msdb"} 1 -mssql_database_percent_log_used{db="sqlnexus"} 8 -mssql_database_percent_log_used{db="tempdb"} 3 -# HELP mssql_database_xtp_memory_used_bytes XTP memory usage in bytes per database. -# TYPE mssql_database_xtp_memory_used_bytes gauge -mssql_database_xtp_memory_used_bytes{db="AdventureWorks2025"} 0 -mssql_database_xtp_memory_used_bytes{db="AdventureWorksDW2025"} 0 -mssql_database_xtp_memory_used_bytes{db="CDCDemo"} 0 -mssql_database_xtp_memory_used_bytes{db="DBA"} 6.5052672e+07 -mssql_database_xtp_memory_used_bytes{db="ScratchPad"} 0 -mssql_database_xtp_memory_used_bytes{db="StackOverflow2013"} 0 -mssql_database_xtp_memory_used_bytes{db="TutorialDB"} 0 -mssql_database_xtp_memory_used_bytes{db="master"} 0 -mssql_database_xtp_memory_used_bytes{db="model"} 0 -mssql_database_xtp_memory_used_bytes{db="model_msdb"} 0 -mssql_database_xtp_memory_used_bytes{db="model_replicatedmaster"} 0 -mssql_database_xtp_memory_used_bytes{db="msdb"} 0 -mssql_database_xtp_memory_used_bytes{db="sqlnexus"} 0 -mssql_database_xtp_memory_used_bytes{db="tempdb"} 0 -# HELP mssql_deadlocks Number of lock requests that resulted in a deadlock. -# TYPE mssql_deadlocks counter -mssql_deadlocks 0 -# HELP mssql_host_physical_memory_bytes Host physical memory in bytes. -# TYPE mssql_host_physical_memory_bytes gauge -mssql_host_physical_memory_bytes{state="available"} 1.9592138752e+10 -mssql_host_physical_memory_bytes{state="total"} 2.576924672e+10 -# HELP mssql_io_stall_seconds Stall time in seconds per database and I/O operation. -# TYPE mssql_io_stall_seconds counter -mssql_io_stall_seconds{db="AdventureWorks2025",operation="read"} 2.142 -mssql_io_stall_seconds{db="AdventureWorks2025",operation="write"} 0.278 -mssql_io_stall_seconds{db="AdventureWorksDW2025",operation="read"} 0.35 -mssql_io_stall_seconds{db="AdventureWorksDW2025",operation="write"} 0.003 -mssql_io_stall_seconds{db="CDCDemo",operation="read"} 0.33 -mssql_io_stall_seconds{db="CDCDemo",operation="write"} 0.005 -mssql_io_stall_seconds{db="DBA",operation="read"} 68.031 -mssql_io_stall_seconds{db="DBA",operation="write"} 0.582 -mssql_io_stall_seconds{db="ScratchPad",operation="read"} 0.508 -mssql_io_stall_seconds{db="ScratchPad",operation="write"} 0.068 -mssql_io_stall_seconds{db="StackOverflow2013",operation="read"} 5.796 -mssql_io_stall_seconds{db="StackOverflow2013",operation="write"} 0.003 -mssql_io_stall_seconds{db="TutorialDB",operation="read"} 0.408 -mssql_io_stall_seconds{db="TutorialDB",operation="write"} 0.291 -mssql_io_stall_seconds{db="master",operation="read"} 0.278 -mssql_io_stall_seconds{db="master",operation="write"} 0.218 -mssql_io_stall_seconds{db="model",operation="read"} 5.557 -mssql_io_stall_seconds{db="model",operation="write"} 0.072 -mssql_io_stall_seconds{db="msdb",operation="read"} 13.194 -mssql_io_stall_seconds{db="msdb",operation="write"} 1.938 -mssql_io_stall_seconds{db="sqlnexus",operation="read"} 0.675 -mssql_io_stall_seconds{db="sqlnexus",operation="write"} 0.004 -mssql_io_stall_seconds{db="tempdb",operation="read"} 0.051 -mssql_io_stall_seconds{db="tempdb",operation="write"} 0.081 -# HELP mssql_io_stall_total_seconds Total stall time in seconds per database. -# TYPE mssql_io_stall_total_seconds counter -mssql_io_stall_total_seconds{db="AdventureWorks2025"} 2.42 -mssql_io_stall_total_seconds{db="AdventureWorksDW2025"} 0.353 -mssql_io_stall_total_seconds{db="CDCDemo"} 0.335 -mssql_io_stall_total_seconds{db="DBA"} 68.613 -mssql_io_stall_total_seconds{db="ScratchPad"} 0.576 -mssql_io_stall_total_seconds{db="StackOverflow2013"} 5.799 -mssql_io_stall_total_seconds{db="TutorialDB"} 0.699 -mssql_io_stall_total_seconds{db="master"} 0.496 -mssql_io_stall_total_seconds{db="model"} 5.629 -mssql_io_stall_total_seconds{db="msdb"} 15.132 -mssql_io_stall_total_seconds{db="sqlnexus"} 0.679 -mssql_io_stall_total_seconds{db="tempdb"} 0.132 -# HELP mssql_kill_connection_errors Number of severe errors that caused SQL Server to kill the connection. -# TYPE mssql_kill_connection_errors counter -mssql_kill_connection_errors 0 -# HELP mssql_local_time_seconds Local time in seconds since epoch (Unix time). -# TYPE mssql_local_time_seconds gauge -mssql_local_time_seconds 1.773740761e+09 -# HELP mssql_lock_wait_time_ms_total Accumulated lock wait time in milliseconds since SQL Server startup. -# TYPE mssql_lock_wait_time_ms_total counter -mssql_lock_wait_time_ms_total 93639 -# HELP mssql_lock_waits_total Lock waits since SQL Server startup. -# TYPE mssql_lock_waits_total counter -mssql_lock_waits_total 94 -# HELP mssql_log_apply_pending_queue Log apply pending queue. -# TYPE mssql_log_apply_pending_queue gauge -mssql_log_apply_pending_queue 0 -# HELP mssql_log_growths Number of times the transaction log has been expanded, per database. -# TYPE mssql_log_growths counter -mssql_log_growths{db="AdventureWorks2025"} 0 -mssql_log_growths{db="AdventureWorksDW2025"} 0 -mssql_log_growths{db="CDCDemo"} 0 -mssql_log_growths{db="DBA"} 0 -mssql_log_growths{db="ScratchPad"} 0 -mssql_log_growths{db="StackOverflow2013"} 0 -mssql_log_growths{db="TutorialDB"} 0 -mssql_log_growths{db="master"} 0 -mssql_log_growths{db="model"} 0 -mssql_log_growths{db="model_msdb"} 0 -mssql_log_growths{db="model_replicatedmaster"} 0 -mssql_log_growths{db="msdb"} 0 -mssql_log_growths{db="mssqlsystemresource"} 0 -mssql_log_growths{db="sqlnexus"} 0 -mssql_log_growths{db="tempdb"} 0 -# HELP mssql_log_remaining_for_undo Log remaining for undo. -# TYPE mssql_log_remaining_for_undo gauge -mssql_log_remaining_for_undo 0 -# HELP mssql_log_send_queue Log send queue. -# TYPE mssql_log_send_queue gauge -mssql_log_send_queue 0 -# HELP mssql_logins Logins since SQL Server startup. -# TYPE mssql_logins counter -mssql_logins 438 -# HELP mssql_logouts Logouts since SQL Server startup. -# TYPE mssql_logouts counter -mssql_logouts 418 -# HELP mssql_longest_transaction_running_time_seconds Longest transaction running time in seconds. -# TYPE mssql_longest_transaction_running_time_seconds gauge -mssql_longest_transaction_running_time_seconds 0 -# HELP mssql_memory_grants_outstanding Outstanding workspace memory grants. -# TYPE mssql_memory_grants_outstanding gauge -mssql_memory_grants_outstanding 0 -# HELP mssql_memory_grants_pending Pending workspace memory grants. -# TYPE mssql_memory_grants_pending gauge -mssql_memory_grants_pending 0 -# HELP mssql_memory_manager_bytes SQL Server memory manager allocations in bytes. -# TYPE mssql_memory_manager_bytes gauge -mssql_memory_manager_bytes{state="free"} 2.07495168e+08 -mssql_memory_manager_bytes{state="granted_workspace"} 0 -mssql_memory_manager_bytes{state="maximum_workspace"} 9.56510208e+09 -mssql_memory_manager_bytes{state="sql_cache"} 2.78528e+06 -mssql_memory_manager_bytes{state="stolen_server"} 2.036334592e+09 -mssql_memory_manager_bytes{state="target_server"} 1.2884901888e+10 -mssql_memory_manager_bytes{state="total_server"} 2.753282048e+09 -# HELP mssql_memory_utilization_percentage The percentage of committed memory that is in the working set. -# TYPE mssql_memory_utilization_percentage gauge -mssql_memory_utilization_percentage 100 -# HELP mssql_mirrored_write_transactions Mirrored write transactions since SQL Server startup. -# TYPE mssql_mirrored_write_transactions counter -mssql_mirrored_write_transactions 0 -# HELP mssql_network_io_waits_ms Network IO wait time metric from SQL Server wait statistics. -# TYPE mssql_network_io_waits_ms gauge -mssql_network_io_waits_ms 0 -# HELP mssql_os_memory OS physical memory, used and available. -# TYPE mssql_os_memory gauge -mssql_os_memory{state="available"} 1.95801088e+10 -mssql_os_memory{state="used"} 6.18913792e+09 -# HELP mssql_os_page_file OS page file, used and available. -# TYPE mssql_os_page_file gauge -mssql_os_page_file{state="available"} 2.2955978752e+10 -mssql_os_page_file{state="used"} 6.571364352e+09 -# HELP mssql_page_fault_count The number of page faults that were incurred by the SQL Server process. -# TYPE mssql_page_fault_count counter -mssql_page_fault_count 1.095273e+06 -# HELP mssql_page_io_latch_waits_ms Page IO latch wait time metric from SQL Server wait statistics. -# TYPE mssql_page_io_latch_waits_ms gauge -mssql_page_io_latch_waits_ms 0 -# HELP mssql_page_life_expectancy_seconds The minimum number of seconds a page will stay in the buffer pool on this node without references. -# TYPE mssql_page_life_expectancy_seconds gauge -mssql_page_life_expectancy_seconds 300 -# HELP mssql_page_lookups Buffer manager page lookups since SQL Server startup. -# TYPE mssql_page_lookups counter -mssql_page_lookups 3.085629e+06 -# HELP mssql_page_reads Buffer manager page reads since SQL Server startup. -# TYPE mssql_page_reads counter -mssql_page_reads 54967 -# HELP mssql_page_writes Buffer manager page writes since SQL Server startup. -# TYPE mssql_page_writes counter -mssql_page_writes 413 -# HELP mssql_processes_blocked Currently blocked processes. -# TYPE mssql_processes_blocked gauge -mssql_processes_blocked 0 -# HELP mssql_redo_blocked Redo blocked events since SQL Server startup. -# TYPE mssql_redo_blocked counter -mssql_redo_blocked 0 -# HELP mssql_resident_memory_bytes SQL Server resident memory size (AKA working set). -# TYPE mssql_resident_memory_bytes gauge -mssql_resident_memory_bytes 2.919161856e+09 -# HELP mssql_resource_pool_cpu_usage_percentage CPU usage percentage by resource pool. -# TYPE mssql_resource_pool_cpu_usage_percentage gauge -mssql_resource_pool_cpu_usage_percentage{resource_pool="default"} 0 -mssql_resource_pool_cpu_usage_percentage{resource_pool="internal"} 0.024826216484607 -# HELP mssql_sql_attentions_total SQL attentions since SQL Server startup. -# TYPE mssql_sql_attentions_total counter -mssql_sql_attentions_total 148 -# HELP mssql_sql_auto_params_total Automatic parameterization activity counters since SQL Server startup. -# TYPE mssql_sql_auto_params_total counter -mssql_sql_auto_params_total{mode="attempts"} 728 -mssql_sql_auto_params_total{mode="failed"} 571 -mssql_sql_auto_params_total{mode="safe"} 10 -mssql_sql_auto_params_total{mode="unsafe"} 147 -# HELP mssql_sql_compilations SQL compilations since SQL Server startup. -# TYPE mssql_sql_compilations counter -mssql_sql_compilations 5803 -# HELP mssql_sql_errors_total SQL error counters since SQL Server startup. -# TYPE mssql_sql_errors_total counter -mssql_sql_errors_total{error_type="DB Offline Errors"} 0 -mssql_sql_errors_total{error_type="Info Errors"} 2893 -mssql_sql_errors_total{error_type="Kill Connection Errors"} 0 -mssql_sql_errors_total{error_type="User Errors"} 196 -mssql_sql_errors_total{error_type="_Total"} 3089 -# HELP mssql_sql_process_memory_bytes SQL Server process memory allocations in bytes. -# TYPE mssql_sql_process_memory_bytes gauge -mssql_sql_process_memory_bytes{state="in_use"} 2.919718912e+09 -mssql_sql_process_memory_bytes{state="large_pages"} 0 -mssql_sql_process_memory_bytes{state="locked_pages"} 0 -# HELP mssql_sql_recompilations SQL recompilations since SQL Server startup. -# TYPE mssql_sql_recompilations counter -mssql_sql_recompilations 473 -# HELP mssql_temp_tables_for_destruction Temp tables waiting to be destroyed. -# TYPE mssql_temp_tables_for_destruction gauge -mssql_temp_tables_for_destruction 0 -# HELP mssql_tempdb_active_temp_tables Active temp tables from SQL Server general statistics. -# TYPE mssql_tempdb_active_temp_tables gauge -mssql_tempdb_active_temp_tables 66 -# HELP mssql_tempdb_space_bytes tempdb free space and version store size in bytes. -# TYPE mssql_tempdb_space_bytes gauge -mssql_tempdb_space_bytes{state="free_space"} 1.34938624e+09 -mssql_tempdb_space_bytes{state="version_store"} 745472 -# HELP mssql_transaction_delay Transaction delay for database replicas. -# TYPE mssql_transaction_delay gauge -mssql_transaction_delay 0 -# HELP mssql_up SQL Server instance/service availability and metadata. -# TYPE mssql_up gauge -mssql_up{at_server_name="SQLMonitor",domain="LAB",domain_reg="Lab.com",edition="Enterprise Developer Edition (64-bit)",host_name="SQLMONITOR",instance_name="MSSQLSERVER",ip="127.0.0.1",machine_name="SQLMonitor",ports="1433",product_level="RC1",product_version="17.0.925.4",server_name="SQLMonitor",service_account="LAB\\SQLService",service_name="MSSQLSERVER",service_name_str="SQL Server (MSSQLSERVER)",sql_version="Microsoft SQL Server 2025 (RC1) - 17.0.925.4 (X64) \n Sep 9 2025 17:31:28 \n Copyright (C) 2025 Microsoft Corporation\n Enterprise Developer Edition (64-bit) on Windows Server 2019 Datacenter 10.0 <X64> (Build 17763: ) (Hypervisor)\n"} 1 -mssql_up{at_server_name="SQLMonitor",domain="LAB",domain_reg="Lab.com",edition="Enterprise Developer Edition (64-bit)",host_name="SQLMONITOR",instance_name="MSSQLSERVER",ip="127.0.0.1",machine_name="SQLMonitor",ports="1433",product_level="RC1",product_version="17.0.925.4",server_name="SQLMonitor",service_account="LAB\\SQLService",service_name="SQLSERVERAGENT",service_name_str="SQL Server Agent (MSSQLSERVER)",sql_version="Microsoft SQL Server 2025 (RC1) - 17.0.925.4 (X64) \n Sep 9 2025 17:31:28 \n Copyright (C) 2025 Microsoft Corporation\n Enterprise Developer Edition (64-bit) on Windows Server 2019 Datacenter 10.0 <X64> (Build 17763: ) (Hypervisor)\n"} 1 -# HELP mssql_user_connections Current user connections from SQL Server general statistics. -# TYPE mssql_user_connections gauge -mssql_user_connections 20 -# HELP mssql_user_errors Number of user errors. -# TYPE mssql_user_errors counter -mssql_user_errors 196 -# HELP mssql_virtual_memory_bytes SQL Server committed virtual memory size. -# TYPE mssql_virtual_memory_bytes gauge -mssql_virtual_memory_bytes 3.09387264e+09 -# HELP mssql_waits_in_progress Current waits in progress by wait category. -# TYPE mssql_waits_in_progress gauge -mssql_waits_in_progress{wait_type="Lock waits"} 0 -mssql_waits_in_progress{wait_type="Log buffer waits"} 0 -mssql_waits_in_progress{wait_type="Log write waits"} 0 -mssql_waits_in_progress{wait_type="Memory grant queue waits"} 0 -mssql_waits_in_progress{wait_type="Network IO waits"} 0 -mssql_waits_in_progress{wait_type="Non-Page latch waits"} 0 -mssql_waits_in_progress{wait_type="Page IO latch waits"} 0 -mssql_waits_in_progress{wait_type="Page latch waits"} 0 -mssql_waits_in_progress{wait_type="Thread-safe memory objects waits"} 0 -mssql_waits_in_progress{wait_type="Transaction ownership waits"} 0 -mssql_waits_in_progress{wait_type="Wait for the worker"} 0 -mssql_waits_in_progress{wait_type="Workspace synchronization waits"} 0 -# HELP mssql_workload_group_cpu_usage_percentage CPU usage percentage by workload group. -# TYPE mssql_workload_group_cpu_usage_percentage gauge -mssql_workload_group_cpu_usage_percentage{workload_group="default"} 15.288844621513944 -mssql_workload_group_cpu_usage_percentage{workload_group="internal"} 0.572709163346613 -# HELP mssqlbuffer_pool_committed SQL Server buffer pool committed bytes. -# TYPE mssqlbuffer_pool_committed gauge -mssqlbuffer_pool_committed 2.758295552e+09 -# HELP mssqlbuffer_pool_committed_target SQL Server buffer pool committed target bytes. -# TYPE mssqlbuffer_pool_committed_target gauge -mssqlbuffer_pool_committed_target 1.2884901888e+10 \ No newline at end of file