diff --git a/.bonsai.yml b/.bonsai.yml index 8562dbe..cd062dd 100644 --- a/.bonsai.yml +++ b/.bonsai.yml @@ -36,16 +36,7 @@ builds: - "entity.system.arch == 'amd64'" - "entity.system.platform_family == 'rhel'" - "entity.system.platform_version.split('.')[0] == '7'" -- platform: "debian7" - arch: "amd64" - asset_filename: "#{repo}_#{version}_debian_linux_amd64.tar.gz" - sha_filename: "#{repo}_#{version}_sha512-checksums.txt" - filter: - - "entity.system.os == 'linux'" - - "entity.system.arch == 'amd64'" - - "entity.system.platform_family == 'debian'" - - "entity.system.platform_version.split('.')[0] == '7'" -- platform: "debian8" +- platform: "debian" arch: "amd64" asset_filename: "#{repo}_#{version}_debian_linux_amd64.tar.gz" sha_filename: "#{repo}_#{version}_sha512-checksums.txt" @@ -53,7 +44,6 @@ builds: - "entity.system.os == 'linux'" - "entity.system.arch == 'amd64'" - "entity.system.platform_family == 'debian'" - - "entity.system.platform_version.split('.')[0] == '8'" - platform: "debian9" arch: "amd64" asset_filename: "#{repo}_#{version}_debian9_linux_amd64.tar.gz" @@ -63,11 +53,4 @@ builds: - "entity.system.arch == 'amd64'" - "entity.system.platform_family == 'debian'" - "entity.system.platform_version.split('.')[0] == '9'" -- platform: "debian" - arch: "amd64" - asset_filename: "#{repo}_#{version}_debian_linux_amd64.tar.gz" - sha_filename: "#{repo}_#{version}_sha512-checksums.txt" - filter: - - "entity.system.os == 'linux'" - - "entity.system.arch == 'amd64'" - - "entity.system.platform_family == 'debian'" + diff --git a/.travis.yml b/.travis.yml index 56b17d7..11f8c07 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ script: - gem build sensu-plugins-postgres.gemspec - gem install sensu-plugins-postgres-*.gem before_deploy: -- bash -c "[ ! -d bonsai/ ] && git clone https://github.com/sensu/sensu-go-bonsai-asset.git bonsai || echo 'bonsai/ exists, skipping git clone' ; cp asset_build_scripts/Dockerfile.* bonsai/ruby-runtime/" +- bash -c "[ ! -d bonsai/ ] && git clone https://github.com/sensu/sensu-go-bonsai-asset.git bonsai || echo 'bonsai/ exists, skipping git clone' ; cp asset_build_scripts/Dockerfile.* bonsai/ruby26-runtime/" deploy: - provider: rubygems api_key: @@ -36,7 +36,7 @@ deploy: rvm: 2.4.1 repo: sensu-plugins/sensu-plugins-postgres - provider: script - script: bonsai/ruby-runtime/travis-build-ruby-plugin-assets.sh sensu-plugins-postgres + script: bonsai/ruby26-runtime/travis-build-ruby-plugin-assets.sh sensu-plugins-postgres skip_cleanup: true on: tags: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ffcda1..90d98a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ This project adheres to [Semantic Versioning](http://semver.org/). This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md). ## [Unreleased] + +### Breaking Changes +- Updated asset builds to use ruby26-runtime +- Update asset builds to use libpg v12, to ensue compatibility with SCRAM password authentication introduced in postgresl 10 + +### Fixed +- Standardize on 10 second integer for timeout option to ensure working defaults with libpg. Newer libpg libraries don't like the nil default, treats it as a string and errors out. + ## [4.3.0] - 2021-09-15 ### Added diff --git a/README.md b/README.md index 0486c52..0af221e 100644 --- a/README.md +++ b/README.md @@ -80,19 +80,26 @@ 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. + ## Installation +### Sensu Go Asset Installation -``` -gem install sensu-plugins-postgres -``` +Assets are the best way to make use of this plugin in Sensu Go. If you're not using an asset, please consider doing so! If you're using sensuctl 5.13 or later, you can use the following command to add the asset: -## Centos installation +sensuctl asset add sensu-plugins/sensu-plugins-postgresl -``` -yum -y install gcc ruby-devel rubygems postgresql-devel -sensu-install -p sensu-plugins-postgres +If you're using an earlier version of sensuctl, you can download the asset definition from this project's Bonsai Asset Index page. + +Note: as of version 4.0.0 the plugin assets are built using the sensu-ruby26-runtime, and will also require that you have the sensu-ruby26-runtime asset and installed as part of the check configuration. + + +### Gem Installation +If you are unable to use the provided Sensu asset package, you can install this plugin via rubygems on a system that have ruby available. ``` +gem install sensu-plugins-postgres +``` + See [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html) for details. diff --git a/asset_build_scripts/Dockerfile.alpine b/asset_build_scripts/Dockerfile.alpine index dd62937..f09ea90 100644 --- a/asset_build_scripts/Dockerfile.alpine +++ b/asset_build_scripts/Dockerfile.alpine @@ -1,15 +1,15 @@ -FROM sensu/sensu-ruby-runtime-2.4.4-alpine:latest as builder +FROM sensu/sensu-ruby-runtime-2.6.7-alpine:latest as builder ARG ASSET_GEM ARG GIT_REF ARG GIT_REPO -ARG RUBY_VERSION=2.4.4 +ARG RUBY_VERSION=2.6.7 WORKDIR /assets/build/ RUN apk del openssl-dev +RUN apk upgrade RUN apk add git RUN apk add libressl-dev postgresql-client postgresql-dev RUN \ - gem install --no-ri --no-doc bundler && \ printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile RUN bundle install --path=lib/ --binstubs=bin/ --standalone diff --git a/asset_build_scripts/Dockerfile.alpine3.8 b/asset_build_scripts/Dockerfile.alpine3.8 index d6cf129..bd60b4e 100644 --- a/asset_build_scripts/Dockerfile.alpine3.8 +++ b/asset_build_scripts/Dockerfile.alpine3.8 @@ -1,15 +1,14 @@ -FROM sensu/sensu-ruby-runtime-2.4.4-alpine3.8:latest as builder +FROM sensu/sensu-ruby-runtime-2.6.7-alpine3.8:latest as builder ARG ASSET_GEM ARG GIT_REF ARG GIT_REPO -ARG RUBY_VERSION=2.4.4 +ARG RUBY_VERSION=2.6.7 WORKDIR /assets/build/ RUN apk del openssl-dev RUN apk add git RUN apk add libressl-dev postgresql-client postgresql-dev RUN \ - gem install --no-ri --no-doc bundler && \ printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile RUN bundle install --path=lib/ --binstubs=bin/ --standalone diff --git a/asset_build_scripts/Dockerfile.amzn1 b/asset_build_scripts/Dockerfile.amzn1 new file mode 100644 index 0000000..0446c26 --- /dev/null +++ b/asset_build_scripts/Dockerfile.amzn1 @@ -0,0 +1,25 @@ +FROM sensu/sensu-ruby-runtime-2.6.7-amzn1:latest as builder +ARG ASSET_GEM +ARG GIT_REF +ARG GIT_REPO +ARG GREP_EXCLUDE='(ld.so|ld-linux-x86-64.so|libBrokenLocale.so|libSegFault.so|libanl.so|libc.so|libdl.so|libm.so|libmvec.so|libnss_compat.so|libnss_dns.so|libnss_files.so|libpthread.so|libresolv.so|librt.so|libthread_db.so|libutil.so|vdso.so)' +ARG RUBY_VERSION=2.6.7 + +WORKDIR /assets/build/ +RUN yum install -y git +RUN yum install -y https://download.postgresql.org/pub/repos/yum/12/redhat/rhel-6-x86_64/postgresql12-devel-12.8-1PGDG.rhel6.x86_64.rpm \ + https://download.postgresql.org/pub/repos/yum/12/redhat/rhel-6-x86_64/postgresql12-libs-12.8-1PGDG.rhel6.x86_64.rpm \ + https://download.postgresql.org/pub/repos/yum/12/redhat/rhel-6-x86_64/postgresql12-12.8-1PGDG.rhel6.x86_64.rpm +ENV CONFIGURE_ARGS="with-pg-config=/usr/pgsql-12/bin/pg_config" +RUN \ + printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile +RUN bundle install --path=lib/ --binstubs=bin/ --standalone + +RUN LIBS=$(find ./ -type f -executable -exec ldd {} 2>/dev/null \;| grep "=>" | egrep -v ${GREP_EXCLUDE} | awk '{print $3}'| sort -u ) && \ + for f in $LIBS; do if [ -e $f ] && [ ! -e /opt/rubies/ruby-${RUBY_VERSION}/lib/$f ] ; then echo "Copying Library: $f" && cp $f ./lib/; fi; done + +RUN tar -czf /assets/${ASSET_GEM}.tar.gz -C /assets/build/ . + +FROM scratch +ARG ASSET_GEM +COPY --from=builder /assets/${ASSET_GEM}.tar.gz / diff --git a/asset_build_scripts/Dockerfile.centos b/asset_build_scripts/Dockerfile.amzn2 similarity index 71% rename from asset_build_scripts/Dockerfile.centos rename to asset_build_scripts/Dockerfile.amzn2 index 575910a..ef0b870 100644 --- a/asset_build_scripts/Dockerfile.centos +++ b/asset_build_scripts/Dockerfile.amzn2 @@ -1,17 +1,16 @@ -FROM sensu/sensu-ruby-runtime-2.4.4-centos:latest as builder +FROM sensu/sensu-ruby-runtime-2.6.7-amzn2:latest as builder ARG ASSET_GEM ARG GIT_REF ARG GIT_REPO ARG GREP_EXCLUDE='(ld.so|ld-linux-x86-64.so|libBrokenLocale.so|libSegFault.so|libanl.so|libc.so|libdl.so|libm.so|libmvec.so|libnss_compat.so|libnss_dns.so|libnss_files.so|libpthread.so|libresolv.so|librt.so|libthread_db.so|libutil.so|vdso.so)' -ARG RUBY_VERSION=2.4.4 +ARG RUBY_VERSION=2.6.7 WORKDIR /assets/build/ +RUN amazon-linux-extras install postgresql12 epel -y RUN yum install -y git -RUN yum install -y https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm -RUN yum install -y postgresql95 postgresql95-libs postgresql95-devel -ENV CONFIGURE_ARGS="with-pg-config=/usr/pgsql-9.5/bin/pg_config" +RUN yum install -y postgresql-devel +ENV CONFIGURE_ARGS="with-pg-config=/usr/pgsql-12/bin/pg_config" RUN \ - gem install --no-ri --no-doc bundler && \ printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile RUN bundle install --path=lib/ --binstubs=bin/ --standalone diff --git a/asset_build_scripts/Dockerfile.centos6 b/asset_build_scripts/Dockerfile.centos6 index 8b09c28..446fa0d 100644 --- a/asset_build_scripts/Dockerfile.centos6 +++ b/asset_build_scripts/Dockerfile.centos6 @@ -1,18 +1,18 @@ -FROM sensu/sensu-ruby-runtime-2.4.4-centos6:latest as builder +FROM sensu/sensu-ruby-runtime-2.6.7-centos6:latest as builder ARG ASSET_GEM ARG GIT_REF ARG GIT_REPO ARG GREP_EXCLUDE='(ld.so|ld-linux-x86-64.so|libBrokenLocale.so|libSegFault.so|libanl.so|libc.so|libdl.so|libm.so|libmvec.so|libnss_compat.so|libnss_dns.so|libnss_files.so|libpthread.so|libresolv.so|librt.so|libthread_db.so|libutil.so|vdso.so)' -ARG RUBY_VERSION=2.4.4 +ARG RUBY_VERSION=2.6.7 WORKDIR /assets/build/ RUN curl https://www.getpagespeed.com/files/centos6-eol.repo --output /etc/yum.repos.d/CentOS-Base.repo RUN yum install -y git -RUN yum install -y https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-6-x86_64/pgdg-redhat-repo-latest.noarch.rpm -RUN yum install -y postgresql95 postgresql95-libs postgresql95-devel -ENV CONFIGURE_ARGS="with-pg-config=/usr/pgsql-9.5/bin/pg_config" +RUN yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-6-x86_64/pgdg-redhat-repo-latest.noarch.rpm +RUN yum repolist +RUN yum install -y postgresql12 postgresql12-libs postgresql12-devel +ENV CONFIGURE_ARGS="with-pg-config=/usr/pgsql-12/bin/pg_config" RUN \ - gem install --no-ri --no-doc bundler && \ printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile RUN bundle install --path=lib/ --binstubs=bin/ --standalone diff --git a/asset_build_scripts/Dockerfile.centos7 b/asset_build_scripts/Dockerfile.centos7 index 6191ceb..3a1dcfb 100644 --- a/asset_build_scripts/Dockerfile.centos7 +++ b/asset_build_scripts/Dockerfile.centos7 @@ -1,17 +1,18 @@ -FROM sensu/sensu-ruby-runtime-2.4.4-centos7:latest as builder +FROM sensu/sensu-ruby-runtime-2.6.7-centos7:latest as builder ARG ASSET_GEM ARG GIT_REF ARG GIT_REPO ARG GREP_EXCLUDE='(ld.so|ld-linux-x86-64.so|libBrokenLocale.so|libSegFault.so|libanl.so|libc.so|libdl.so|libm.so|libmvec.so|libnss_compat.so|libnss_dns.so|libnss_files.so|libpthread.so|libresolv.so|librt.so|libthread_db.so|libutil.so|vdso.so)' -ARG RUBY_VERSION=2.4.4 +ARG RUBY_VERSION=2.6.7 WORKDIR /assets/build/ -RUN yum install -y git -RUN yum install -y https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm -RUN yum install -y postgresql95 postgresql95-libs postgresql95-devel -ENV CONFIGURE_ARGS="with-pg-config=/usr/pgsql-9.5/bin/pg_config" +RUN yum install -y git epel-release centos-release-scl +RUN curl https://download.postgresql.org/pub/repos/yum/RPM-GPG-KEY-PGDG --output /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG +RUN yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm +RUN yum install -y postgresql12 postgresql12-libs postgresql12-devel +ENV CONFIGURE_ARGS="with-pg-config=/usr/pgsql-12/bin/pg_config" + RUN \ - gem install --no-ri --no-doc bundler && \ printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile RUN bundle install --path=lib/ --binstubs=bin/ --standalone diff --git a/asset_build_scripts/Dockerfile.debian b/asset_build_scripts/Dockerfile.debian index 6697338..3ae6bc2 100644 --- a/asset_build_scripts/Dockerfile.debian +++ b/asset_build_scripts/Dockerfile.debian @@ -1,15 +1,17 @@ -FROM sensu/sensu-ruby-runtime-2.4.4-debian:latest as builder +FROM sensu/sensu-ruby-runtime-2.6.7-debian:latest as builder ARG ASSET_GEM ARG GIT_REF ARG GIT_REPO ARG GREP_EXCLUDE='(ld.so|ld-linux-x86-64.so|libBrokenLocale.so|libSegFault.so|libanl.so|libc.so|libdl.so|libm.so|libmvec.so|libnss_compat.so|libnss_dns.so|libnss_files.so|libpthread.so|libresolv.so|librt.so|libthread_db.so|libutil.so|vdso.so)' -ARG RUBY_VERSION=2.4.4 +ARG RUBY_VERSION=2.6.7 WORKDIR /assets/build/ -RUN apt-get update && apt-get install -y git -RUN apt-get install -y libpq-dev +RUN apt-get update && apt-get install -y git wget +RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - +RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" |tee /etc/apt/sources.list.d/pgdg.list +RUN apt update +RUN apt-get install -y libpq5 libpq-dev RUN \ - gem install --no-ri --no-doc bundler && \ printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile RUN bundle install --path=lib/ --binstubs=bin/ --standalone diff --git a/asset_build_scripts/Dockerfile.debian9 b/asset_build_scripts/Dockerfile.debian9 index 5909599..61a2784 100644 --- a/asset_build_scripts/Dockerfile.debian9 +++ b/asset_build_scripts/Dockerfile.debian9 @@ -1,15 +1,17 @@ -FROM sensu/sensu-ruby-runtime-2.4.4-debian9:latest as builder +FROM sensu/sensu-ruby-runtime-2.6.7-debian9:latest as builder ARG ASSET_GEM ARG GIT_REF ARG GIT_REPO ARG GREP_EXCLUDE='(ld.so|ld-linux-x86-64.so|libBrokenLocale.so|libSegFault.so|libanl.so|libc.so|libdl.so|libm.so|libmvec.so|libnss_compat.so|libnss_dns.so|libnss_files.so|libpthread.so|libresolv.so|librt.so|libthread_db.so|libutil.so|vdso.so)' -ARG RUBY_VERSION=2.4.4 +ARG RUBY_VERSION=2.6.7 WORKDIR /assets/build/ -RUN apt-get update && apt-get install -y git +RUN apt-get update && apt-get install -y git wget +RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - +RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" |tee /etc/apt/sources.list.d/pgdg.list +RUN apt update RUN apt-get install -y libpq-dev RUN \ - gem install --no-ri --no-doc bundler && \ printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile RUN bundle install --path=lib/ --binstubs=bin/ --standalone diff --git a/bin/check-postgres-alive.rb b/bin/check-postgres-alive.rb index 00d35c6..ffc338b 100755 --- a/bin/check-postgres-alive.rb +++ b/bin/check-postgres-alive.rb @@ -69,7 +69,8 @@ class CheckPostgres < Sensu::Plugin::Check::CLI description: 'Connection timeout (seconds)', short: '-T TIMEOUT', long: '--timeout TIMEOUT', - default: nil + default: 10, + proc: proc(&:to_i) include Pgpass diff --git a/bin/check-postgres-connections.rb b/bin/check-postgres-connections.rb index 8255d92..e81b8bc 100755 --- a/bin/check-postgres-connections.rb +++ b/bin/check-postgres-connections.rb @@ -95,7 +95,8 @@ class CheckPostgresConnections < Sensu::Plugin::Check::CLI description: 'Connection timeout (seconds)', short: '-T TIMEOUT', long: '--timeout TIMEOUT', - default: nil + default: 10, + proc: proc(&:to_i) include Pgpass diff --git a/bin/check-postgres-query.rb b/bin/check-postgres-query.rb index 64202fe..7389be3 100755 --- a/bin/check-postgres-query.rb +++ b/bin/check-postgres-query.rb @@ -103,7 +103,8 @@ class CheckPostgresQuery < Sensu::Plugin::Check::CLI description: 'Connection timeout (seconds)', short: '-T TIMEOUT', long: '--timeout TIMEOUT', - default: nil + default: 10, + proc: proc(&:to_i) include Pgpass diff --git a/bin/check-postgres-replication.rb b/bin/check-postgres-replication.rb index 41bd994..37d26f7 100755 --- a/bin/check-postgres-replication.rb +++ b/bin/check-postgres-replication.rb @@ -97,7 +97,7 @@ class CheckPostgresReplicationStatus < Sensu::Plugin::Check::CLI option(:timeout, short: '-T TIMEOUT', long: '--timeout=TIMEOUT', - default: 2, + default: 10, description: 'Connection timeout (seconds)', proc: proc(&:to_i)) diff --git a/bin/metric-postgres-connections.rb b/bin/metric-postgres-connections.rb index 215fa75..5d5b5c2 100755 --- a/bin/metric-postgres-connections.rb +++ b/bin/metric-postgres-connections.rb @@ -76,7 +76,8 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite description: 'Connection timeout (seconds)', short: '-T TIMEOUT', long: '--timeout TIMEOUT', - default: nil + default: 10, + proc: proc(&:to_i) include Pgpass diff --git a/bin/metric-postgres-dbsize.rb b/bin/metric-postgres-dbsize.rb index cf72aa2..95fa318 100755 --- a/bin/metric-postgres-dbsize.rb +++ b/bin/metric-postgres-dbsize.rb @@ -76,7 +76,8 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite description: 'Connection timeout (seconds)', short: '-T TIMEOUT', long: '--timeout TIMEOUT', - default: nil + default: 10, + proc: proc(&:to_i) include Pgpass diff --git a/bin/metric-postgres-graphite.rb b/bin/metric-postgres-graphite.rb index 64a01d3..8f820e0 100755 --- a/bin/metric-postgres-graphite.rb +++ b/bin/metric-postgres-graphite.rb @@ -88,7 +88,8 @@ class CheckpostgresReplicationStatus < Sensu::Plugin::Metric::CLI::Graphite description: 'Connection timeout (seconds)', short: '-T TIMEOUT', long: '--timeout TIMEOUT', - default: nil + default: 10, + proc: proc(&:to_i) include Pgpass include PgUtil diff --git a/bin/metric-postgres-locks.rb b/bin/metric-postgres-locks.rb index 311b806..ffc6533 100755 --- a/bin/metric-postgres-locks.rb +++ b/bin/metric-postgres-locks.rb @@ -76,7 +76,8 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite description: 'Connection timeout (seconds)', short: '-T TIMEOUT', long: '--timeout TIMEOUT', - default: nil + default: 10, + proc: proc(&:to_i) include Pgpass diff --git a/bin/metric-postgres-relation-size.rb b/bin/metric-postgres-relation-size.rb index efd2b05..0acafcc 100755 --- a/bin/metric-postgres-relation-size.rb +++ b/bin/metric-postgres-relation-size.rb @@ -76,7 +76,8 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite description: 'Connection timeout (seconds)', short: '-T TIMEOUT', long: '--timeout TIMEOUT', - default: nil + default: 10, + proc: proc(&:to_i) option :limit, description: 'Limit query to this many results', diff --git a/bin/metric-postgres-statsbgwriter.rb b/bin/metric-postgres-statsbgwriter.rb index 01e83f9..35aba10 100755 --- a/bin/metric-postgres-statsbgwriter.rb +++ b/bin/metric-postgres-statsbgwriter.rb @@ -71,7 +71,8 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite description: 'Connection timeout (seconds)', short: '-T TIMEOUT', long: '--timeout TIMEOUT', - default: nil + default: 10, + proc: proc(&:to_i) include Pgpass diff --git a/bin/metric-postgres-statsdb.rb b/bin/metric-postgres-statsdb.rb index d34031a..0e7a09c 100755 --- a/bin/metric-postgres-statsdb.rb +++ b/bin/metric-postgres-statsdb.rb @@ -85,7 +85,8 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite description: 'Connection timeout (seconds)', short: '-T TIMEOUT', long: '--timeout TIMEOUT', - default: nil + default: 10, + proc: proc(&:to_i) include Pgpass diff --git a/bin/metric-postgres-statsio.rb b/bin/metric-postgres-statsio.rb index 291b8db..1faf8d6 100755 --- a/bin/metric-postgres-statsio.rb +++ b/bin/metric-postgres-statsio.rb @@ -83,7 +83,8 @@ class PostgresStatsIOMetrics < Sensu::Plugin::Metric::CLI::Graphite description: 'Connection timeout (seconds)', short: '-T TIMEOUT', long: '--timeout TIMEOUT', - default: nil + default: 10, + proc: proc(&:to_i) include Pgpass diff --git a/bin/metric-postgres-statstable.rb b/bin/metric-postgres-statstable.rb index ec537f2..85080bb 100755 --- a/bin/metric-postgres-statstable.rb +++ b/bin/metric-postgres-statstable.rb @@ -83,7 +83,8 @@ class PostgresStatsTableMetrics < Sensu::Plugin::Metric::CLI::Graphite description: 'Connection timeout (seconds)', short: '-T TIMEOUT', long: '--timeout TIMEOUT', - default: nil + default: 10, + proc: proc(&:to_i) include Pgpass diff --git a/bin/metric-postgres-vaccum.rb b/bin/metric-postgres-vaccum.rb index a433d47..8e1b164 100755 --- a/bin/metric-postgres-vaccum.rb +++ b/bin/metric-postgres-vaccum.rb @@ -72,7 +72,8 @@ class PostgresVacuumDBMetrics < Sensu::Plugin::Metric::CLI::Graphite description: 'Connection timeout (seconds)', short: '-T TIMEOUT', long: '--timeout TIMEOUT', - default: nil + default: 10, + proc: proc(&:to_i) include Pgpass diff --git a/bin/metrics-postgres-query.rb b/bin/metrics-postgres-query.rb index 675f534..c356b60 100755 --- a/bin/metrics-postgres-query.rb +++ b/bin/metrics-postgres-query.rb @@ -95,7 +95,8 @@ class MetricsPostgresQuery < Sensu::Plugin::Metric::CLI::Graphite description: 'Connection timeout (seconds)', short: '-T TIMEOUT', long: '--timeout TIMEOUT', - default: nil + default: 10, + proc: proc(&:to_i) include Pgpass