prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium

[ Daniel Swarbrick ]
  * New upstream release.
  * Add myself to uploaders.
  * Bump minimum required version of golang-github-lib-pq to support
    SCRAM-SHA-256 authentication.
  * Update description (now supports Postgres 9.4 and up).
  * lintian: fix rules-requires-root.

  [ Debian Janitor ]
  * Set debhelper-compat version in Build-Depends.
  * Set upstream metadata fields: Bug-Database, Bug-Submit.

  [ Martina Ferrari ]
  * Update initscript.
  * Update my name.

[dgit import unpatched prometheus-postgres-exporter 0.8.0+ds-1]
This commit is contained in:
Martina Ferrari 2020-01-20 13:25:39 +01:00
commit ce4be23b88
23 changed files with 531 additions and 0 deletions

37
debian/NEWS vendored Normal file
View File

@ -0,0 +1,37 @@
prometheus-postgres-exporter (0.4.1+ds-2) unstable; urgency=medium
The daemon now accepts command-line flags with two dashes, check
your /etc/default/prometheus-postgres-exporter to avoid errors.
-- Martina Ferrari <tincho@debian.org> Thu, 14 Dec 2017 17:07:03 +0000
prometheus-postgres-exporter (0.2.0+ds-1) unstable; urgency=medium
* Major change - use pg_settings to retrieve runtime variables. Adds >180 new
metrics and descriptions (big thanks to Matt Bostock for this work).
Removes the following metrics:
pg_runtime_variable_max_connections
pg_runtime_variable_max_files_per_process
pg_runtime_variable_max_function_args
pg_runtime_variable_max_identifier_length
pg_runtime_variable_max_index_keys
pg_runtime_variable_max_locks_per_transaction
pg_runtime_variable_max_pred_locks_per_transaction
pg_runtime_variable_max_prepared_transactions
pg_runtime_variable_max_standby_archive_delay_milliseconds
pg_runtime_variable_max_standby_streaming_delay_milliseconds
pg_runtime_variable_max_wal_senders
They are replaced by equivalent names under `pg_settings` with the exception of
pg_runtime_variable_max_standby_archive_delay_milliseconds
pg_runtime_variable_max_standby_streaming_delay_milliseconds
which are replaced with
pg_settings_max_standby_archive_delay_seconds
pg_settings_max_standby_streaming_delay_seconds
-- Martina Ferrari <tincho@debian.org> Fri, 19 May 2017 21:43:00 +0000

46
debian/README.Debian vendored Normal file
View File

@ -0,0 +1,46 @@
To use the PostgreSQL exporter, you need to connect to the database with
superuser (postgres) privileges, or with an user that has been granted enough
permissions.
The recommended way to do this, is to create a `prometheus` user with no
password, and then connect using UNIX domain sockets.
To do that, set this connection string in
/etc/default/prometheus-postgres-exporter:
DATA_SOURCE_NAME='user=prometheus host=/run/postgresql dbname=postgres'
And use psql (sudo -u postgres psql) to execute these SQL commands to create
the user:
CREATE USER prometheus;
ALTER USER prometheus SET SEARCH_PATH TO prometheus,pg_catalog;
CREATE SCHEMA prometheus AUTHORIZATION prometheus;
CREATE FUNCTION prometheus.f_select_pg_stat_activity()
RETURNS setof pg_catalog.pg_stat_activity
LANGUAGE sql
SECURITY DEFINER
AS $$
SELECT * from pg_catalog.pg_stat_activity;
$$;
CREATE FUNCTION prometheus.f_select_pg_stat_replication()
RETURNS setof pg_catalog.pg_stat_replication
LANGUAGE sql
SECURITY DEFINER
AS $$
SELECT * from pg_catalog.pg_stat_replication;
$$;
CREATE VIEW prometheus.pg_stat_replication
AS
SELECT * FROM prometheus.f_select_pg_stat_replication();
CREATE VIEW prometheus.pg_stat_activity
AS
SELECT * FROM prometheus.f_select_pg_stat_activity();
GRANT SELECT ON prometheus.pg_stat_replication TO prometheus;
GRANT SELECT ON prometheus.pg_stat_activity TO prometheus;

110
debian/changelog vendored Normal file
View File

