{"id":21469966,"url":"https://github.com/sensu-plugins/sensu-plugins-postgres","last_synced_at":"2025-08-21T10:31:07.312Z","repository":{"id":27165668,"uuid":"30635166","full_name":"sensu-plugins/sensu-plugins-postgres","owner":"sensu-plugins","description":"This plugin provides native PostgreSQL instrumentation for monitoring and metrics collection, including: service health, database connectivity, database locks, replication status, database size, `pg_stat_bgwriter` metrics, and more.","archived":false,"fork":false,"pushed_at":"2023-02-16T13:01:18.000Z","size":227,"stargazers_count":16,"open_issues_count":8,"forks_count":41,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-07-26T19:46:35.153Z","etag":null,"topics":["metrics","monitoring","postgresql","sensu-plugins"],"latest_commit_sha":null,"homepage":"http://sensu-plugins.io","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sensu-plugins.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-02-11T07:04:14.000Z","updated_at":"2024-04-17T10:21:22.000Z","dependencies_parsed_at":"2023-01-14T06:08:16.011Z","dependency_job_id":"80e79a24-c668-456b-9c64-d5539bdfcdac","html_url":"https://github.com/sensu-plugins/sensu-plugins-postgres","commit_stats":null,"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"purl":"pkg:github/sensu-plugins/sensu-plugins-postgres","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensu-plugins%2Fsensu-plugins-postgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensu-plugins%2Fsensu-plugins-postgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensu-plugins%2Fsensu-plugins-postgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensu-plugins%2Fsensu-plugins-postgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sensu-plugins","download_url":"https://codeload.github.com/sensu-plugins/sensu-plugins-postgres/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensu-plugins%2Fsensu-plugins-postgres/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271462693,"owners_count":24764019,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["metrics","monitoring","postgresql","sensu-plugins"],"created_at":"2024-11-23T09:19:55.960Z","updated_at":"2025-08-21T10:31:06.996Z","avatar_url":"https://github.com/sensu-plugins.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Sensu-Plugins-postgres\n\n[![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-postgres.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-postgres)\n[![Gem Version](https://badge.fury.io/rb/sensu-plugins-postgres.svg)](http://badge.fury.io/rb/sensu-plugins-postgres)\n[![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-postgres/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-postgres)\n[![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-postgres/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-postgres)\n[![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-postgres.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-postgres)\n\n## Functionality\n\n## Files\n * bin/check-postgres-alive.rb\n * bin/check-postgres-connections.rb\n * bin/metric-postgres-dbsize.rb\n * bin/metric-postgres-statsbgwriter.rb\n * bin/metric-postgres-statstable.rb\n * bin/check-postgres-replication.rb\n * bin/metric-postgres-graphite.rb\n * bin/metric-postgres-statsdb.rb\n * bin/metric-postgres-connections.rb\n * bin/metric-postgres-locks.rb\n * bin/metric-postgres-statsio.rb\n * bin/check-postgres-query.rb\n * bin/metrics-postgres-query.rb\n * bin/metric-postgres-relation-size.rb\n\n## Usage\n\nUse `--help` to see command arguments.\n\n### Sample usage\n\n#### Check if PostgreSQL is alive\n```\n$ check-postgres-alive.rb -d template1 -f /var/lib/postgresql/.pgpass\nCheckPostgres OK: Server version: {\"version\"=\u003e\"PostgreSQL 9.6.3 on x86_64-pc-linux-gnu, compiled by gcc (Debian 4.9.2-10) 4.9.2, 64-bit\"}\n```\n\n### Check replication status\n```\n$ check-postgres-replication.rb -m psql1.local -s psql2.local -d template1 -w 5 -c 10\nCheckPostgresReplicationStatus OK: replication delayed by 0.0MB :: master:B0/B4031000 slave:B0/B4031000 m_segbytes:16777216\n```\n\n### Check number of connections\n```\n$ export PGPASSWORD=this-is-secret-password\n$ check-postgres-connections.rb -a -w 80 -c 90 -d template1 -u sensu\nCheckPostgresConnections OK: PostgreSQL connections under threshold: 17%, 174 out of 997 connections\n```\n\n### Default values\n\n| Argument       | Env variable | Value     |\n|----------------|--------------|-----------|\n| -f, --pgpass   | PGPASSFILE   | ~/.pgpass |\n| -h, --hostname | PGHOST       | localhost |\n| -P, --port     | PGPORT       | 5432      |\n| -d, --database | PGDATABASE   | postgres  |\n| -u, --user     | PGUSER       | postgres  |\n| -p, --password | PGPASSWORD   |           |\n\nOptions precedence is following:\n1. command line arguments\n1. pgpass file\n1. env variables\n1. defaults\n\n### Pgpass file\n\nWhen file `~/.pgpass` is found it is used by default. You can also use `-f, --pgpass` command line argument or set `PGPASSFILE` env variable.\n\nFile format is:\n\n```\nhostname:port:database:username:password\n```\n\nOnly first line is used. If database is set to `*` it is ommited.\n\nYou can ovveride `pgpass` values with command line arguments, e.g. `-h` for hostname.\n\n## Installation\n\n```\ngem install sensu-plugins-postgres\n```\n\n## Centos installation\n\n```\nyum -y install gcc ruby-devel rubygems  postgresql-devel\nsensu-install -p sensu-plugins-postgres\n\n```\n\nSee [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html) for details.\n\n### Known issues\n\nWhen using Sensu with `EMBEDDED_RUBY=true` and installing Postgres checks with `/usr/bin/sensu-install -p sensu-plugins-postgres` you might get following error:\n\n```\nERROR:  Error installing sensu-plugins-postgres:\n\tERROR: Failed to build gem native extension.\n[...]\nchecking for PQconnectdb() in -lpq... no\nchecking for PQconnectdb() in -llibpq... no\nchecking for PQconnectdb() in -lms/libpq... no\nCan't find the PostgreSQL client library (libpq)\n*** extconf.rb failed ***\n```\n\nThe reason is that **libssl** library which comes with Sensu is incompatible with **libpq** library installed on your system. There is no easy way to fix it. You might want to install sensu-plugins-postgres globally with `gem install sensu-plugins-postgres`.\n\nChecks are in `/usr/local/bin` directory.\n\n## Notes\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsensu-plugins%2Fsensu-plugins-postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsensu-plugins%2Fsensu-plugins-postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsensu-plugins%2Fsensu-plugins-postgres/lists"}