License
MIT License
forked from jspaleta/sensu-plugins-postgres
v4.1.1 · public · Published about 4 years ago
Use --help
to see command arguments.
$ check-postgres-alive.rb -d template1 -f /var/lib/postgresql/.pgpass
CheckPostgres OK: Server version: {"version"=>"PostgreSQL 9.6.3 on x86_64-pc-linux-gnu, compiled by gcc (Debian 4.9.2-10) 4.9.2, 64-bit"}
$ check-postgres-replication.rb -m psql1.local -s psql2.local -d template1 -w 5 -c 10
CheckPostgresReplicationStatus OK: replication delayed by 0.0MB :: master:B0/B4031000 slave:B0/B4031000 m_segbytes:16777216
$ export PGPASSWORD=this-is-secret-password
$ check-postgres-connections.rb -a -w 80 -c 90 -d template1 -u sensu
CheckPostgresConnections OK: PostgreSQL connections under threshold: 17%, 174 out of 997 connections
Argument | Env variable | Value |
---|---|---|
-f, --pgpass | PGPASSFILE | ~/.pgpass |
-h, --hostname | PGHOST | localhost |
-P, --port | PGPORT | 5432 |
-d, --database | PGDATABASE | postgres |
-u, --user | PGUSER | postgres |
-p, --password | PGPASSWORD |
Options precedence is following:
When file ~/.pgpass
is found it is used by default. You can also use -f, --pgpass
command line argument or set PGPASSFILE
env variable.
File format is:
hostname:port:database:username:password
Only first line is used. If database is set to *
it is ommited.
You can ovveride pgpass
values with command line arguments, e.g. -h
for hostname.
gem install sensu-plugins-postgres
yum -y install gcc ruby-devel rubygems postgresql-devel
sensu-install -p sensu-plugins-postgres
See Installation and Setup for details.
When using Sensu with EMBEDDED_RUBY=true
and installing Postgres checks with /usr/bin/sensu-install -p sensu-plugins-postgres
you might get following error:
ERROR: Error installing sensu-plugins-postgres:
ERROR: Failed to build gem native extension.
[...]
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
The 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
.
Checks are in /usr/local/bin
directory.
Please describe the reason for reporting this asset. Our moderators will be notified and will disable the asset if it is found to be inappropriate.
×