@ -0,0 +1,110 @@
prometheus-postgres-exporter (0.8.0+ds-1) unstable; urgency=medium
[ Daniel Swarbrick ]
* New upstream release.
* Add myself to uploaders.
* Bump minimum required version of golang-github-lib-pq to support
SCRAM-SHA-256 authentication.
* Update description (now supports Postgres 9.4 and up).
* lintian: fix rules-requires-root.
[ Debian Janitor ]
* Set debhelper-compat version in Build-Depends.
* Set upstream metadata fields: Bug-Database, Bug-Submit.
[ Martina Ferrari ]
* Update initscript.
* Update my name.
-- Martina Ferrari <tincho@debian.org> Mon, 20 Jan 2020 12:25:39 +0000
prometheus-postgres-exporter (0.5.1+ds-2) unstable; urgency=medium
* Name update.
* Add missing sphinxdoc dependency.
* Install sample queries.yaml file. Closes: #939507
* Fix spelling mistake in source.
* Update Standards-Version and Compat level. Add needed Pre-Depends for
sysvinit.
-- Martina Ferrari <tincho@debian.org> Mon, 28 Oct 2019 16:59:41 +0000
prometheus-postgres-exporter (0.5.1+ds-1) unstable; urgency=medium
[ Sven Hoexter ]
* New upstream release.
-- Martina Ferrari <tincho@debian.org> Fri, 02 Aug 2019 16:01:05 +0000
prometheus-postgres-exporter (0.4.7+ds-2) unstable; urgency=medium
* Use correct namespace for version metadata and remove unused vars.
-- Martina Ferrari <tincho@debian.org> Sun, 10 Feb 2019 18:58:09 +0000
prometheus-postgres-exporter (0.4.7+ds-1) unstable; urgency=medium
* New upstream release. Closes: #920346.
* debian/gbp.conf: Update repo layout.
* Update Standards-Version with no changes.
* Add manpage and version metadata,
-- Martina Ferrari <tincho@debian.org> Tue, 05 Feb 2019 04:51:10 +0000
prometheus-postgres-exporter (0.4.6+ds-2) unstable; urgency=medium
* Update Standards-Version with no changes.
* Add missing --inherit flag to daemon; can't work without it!
-- Martina Ferrari <tincho@debian.org> Mon, 08 Oct 2018 19:03:30 +0000
prometheus-postgres-exporter (0.4.6+ds-1) unstable; urgency=medium
[ Alexandre Viau ]
* Point Vcs-* urls to salsa.debian.org.
[ Martina Ferrari ]
* New upstream release.
* debian/rules: Install test files.
* Bump debhelper compat level to 11.
* debian/copyright: Document Files-Excluded.
* debian/control: Bump Standards-Version (no changes).
* debian/postinst: Do not change permissions recursively.
-- Martina Ferrari <tincho@debian.org> Tue, 07 Aug 2018 16:07:06 +0000
prometheus-postgres-exporter (0.4.1+ds-2) unstable; urgency=medium
* Update defaults for new cmdline flags format.
-- Martina Ferrari <tincho@debian.org> Thu, 14 Dec 2017 17:08:11 +0000
prometheus-postgres-exporter (0.4.1+ds-1) unstable; urgency=medium
* New upstream release.
* Add test fixtures.
* Packaging updates from cme; compat bump; make dep on daemon
conditional.
* Remove unused lintian overrides.
* Use automatic autopkgtests
* Use pkg-info.mk and XS-Go-Import-Path.
-- Martina Ferrari <tincho@debian.org> Thu, 14 Dec 2017 16:59:24 +0000
prometheus-postgres-exporter (0.2.0+ds-2) unstable; urgency=medium
* Add autopkgtest.
-- Martina Ferrari <tincho@debian.org> Sun, 21 May 2017 00:07:32 +0200
prometheus-postgres-exporter (0.2.0+ds-1) unstable; urgency=medium
* New upstream release.
-- Martina Ferrari <tincho@debian.org> Fri, 19 May 2017 22:25:36 +0000
prometheus-postgres-exporter (0.1.1+ds-1) unstable; urgency=medium
* Initial packaging. (Closes: #854014).
-- Martina Ferrari <tincho@debian.org> Sat, 04 Feb 2017 16:50:34 +0000

35
debian/control vendored Normal file
View File

@ -0,0 +1,35 @@
Source: prometheus-postgres-exporter
Maintainer: Debian Go Packaging Team <pkg-go-maintainers@lists.alioth.debian.org>
Uploaders: Martina Ferrari <tincho@debian.org>,
Daniel Swarbrick <daniel.swarbrick@cloud.ionos.com>,
Section: net
Testsuite: autopkgtest-pkg-go
Priority: optional
Build-Depends: debhelper-compat (= 12),
dh-golang,
golang-any,
golang-github-blang-semver-dev,
golang-github-lib-pq-dev (>= 1.2.0~),
golang-github-prometheus-client-golang-dev,
golang-github-prometheus-common-dev,
golang-gopkg-alecthomas-kingpin.v2-dev,
golang-gopkg-check.v1-dev,
golang-gopkg-yaml.v2-dev,
Standards-Version: 4.4.1
Rules-Requires-Root: no
Vcs-Browser: https://salsa.debian.org/go-team/packages/prometheus-postgres-exporter
Vcs-Git: https://salsa.debian.org/go-team/packages/prometheus-postgres-exporter.git
Homepage: https://github.com/wrouesnel/postgres_exporter/
XS-Go-Import-Path: github.com/wrouesnel/postgres_exporter
Package: prometheus-postgres-exporter
Architecture: any
Pre-Depends: ${misc:Pre-Depends},
Depends: daemon | systemd-sysv,
${misc:Depends},
${shlibs:Depends},
${sphinxdoc:Depends},
Built-Using: ${misc:Built-Using},
Description: Prometheus exporter for PostgreSQL server metrics
Prometheus exporter for PostgreSQL server metrics, written in Go.
Supports Postgres versions 9.4 and up.

31
debian/copyright vendored Normal file
View File

@ -0,0 +1,31 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: prometheus-postgres-exporter
Source: https://github.com/wrouesnel/postgres_exporter
Files-Excluded:
vendor/*/*
tools/vendor/*/*
tools/src
Files: *
Copyright: 2015-2017 Will Rouesnel
License: Apache-2.0
Files: debian/*
Copyright: 2017 Martina Ferrari <tincho@tincho.org>
License: Apache-2.0
License: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian systems, the full text of the Apache License version 2 can be found
in the file `/usr/share/common-licenses/Apache-2.0'.

18
debian/default vendored Normal file
View File

@ -0,0 +1,18 @@
# Connection string for the PostgreSQL database. You need to either connect as
# superuser, or create a user with enough rights, as described in
# /usr/share/doc/prometheus-postgres-exporter/README.Debian
# DATA_SOURCE_NAME='postgresql://login:password@hostname:port/'
# DATA_SOURCE_NAME='user=prometheus host=/run/postgresql dbname=postgres'
DATA_SOURCE_NAME=''
# Set the command-line arguments to pass to the server.
ARGS=''
# Available flags:
# --web.listen-address=":9187" Address to listen on for web interface and telemetry.
# --web.telemetry-path="/metrics"
# Path under which to expose metrics.
# --extend.query-path="" Path to custom queries to run.
# --log.level="info" Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal]
# --log.format="logger:stderr" Set the log target and format. Example: "logger:syslog?appname=bob&local=7" or "logger:stdout?json=true"

3
debian/dirs vendored Normal file
View File

@ -0,0 +1,3 @@
usr/bin
var/lib/prometheus
var/log/prometheus

1
debian/docs vendored Normal file
View File

@ -0,0 +1 @@
README.md

1
debian/examples vendored Normal file
View File

@ -0,0 +1 @@
queries.yaml

6
debian/gbp.conf vendored Normal file
View File

@ -0,0 +1,6 @@
[DEFAULT]
debian-branch = debian/sid
[buildpackage]
dist = DEP14
upstream-tag = upstream/%(version)s

28
debian/gitlab-ci.yml vendored Normal file
View File

@ -0,0 +1,28 @@
# auto-generated, DO NOT MODIFY.
# The authoritative copy of this file lives at:
# https://salsa.debian.org/go-team/ci/blob/master/cmd/ci/gitlabciyml.go
# TODO: publish under debian-go-team/ci
image: stapelberg/ci2
test_the_archive:
artifacts:
paths:
- before-applying-commit.json
- after-applying-commit.json
script:
# Create an overlay to discard writes to /srv/gopath/src after the build:
- "rm -rf /cache/overlay/{upper,work}"
- "mkdir -p /cache/overlay/{upper,work}"
- "mount -t overlay overlay -o lowerdir=/srv/gopath/src,upperdir=/cache/overlay/upper,workdir=/cache/overlay/work /srv/gopath/src"
- "export GOPATH=/srv/gopath"
- "export GOCACHE=/cache/go"
# Build the world as-is:
- "ci-build -exemptions=/var/lib/ci-build/exemptions.json > before-applying-commit.json"
# Copy this package into the overlay:
- "GBP_CONF_FILES=:debian/gbp.conf gbp buildpackage --git-no-pristine-tar --git-ignore-branch --git-ignore-new --git-export-dir=/tmp/export --git-no-overlay --git-tarball-dir=/nonexistant --git-cleaner=/bin/true --git-builder='dpkg-buildpackage -S -d --no-sign'"
- "pgt-gopath -dsc /tmp/export/*.dsc"
# Rebuild the world:
- "ci-build -exemptions=/var/lib/ci-build/exemptions.json > after-applying-commit.json"
- "ci-diff before-applying-commit.json after-applying-commit.json"

70
debian/init vendored Normal file
View File

@ -0,0 +1,70 @@
#!/bin/sh
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides: prometheus-postgres-exporter
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Prometheus exporter for machine metrics
# Description: Prometheus exporter for machine metrics, written in Go
# with pluggable metric collectors.
### END INIT INFO
# Author: Martina Ferrari <tincho@debian.org>
DESC="Prometheus exporter for PostgreSQL metrics"
DAEMON=/usr/bin/prometheus-postgres-exporter
NAME=prometheus-postgres-exporter
USER=prometheus
PIDFILE=/var/run/prometheus/prometheus-postgres-exporter.pid
LOGFILE=/var/log/prometheus/prometheus-postgres-exporter.log
ARGS=""
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
HELPER=/usr/bin/daemon
HELPER_ARGS="--name=$NAME --output=$LOGFILE --pidfile=$PIDFILE --user=$USER
--inherit"
do_start_prepare()
{
mkdir -p `dirname $PIDFILE`
chown $USER: `dirname $LOGFILE`
chown $USER: `dirname $PIDFILE`
if test -z "$DATA_SOURCE_NAME"; then
log_failure_msg \
"missing \$DATA_SOURCE_NAME -- please edit /etc/default/$NAME"
exit
fi
}
do_start_cmd_override()
{
# Return
# 0 if daemon has been started or already running
# 2 if daemon could not be started
$HELPER $HELPER_ARGS --running && return 0
$HELPER $HELPER_ARGS -- $DAEMON $ARGS || return 2
return 0
}
do_stop_cmd_override()
{
# Return
# 0 if daemon has been stopped or already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
$HELPER $HELPER_ARGS --running || return 0
$HELPER $HELPER_ARGS --stop || return 2
# wait for the process to really terminate
for n in 1 2 3 4 5; do
sleep $n
$HELPER $HELPER_ARGS --running || break
done
$HELPER $HELPER_ARGS --running || return 0
return 2
}

1
debian/install vendored Normal file
View File

@ -0,0 +1 @@
build/bin/prometheus-postgres-exporter usr/bin

1
debian/manpages vendored Normal file
View File

@ -0,0 +1 @@
build/prometheus-postgres-exporter.1

View File

@ -0,0 +1,21 @@
Description: Fix spelling mistake in source.
--- a/cmd/postgres_exporter/postgres_exporter.go
+++ b/cmd/postgres_exporter/postgres_exporter.go
@@ -987,14 +987,14 @@
Namespace: namespace,
Subsystem: exporter,
Name: "last_scrape_duration_seconds",
- Help: "Duration of the last scrape of metrics from PostgresSQL.",
+ Help: "Duration of the last scrape of metrics from PostgreSQL.",
ConstLabels: e.constantLabels,
})
e.totalScrapes = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Subsystem: exporter,
Name: "scrapes_total",
- Help: "Total number of times PostgresSQL was scraped for metrics.",
+ Help: "Total number of times PostgreSQL was scraped for metrics.",
ConstLabels: e.constantLabels,
})
e.error = prometheus.NewGauge(prometheus.GaugeOpts{

1
debian/patches/series vendored Normal file
View File

@ -0,0 +1 @@
01-Fix_spelling_errors.patch

54
debian/postinst vendored Normal file
View File

@ -0,0 +1,54 @@
#!/bin/sh
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#
# quoting from the policy:
# Any necessary prompting should almost always be confined to the
# post-installation script, and should be protected with a conditional
# so that unnecessary prompting doesn't happen if a package's
# installation fails and the `postinst' is called with `abort-upgrade',
# `abort-remove' or `abort-deconfigure'.
case "$1" in
configure)
# Add prometheus user
if ! getent passwd prometheus > /dev/null; then
adduser --quiet --system --home /var/lib/prometheus --no-create-home \
--group --gecos "Prometheus daemon" prometheus || true
fi
chown prometheus:prometheus /var/lib/prometheus || true
chown prometheus:prometheus /var/log/prometheus || true
chown prometheus:prometheus /etc/default/prometheus-postgres-exporter \
|| true
chmod 0640 /etc/default/prometheus-postgres-exporter || true
;;
abort-upgrade|abort-remove|abort-deconfigure)
:
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

15
debian/postrm vendored Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
# postrm script for prometheus-postgres-exporter
# Script executed after the package is removed.
set -e
case "$1" in
purge)
rm -rf /var/log/prometheus/prometheus-postgres-exporter.log \
/var/run/prometheus/prometheus-postgres-exporter.pid
# We do NOT remove the system user.
;;
esac
#DEBHELPER#

32
debian/rules vendored Executable file
View File

@ -0,0 +1,32 @@
#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk
#export DH_VERBOSE=1
export DH_GOLANG_INSTALL_EXTRA := cmd/postgres_exporter/tests/
BUILDDIR := $(CURDIR)/build
BUILDTAGS :=
BUILDFLAGS = -tags "$(BUILDTAGS)" -ldflags \
" -X main.Version=$(DEB_VERSION_UPSTREAM)"
%:
dh $@ --buildsystem=golang --with=golang \
--builddirectory=$(BUILDDIR)
BINNAME := $(DEB_SOURCE)
WHATIS := "$(BINNAME) \\- Prometheus exporter for PostgreSQL"
override_dh_auto_build:
dh_auto_build -- $(BUILDFLAGS)
# Rename the binary to match the debian package.
cp -v $(BUILDDIR)/bin/postgres_exporter $(BUILDDIR)/bin/$(BINNAME)
build/bin/$(BINNAME) --help-man > build/$(BINNAME).1
# Remove build user/build date/go version headers, which is ugly.
sed -i -e '/^ /d' build/$(BINNAME).1
# Fix whatis entry.
sed -i '/^.SH "NAME"/,+1c.SH "NAME"\n'$(WHATIS) build/$(BINNAME).1
# Remove default values as they create unwieldy long lines.
sed -i 's/\\fB--\(.*\)=".*"\\fR/\\fB--\1\\fR/' build/$(BINNAME).1
override_dh_auto_install:

12
debian/service vendored Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=Prometheus exporter for PostgreSQL
Documentation=https://github.com/wrouesnel/postgres_exporter
[Service]
Restart=always
User=prometheus
EnvironmentFile=/etc/default/prometheus-postgres-exporter
ExecStart=/usr/bin/prometheus-postgres-exporter $ARGS
[Install]
WantedBy=multi-user.target

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

2
debian/upstream/metadata vendored Normal file
View File

@ -0,0 +1,2 @@
Bug-Database: https://github.com/wrouesnel/postgres_exporter/issues
Bug-Submit: https://github.com/wrouesnel/postgres_exporter/issues/new

5
debian/watch vendored Normal file
View File

@ -0,0 +1,5 @@
version=3
opts="filenamemangle=s/(?:.*\/)?v?(\d[\d\.]*)\.tar\.gz/prometheus-postgres-exporter-$1.tar.gz/,dversionmangle=s/\+ds\d*$//" \
https://github.com/wrouesnel/postgres_exporter/tags \
(?:.*/)?v?(\d[\d\.]*)\.tar\.gz