Add pg-status: PostgreSQL instance monitoring utility - #26
Open
gpas45 wants to merge 2 commits into
Open
Conversation
…state Read-only tool that discovers PostgreSQL and Postgres Pro 1C instances on the host (both the postgrespro-<ver>[@PORT] scheme and Debian's postgresql@<ver>-<cluster>) and prints, per instance: running/stopped status, port, data directory and its on-disk size, plus — when running — version, uptime, connections, total database weight, cache hit ratio, commit/rollback and a size-sorted list of databases. Standard library only; connects via psql peer-auth as postgres. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KVXrszT51udmuntdfAHMVo
…o-diag.sh The Lint workflow was failing on main (SC2318, SC2034, SC2010), which blocked CI on this branch too. Split multi-variable local declarations so dependent assignments take effect, drop the unused tmpl capture, and replace `ls | grep` with a glob loop. No behaviour change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KVXrszT51udmuntdfAHMVo
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
Add
pg-status, a read-only Go utility for monitoring PostgreSQL and Postgres Pro instances on a host. The tool discovers instances via systemd, reports their status, and collects detailed statistics from running servers.Key Changes
New utility:
pgsql/pg-status/main.go— complete implementation with ~574 linespsql: version, uptime, connections, database sizes, cache hit ratio, transaction countsNO_COLORsupport-pflag) for non-systemd scenariosrunuser/sudo) orpostgresuser for peer authenticationDocumentation:
pgsql/pg-status/README.md— usage guide with examples and dependenciesTests:
pgsql/pg-status/main_test.go— unit tests for utility functions (human,duration,engineLabel,unitBin)Module file:
pgsql/pg-status/go.mod— Go module definition (no external dependencies, uses only stdlib)Index update:
pgsql/README.md— added reference to new utilityNotable Implementation Details
ss, postgresql.conf, PGPORT environment variable)https://claude.ai/code/session_01KVXrszT51udmuntdfAHMVo