Skip to content
Rowsafe
Docs

Monitoring and alerts

What the agent collects, the built-in alert rules, and how to send alerts to email, Slack, Discord or a webhook.

Rowsafe watches the databases it protects, with no monitoring stack of your own. The agent collects database and server metrics every minute, and Rowsafe graphs them in the dashboard, evaluates alert rules and notifies you.

What the agent collects

Every 60 seconds the agent opens one short session (rowsafe-agent-monitor) over the Unix socket and runs a few cheap catalog queries. Each query has a 2-second timeout, so on a struggling server you get a gap in the graphs, never a pile-up of monitoring queries. Monitoring never blocks a backup, drill or restore point.

Privacy

  • pg_stat_statements text is normalized by PostgreSQL: literal values become $1, $2.
  • Activity query text is not normalized: it is the statement as the client sent it, which can include personal data. Set ROWSAFE_COLLECT_QUERY_TEXT=false in /etc/rowsafe/agent.env to send activity without query text.
  • A statement that looks like it carries a password (CREATE ROLE ... PASSWORD, password= in a connection string, and similar) is redacted on your server before it is sent.
  • ROWSAFE_MONITORING=false turns monitoring off. The agent then sends only heartbeats and task results.

Retention

ResolutionKept for
1 minute48 hours
5 minutes14 days
1 hour90 days

Resolved alerts are kept 90 days, and sent notifications 30 days.

Alert rules

Rowsafe checks every rule every 30 seconds. A condition must hold for the rule's for duration before the alert fires.

RuleSeverityDefault thresholdForFires when
backup_stalecritical26 hours15mNo successful backup in the threshold, or an active database was never backed up after 12 hours.
full_backup_stalewarning8 days15mNo successful full backup in the threshold.
drill_failedwarningThe latest restore drill failed.
drill_overduewarning8 days15mNo restore drill passed in the threshold.
wal_archiving_failingcritical10mArchiving keeps failing. Point-in-time recovery stops at the last archived segment, and pg_wal grows.
postgres_unreachablecritical5mThe agent is up but can't query PostgreSQL.
agent_offlinecritical5 minutes1mNo heartbeat from the agent.
restore_point_unconfirmedwarning15mA restore point was written but archiving hasn't moved past it.
awaiting_restartwarning24 hoursA plan was applied, but PostgreSQL wasn't restarted.
disk_free_lowwarning15%5mFree disk on the data directory's filesystem below the threshold.
disk_free_criticalcritical5%5mSame, lower threshold.
connections_highwarning80%5mConnections above the share of max_connections.
connections_criticalcritical95%2mSame, higher threshold.
long_transactionwarning30 minutesA transaction has been open longer than the threshold.
idle_in_transactionwarning10 minutesA session sat idle in an open transaction longer than the threshold.
xid_wraparoundcritical50%Transaction ID headroom below the threshold.
replication_slot_inactivewarning1 GiB15mAn inactive replication slot holds back more WAL than the threshold.
deadlockswarning5More deadlocks than the threshold in 10 minutes.
cache_hit_lowinfo90%30mCache hit ratio below the threshold with real read traffic.

Critical means recoverability or availability is degrading now. Warning needs attention within a working day. Info is for the record.

You can turn each rule off, or change its threshold, duration and severity, in the dashboard under Alerts (admins). rowsafe alerts rules lists the rules with your settings.

How alerts behave

  • There is at most one open alert per rule and target. When the condition clears, the alert resolves and you are notified.
  • A critical alert that keeps firing is sent again every 4 hours until someone acknowledges it. Acknowledging stops the reminders; you still hear when it resolves.
  • No data is not good news. Without fresh metrics, an alert keeps its state. A silent agent raises agent_offline rather than resolving a disk alert.
rowsafe alerts                # firing alerts (--all adds resolved ones, --resolved shows only those)
rowsafe alerts ack alr_...    # acknowledge: no more reminders

Notification channels

Each channel has a minimum severity (default warning): it receives alerts of that severity and above. Every message says what is wrong, where, since when, the value and threshold, the next step (usually a rowsafe command) and a link to the dashboard.

rowsafe channels add --type email --name oncall --address [email protected] --min-severity critical
rowsafe channels add --type slack --name team --url https://hooks.slack.com/services/T000/B000/XXXX
rowsafe channels add --type discord --name ops --url https://discord.com/api/webhooks/...
rowsafe channels add --type webhook --name pager --url https://hooks.example.com/rowsafe
rowsafe channels test chn_...
rowsafe channels list
rowsafe channels remove chn_...
TypeDestinationNotes
emailUp to 20 addresses (repeat --address)Plain text.
slackA Slack incoming webhook
discordA Discord webhookMentions are off, so nobody is pinged.
webhookAny public https URLJSON, signed. The signing secret is printed once. See Webhooks.
  • channels test sends a test notification right away, whatever the minimum severity.
  • URLs are secrets: Rowsafe never shows them again in full.
  • An organization can have up to 20 channels. You can also manage them in the dashboard under Settings, then Notifications.
Edit on GitHub