Lesson 4 of 6 · Monitoring & Observability

Database Monitoring Tools

The layers of a monitoring stack, vendor, cloud-native, open source, and commercial tools, with Prometheus examples, and how to choose.

Beginner 8 sections 4 min read

How a monitoring stack fits together

Every monitoring setup, whether open source, commercial, or cloud-native, has the same layers: something collects data from the databases, something stores it, something shows it on dashboards, and something raises alerts and gets them to the right person. Knowing the layers makes any tool easy to place.

SOURCESCOLLECTSTOREVISUALIZEALERT ACT OraclePostgreSQLSQL ServerOS, cloudapplications exportersagentsOpenTelemetrycollectorscloud APIs PrometheusLokiElasticsearchcloud or SaaS GrafanaOEMcloud consolesSaaS dashboards alert rulesAlertmanagerPagerDutySlack, Teams on-call DBArunbooksautomatedfixes All-in-one platforms, such as OEM, Datadog, or cloud services, cover several layers at once.

Database vendors' own tools

ToolWhat DBAs use it for
Oracle Enterprise Manager (OEM)Oracle's full monitoring and management console: performance, alerts, ASH and AWR analysis, patching, and fleet management, mainly for on-premises and IaaS databases
AWR, ASH, and ADDMOracle's built-in workload history, session sampling, and automatic diagnosis; ASH and AWR need the Diagnostics Pack license
SQL Server Query Store and DMVsQuery history, plan changes, and live server state
PostgreSQL pg_stat_* viewsActivity, statistics, and pg_stat_statements query history
MySQL Performance SchemaDetailed query, wait, and resource statistics

Cloud-native tools

CloudDatabase monitoring
AWSAmazon CloudWatch metrics, logs, and alarms; CloudWatch Database Insights for database load, waits, and top SQL
AzureAzure Monitor metrics, logs, and alerts; database watcher and Query Performance Insight
OCIOCI Monitoring and Alarms; Database Management and Performance Hub; Ops Insights for capacity and SQL trends

These are the quickest place to start for cloud databases: no agents to install, and metrics are collected automatically.

Open source tools

Prometheus
The most widely used open source metrics system. It regularly scrapes metrics from exporters, small programs that read a system's statistics and publish them, stores them as time series, and evaluates alert rules. Exporters exist for Oracle (including Oracle's own database metrics exporter), PostgreSQL, MySQL, SQL Server, and the operating system.
Grafana
The leading open source dashboard tool, which charts data from Prometheus, cloud services, databases, logs, and many other sources on one screen.
Loki and Elasticsearch
Stores for logs, such as the Oracle alert log or PostgreSQL logs, searchable alongside metrics.
OpenTelemetry
The open standard and collector for metrics, logs, and traces, sending data to any backend.
Percona Monitoring and Management (PMM)
A ready-made open source platform for MySQL, PostgreSQL, and MongoDB, with query analytics.
Zabbix
A long-established open source monitoring platform, common for server and database checks in enterprises.

Here's how a custom metric and an alert look in a Prometheus setup. The Oracle exporter runs a query and publishes the result as a metric:

# custom-metrics.toml: publish how full each tablespace is
[[metric]]
context = "tablespace"
labels = ["tablespace"]
metricsdesc = { used_pct = "Percent of the tablespace in use" }
request = "SELECT tablespace_name AS tablespace, used_percent AS used_pct FROM dba_tablespace_usage_metrics"

A Prometheus alert rule then fires if a tablespace stays over 90% full for 15 minutes, with a link to the runbook:

# alerts/oracle.yml
groups:
  - name: oracle
    rules:
      - alert: TablespaceAlmostFull
        expr: oracledb_tablespace_used_pct > 90
        for: 15m
        labels:
          severity: warning
        annotations:
          summary: "{{ $labels.tablespace }} on {{ $labels.instance }} is {{ $value }}% full"
          runbook_url: https://wiki.acme.local/runbooks/tablespace-full

Commercial observability platforms

PlatformKnown for
DatadogFull-stack observability with Database Monitoring, linking traces to query plans
Dynatrace, New RelicApplication performance monitoring that follows requests into database calls
SolarWinds Database Performance AnalyzerWait-time analysis across Oracle, SQL Server, and others
Redgate Monitor, Quest FoglightDatabase-focused monitoring, popular with SQL Server and Oracle teams

Alerting and on-call

Alerts need to reach the right person, at the right time, with the right urgency. PagerDuty, Grafana OnCall, and the incident features of Jira Service Management and ServiceNow manage on-call rotas, escalations, and acknowledgments, and post updates to Slack or Teams. (Atlassian's Opsgenie is being folded into Jira Service Management.)

Choosing tools

  • Start with what you have: cloud-native tools and the database's own views cost nothing extra and cover the basics.
  • Add a shared view when you need many databases, or applications and databases, on one screen: Grafana with Prometheus, or a commercial platform.
  • Prefer open standards, such as OpenTelemetry and Prometheus, to avoid being locked into one vendor.
  • Watch the cost of commercial platforms, which often charge per host or per amount of data, and can grow quickly.

Key takeaways

  • A monitoring stack has layers: sources, collection, storage, visualization, alerting, and action.
  • Database vendors provide deep tools, such as OEM, AWR, Query Store, and pg_stat_statements.
  • Cloud-native tools, such as CloudWatch, Azure Monitor, and OCI Monitoring, are the easiest start for cloud databases.
  • Prometheus with exporters, and Grafana, are the open source standard; commercial platforms such as Datadog and Dynatrace offer full-stack views.
  • PagerDuty and similar tools get alerts to the right person, with escalation.