docs(config): document monitored-database user privileges - #380
Open
dpage wants to merge 1 commit into
Open
Conversation
The configuration docs covered only the datastore role, so there was
no guidance on what a monitoring role needs on a monitored instance;
a prospect asked and we had no answer. The new page recommends a
least-privilege role built on pg_monitor plus per-database CONNECT,
and is linked from the collector README, the collector and connection
configuration pages, and the probe reference.
The grants were derived by auditing the probes against the code and
the PostgreSQL catalogue ACLs rather than from assumption, which
turned up several requirements worth stating: pg_monitor is mandatory
rather than advisable, because current_setting('data_directory')
hard-errors without pg_read_all_settings; the Spock probes read five
tables, not two; pg_stat_wal_receiver yields zero rows rather than
nulls without pg_read_all_stats; and closing the pg_hba_file_rules
and pg_ident_file_mappings gaps without superuser needs a grant on
both the view and its underlying function.
The page also documents that a missing CONNECT degrades coverage
silently, and that the MCP tools need schema and table access the
collector itself never requires.
Closes #351
WalkthroughChangesMonitored database privileges
Estimated code review effort: 2 (Simple) | ~15 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Up to standards ✅🟢 Issues
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/getting-started/configuration/monitored-database-privileges.md`:
- Around line 253-254: Shorten each added Markdown hyperlink so the complete
construct remains on one line and every affected line is at most 79 characters.
Update the links at
docs/getting-started/configuration/monitored-database-privileges.md:253-254,
collector/README.md:39-43, docs/admin-guide/connections.md:42-54 and :243-245,
and docs/developer-guide/collector/probe-reference.md:6-12, using concise valid
link aliases or destinations without splitting hyperlink syntax.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7a7ba4a1-6834-4976-9983-67d2b6e00304
📒 Files selected for processing (7)
collector/README.mddocs/admin-guide/connections.mddocs/changelog.mddocs/developer-guide/collector/probe-reference.mddocs/getting-started/configuration/collector.mddocs/getting-started/configuration/monitored-database-privileges.mdmkdocs.yml
dpage
force-pushed
the
fix/issue-351-monitor-privileges
branch
from
July 30, 2026 08:16
7e33265 to
34cc240
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
docs/getting-started/configuration/monitored-database-privileges.md,documenting the PostgreSQL privileges a monitoring role needs on a
monitored instance. The docs previously covered only the datastore
role, so a prospect asking what grants a monitoring user needs had no
answer in the repository.
pg_monitorplus per-databaseCONNECT, and documents the optionalpg_stat_statementsandsystem_statsextensions, the Spock grants, and the gaps that remainwithout superuser access.
collector/README.md, the collector and connectionconfiguration pages, and the probe reference, so it is discoverable from
the getting-started section as the issue asked.
Notes on the grants
I derived the grants by auditing the probes against the collector source
and the PostgreSQL catalogue ACLs rather than taking the issue's suggested
SQL at face value, which turned up several corrections worth flagging for
review:
pg_monitoris mandatory, not merely advisable: thepg_server_infoprobe calls
current_setting('data_directory'), which raises a harderror without
pg_read_all_settingsand fails the whole probe.pg_node_rolealso readsspock.local_node,spock.node, andspock.subscription.pg_stat_wal_receiveris definedWHERE pid IS NOT NULL, so anunprivileged role sees zero rows rather than nulls, which breaks
standby detection outright rather than blanking a column.
pg_hba_file_rulesandpg_ident_file_mappingsgaps withoutgranting superuser requires a grant on both the view and its
underlying function; the function grant is easy to miss.
pg_subscription.subconninfois superuser-only and degrades publisherhost and port detection silently.
CONNECTgrant is skipped with a logged error rather than afatal one, so it degrades coverage silently. This is the likeliest
misconfiguration, so the page calls it out explicitly.
The page also covers something the issue did not anticipate: the MCP server
reuses the same stored credentials and several of its tools do read user
data, so the AI features need
USAGEon schemas andSELECTon tables thatthe collector itself never requires. Since the Workbench's
read_writesetting is only an application-level gate, the role's own privileges are the
real backstop, which is framed as a deliberate security decision.
Test plan
mkdocs build --strictpasses with no warnings or errors, so the naventry and every cross-link resolve.
hyperlinks and the mkdocs nav path.
mkdocs.ymlor docs paths; this difftouches no code, so
lintand the Go/client suites are unaffected.workbench_monitor,myapp, aplaceholder password).
Closes #351
Summary by CodeRabbit
pg_monitorand per-databaseCONNECTaccess.