pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/databases/postgres_exporter postgres_exporter: Import ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/7af4bba3a1d3
branches: trunk
changeset: 334571:7af4bba3a1d3
user: jperkin <jperkin%pkgsrc.org@localhost>
date: Fri May 31 14:42:04 2019 +0000
description:
postgres_exporter: Import version 0.4.7.
A PostgresSQL metric exporter for Prometheus.
diffstat:
databases/postgres_exporter/DESCR | 1 +
databases/postgres_exporter/MESSAGE.smf | 13 ++++
databases/postgres_exporter/Makefile | 40 ++++++++++++++
databases/postgres_exporter/PLIST | 4 +
databases/postgres_exporter/distinfo | 6 ++
databases/postgres_exporter/files/env.conf | 17 +++++
databases/postgres_exporter/files/smf/manifest.xml | 31 ++++++++++
databases/postgres_exporter/files/smf/postgres_exporter.sh | 27 +++++++++
8 files changed, 139 insertions(+), 0 deletions(-)
diffs (171 lines):
diff -r ce934aeb291f -r 7af4bba3a1d3 databases/postgres_exporter/DESCR
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/postgres_exporter/DESCR Fri May 31 14:42:04 2019 +0000
@@ -0,0 +1,1 @@
+A PostgresSQL metric exporter for Prometheus.
diff -r ce934aeb291f -r 7af4bba3a1d3 databases/postgres_exporter/MESSAGE.smf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/postgres_exporter/MESSAGE.smf Fri May 31 14:42:04 2019 +0000
@@ -0,0 +1,13 @@
+===========================================================================
+$NetBSD: MESSAGE.smf,v 1.1 2019/05/31 14:42:04 jperkin Exp $
+
+To configure postgres_exporter adjust the environment variables in:
+
+ ${PKG_SYSCONFDIR}/env.conf
+
+Additional queries can be configured in:
+
+ ${PKG_SYSCONFDIR}/queries.yaml
+
+Ensure these files retain appropriately secure permissions.
+===========================================================================
diff -r ce934aeb291f -r 7af4bba3a1d3 databases/postgres_exporter/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/postgres_exporter/Makefile Fri May 31 14:42:04 2019 +0000
@@ -0,0 +1,40 @@
+# $NetBSD: Makefile,v 1.1 2019/05/31 14:42:04 jperkin Exp $
+
+DISTNAME= postgres_exporter-0.4.7
+MASTER_SITES= ${MASTER_SITE_GITHUB:=wrouesnel/}
+CATEGORIES= databases
+GITHUB_PROJECT= postgres_exporter
+GITHUB_TAG= v${PKGVERSION_NOREV}
+
+MAINTAINER= pkgsrc-users%pkgsrc.org@localhost
+HOMEPAGE= https://github.com/wrouesnel/postgres_exporter/
+COMMENT= PostgresSQL metric exporter for Prometheus
+LICENSE= apache-2.0
+
+GO_DIST_BASE= ${DISTNAME}
+GO_SRCPATH= github.com/wrouesnel/postgres_exporter
+
+SMF_METHODS= ${PKGBASE}
+
+EGDIR= share/examples/${PKGBASE}
+PKG_SYSCONFSUBDIR= ${PKGBASE}
+
+INSTALLATION_DIRS+= ${EGDIR}
+
+CONF_FILES_PERMS+= ${EGDIR}/queries.yaml ${PKG_SYSCONFDIR}/queries.yaml \
+ ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 644
+CONF_FILES_PERMS+= ${EGDIR}/env.conf ${PKG_SYSCONFDIR}/env.conf \
+ ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 600
+
+post-build:
+ ${SED} -e 's,@PKG_SYSCONFDIR@,${PKG_SYSCONFDIR},g' ${FILESDIR}/env.conf \
+ >${WRKDIR}/.env.conf
+
+post-install:
+ ${INSTALL_DATA} ${WRKSRC}/queries.yaml \
+ ${DESTDIR}${PREFIX}/share/examples/${PKGBASE}/queries.yaml
+ ${INSTALL_DATA} ${WRKDIR}/.env.conf \
+ ${DESTDIR}${PREFIX}/share/examples/${PKGBASE}/env.conf
+
+.include "../../lang/go/go-package.mk"
+.include "../../mk/bsd.pkg.mk"
diff -r ce934aeb291f -r 7af4bba3a1d3 databases/postgres_exporter/PLIST
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/postgres_exporter/PLIST Fri May 31 14:42:04 2019 +0000
@@ -0,0 +1,4 @@
+@comment $NetBSD: PLIST,v 1.1 2019/05/31 14:42:04 jperkin Exp $
+bin/postgres_exporter
+share/examples/postgres_exporter/env.conf
+share/examples/postgres_exporter/queries.yaml
diff -r ce934aeb291f -r 7af4bba3a1d3 databases/postgres_exporter/distinfo
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/postgres_exporter/distinfo Fri May 31 14:42:04 2019 +0000
@@ -0,0 +1,6 @@
+$NetBSD: distinfo,v 1.1 2019/05/31 14:42:04 jperkin Exp $
+
+SHA1 (postgres_exporter-0.4.7.tar.gz) = 1fc973ef659b653e4dcfe27e1cb1dd6a38403709
+RMD160 (postgres_exporter-0.4.7.tar.gz) = a0d5acf380fb04b054c3c8090714eceab3a44b84
+SHA512 (postgres_exporter-0.4.7.tar.gz) = 81afce765830a5c16597f0ac9a95d21466edb20e40cff8e26079663db75f0051a6e0eb4ff828eb825b51a6fc52b3b534e0f6ffbb2ecf2c94e2ec8656de4a2ff6
+Size (postgres_exporter-0.4.7.tar.gz) = 3699251 bytes
diff -r ce934aeb291f -r 7af4bba3a1d3 databases/postgres_exporter/files/env.conf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/postgres_exporter/files/env.conf Fri May 31 14:42:04 2019 +0000
@@ -0,0 +1,17 @@
+#
+# Configuration file for postgres_exporter. This file is sourced by the SMF
+# method script, allowing usernames and passwords to be stored here and protected
+# by standard UNIX permissions.
+#
+
+DATA_SOURCE_NAME="postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable"
+PG_EXPORTER_WEB_LISTEN_ADDRESS=":9187"
+PG_EXPORTER_WEB_TELEMETRY_PATH="/metrics"
+PG_EXPORTER_DISABLE_DEFAULT_METRICS=false
+PG_EXPORTER_DISABLE_SETTINGS_METRICS=false
+PG_EXPORTER_EXTEND_QUERY_PATH="@PKG_SYSCONFDIR@/queries.yaml"
+
+export DATA_SOURCE_NAME
+export PG_EXPORTER_WEB_LISTEN_ADDRESS PG_EXPORTER_WEB_TELEMETRY_PATH
+export PG_EXPORTER_DISABLE_DEFAULT_METRICS PG_EXPORTER_DISABLE_SETTINGS_METRICS
+export PG_EXPORTER_EXTEND_QUERY_PATH
diff -r ce934aeb291f -r 7af4bba3a1d3 databases/postgres_exporter/files/smf/manifest.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/postgres_exporter/files/smf/manifest.xml Fri May 31 14:42:04 2019 +0000
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<service_bundle type="manifest" name="export">
+ <service name="@SMF_PREFIX@/@SMF_NAME@" type="service" version="1">
+ <create_default_instance enabled="false"/>
+ <single_instance/>
+ <dependency name="network" grouping="require_all" restart_on="error" type="service">
+ <service_fmri value="svc:/milestone/network:default"/>
+ </dependency>
+ <dependency name="filesystem" grouping="require_all" restart_on="error" type="service">
+ <service_fmri value="svc:/system/filesystem/local"/>
+ </dependency>
+ <method_context>
+ <method_environment>
+ <envvar name="PATH" value="@PREFIX@/sbin:@PREFIX@/bin:/sbin:/usr/sbin:/usr/bin"/>
+ </method_environment>
+ </method_context>
+ <exec_method type="method" name="start" exec="@PREFIX@/@SMF_METHOD_FILE.postgres_exporter@ start" timeout_seconds="60"/>
+ <exec_method type="method" name="refresh" exec=":kill -HUP" timeout_seconds="60"/>
+ <exec_method type="method" name="stop" exec=":kill" timeout_seconds="60"/>
+ <property_group name="startd" type="framework">
+ <propval name="duration" type="astring" value="child"/>
+ <propval name="ignore_error" type="astring" value="core,signal"/>
+ </property_group>
+ <template>
+ <common_name>
+ <loctext xml:lang="C">Prometheus exporter for PostgreSQL server metrics</loctext>
+ </common_name>
+ </template>
+ </service>
+</service_bundle>
diff -r ce934aeb291f -r 7af4bba3a1d3 databases/postgres_exporter/files/smf/postgres_exporter.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/postgres_exporter/files/smf/postgres_exporter.sh Fri May 31 14:42:04 2019 +0000
@@ -0,0 +1,27 @@
+#!@SMF_METHOD_SHELL@
+#
+# $NetBSD: postgres_exporter.sh,v 1.1 2019/05/31 14:42:04 jperkin Exp $
+#
+# Init script for postgres_exporter. This is non-standard, but required so
+# that we can source a configuration file and pass environment variables that
+# include the database password to the program.
+#
+# As we need to use it anyway, we use it for everything, rather than splitting
+# configuration between the config file and SMF variables.
+#
+
+. /lib/svc/share/smf_include.sh
+
+. @PKG_SYSCONFDIR@/env.conf
+
+case "$1" in
+start)
+ @LOCALBASE@/bin/postgres_exporter
+ ;;
+*)
+ echo "Usage: $0 start" >&2
+ exit 1
+ ;;
+esac
+
+exit ${SMF_EXIT_OK}
Home |
Main Index |
Thread Index |
Old Index