pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/databases/mysqld_exporter



Module Name:    pkgsrc
Committed By:   jperkin
Date:           Thu Feb 11 13:54:29 UTC 2021

Added Files:
        pkgsrc/databases/mysqld_exporter: DESCR MESSAGE.smf Makefile PLIST
            distinfo
        pkgsrc/databases/mysqld_exporter/files: env.conf
        pkgsrc/databases/mysqld_exporter/files/smf: manifest.xml
            mysqld_exporter.sh

Log Message:
mysqld_exporter: Import version 0.12.1.

This is a MySQL metric exporter for Prometheus.

I've had this sitting in my tree since pkgsrc-2019Q4, it currently only has
SMF support, someone is more than welcome to add an rc.d script for it.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 pkgsrc/databases/mysqld_exporter/DESCR \
    pkgsrc/databases/mysqld_exporter/MESSAGE.smf \
    pkgsrc/databases/mysqld_exporter/Makefile \
    pkgsrc/databases/mysqld_exporter/PLIST \
    pkgsrc/databases/mysqld_exporter/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/databases/mysqld_exporter/files/env.conf
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/databases/mysqld_exporter/files/smf/manifest.xml \
    pkgsrc/databases/mysqld_exporter/files/smf/mysqld_exporter.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: pkgsrc/databases/mysqld_exporter/DESCR
diff -u /dev/null pkgsrc/databases/mysqld_exporter/DESCR:1.1
--- /dev/null   Thu Feb 11 13:54:29 2021
+++ pkgsrc/databases/mysqld_exporter/DESCR      Thu Feb 11 13:54:29 2021
@@ -0,0 +1 @@
+A MySQL metric exporter for Prometheus.
Index: pkgsrc/databases/mysqld_exporter/MESSAGE.smf
diff -u /dev/null pkgsrc/databases/mysqld_exporter/MESSAGE.smf:1.1
--- /dev/null   Thu Feb 11 13:54:29 2021
+++ pkgsrc/databases/mysqld_exporter/MESSAGE.smf        Thu Feb 11 13:54:29 2021
@@ -0,0 +1,9 @@
+===========================================================================
+$NetBSD: MESSAGE.smf,v 1.1 2021/02/11 13:54:29 jperkin Exp $
+
+To configure mysqld_exporter adjust the environment variables in:
+
+       ${PKG_SYSCONFDIR}/env.conf
+
+Ensure this file retains appropriately secure permissions.
+===========================================================================
Index: pkgsrc/databases/mysqld_exporter/Makefile
diff -u /dev/null pkgsrc/databases/mysqld_exporter/Makefile:1.1
--- /dev/null   Thu Feb 11 13:54:29 2021
+++ pkgsrc/databases/mysqld_exporter/Makefile   Thu Feb 11 13:54:29 2021
@@ -0,0 +1,37 @@
+# $NetBSD: Makefile,v 1.1 2021/02/11 13:54:29 jperkin Exp $
+
+DISTNAME=      mysqld_exporter-0.12.1
+MASTER_SITES=  ${MASTER_SITE_GITHUB:=prometheus/}
+CATEGORIES=    databases
+GITHUB_TAG=    v${PKGVERSION_NOREV}
+
+MAINTAINER=    pkgsrc-users%pkgsrc.org@localhost
+HOMEPAGE=      https://github.com/prometheus/mysqld_exporter
+COMMENT=       MySQL metric exporter for Prometheus
+LICENSE=       apache-2.0
+
+GO_DIST_BASE=  ${DISTNAME}
+GO_SRCPATH=    github.com/prometheus/mysqld_exporter
+
+SMF_METHODS=   ${PKGBASE}
+
+EGDIR=                 share/examples/${PKGBASE}
+PKG_SYSCONFSUBDIR=     ${PKGBASE}
+
+INSTALLATION_DIRS=     bin ${EGDIR}
+
+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
+
+do-install:
+       ${INSTALL_PROGRAM} ${WRKDIR}/bin/mysqld_exporter \
+           ${DESTDIR}${PREFIX}/bin
+       ${INSTALL_DATA} ${WRKDIR}/.env.conf \
+           ${DESTDIR}${PREFIX}/share/examples/${PKGBASE}/env.conf
+
+.include "../../lang/go/go-package.mk"
+.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/databases/mysqld_exporter/PLIST
diff -u /dev/null pkgsrc/databases/mysqld_exporter/PLIST:1.1
--- /dev/null   Thu Feb 11 13:54:29 2021
+++ pkgsrc/databases/mysqld_exporter/PLIST      Thu Feb 11 13:54:29 2021
@@ -0,0 +1,3 @@
+@comment $NetBSD: PLIST,v 1.1 2021/02/11 13:54:29 jperkin Exp $
+bin/mysqld_exporter
+share/examples/mysqld_exporter/env.conf
Index: pkgsrc/databases/mysqld_exporter/distinfo
diff -u /dev/null pkgsrc/databases/mysqld_exporter/distinfo:1.1
--- /dev/null   Thu Feb 11 13:54:29 2021
+++ pkgsrc/databases/mysqld_exporter/distinfo   Thu Feb 11 13:54:29 2021
@@ -0,0 +1,6 @@
+$NetBSD: distinfo,v 1.1 2021/02/11 13:54:29 jperkin Exp $
+
+SHA1 (mysqld_exporter-0.12.1.tar.gz) = 5a12a0aa6c4f18028281569d34adf3c1d9899c7b
+RMD160 (mysqld_exporter-0.12.1.tar.gz) = 77caebfc31a4ab79e16f5c36b648e90c5b1265b1
+SHA512 (mysqld_exporter-0.12.1.tar.gz) = a655a9ad4b5bc6e7840df68bee934d55485d3a04a7dc8186c8f9d224eb33b0e1d98de3db78a0c7d92f9b3d6ca06ead2d609cf2cfa99e584635f0339984e60629
+Size (mysqld_exporter-0.12.1.tar.gz) = 1910780 bytes

Index: pkgsrc/databases/mysqld_exporter/files/env.conf
diff -u /dev/null pkgsrc/databases/mysqld_exporter/files/env.conf:1.1
--- /dev/null   Thu Feb 11 13:54:29 2021
+++ pkgsrc/databases/mysqld_exporter/files/env.conf     Thu Feb 11 13:54:29 2021
@@ -0,0 +1,15 @@
+#
+# Configuration file for mysqld_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="user:password@(hostname:3306)/"
+export DATA_SOURCE_NAME
+
+#
+# Additional flags for mysqld_exporter.  You will likely need to set at least
+# "--config.my-cnf /path/to/my.cnf" here.
+#
+MYSQLD_EXPORTER_FLAGS=""
+export MYSQLD_EXPORTER_FLAGS

Index: pkgsrc/databases/mysqld_exporter/files/smf/manifest.xml
diff -u /dev/null pkgsrc/databases/mysqld_exporter/files/smf/manifest.xml:1.1
--- /dev/null   Thu Feb 11 13:54:29 2021
+++ pkgsrc/databases/mysqld_exporter/files/smf/manifest.xml     Thu Feb 11 13:54:29 2021
@@ -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.mysqld_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 MySQL server metrics</loctext>
+      </common_name>
+    </template>
+  </service>
+</service_bundle>
Index: pkgsrc/databases/mysqld_exporter/files/smf/mysqld_exporter.sh
diff -u /dev/null pkgsrc/databases/mysqld_exporter/files/smf/mysqld_exporter.sh:1.1
--- /dev/null   Thu Feb 11 13:54:29 2021
+++ pkgsrc/databases/mysqld_exporter/files/smf/mysqld_exporter.sh       Thu Feb 11 13:54:29 2021
@@ -0,0 +1,27 @@
+#!@SMF_METHOD_SHELL@
+#
+# $NetBSD: mysqld_exporter.sh,v 1.1 2021/02/11 13:54:29 jperkin Exp $
+#
+# Init script for mysqld_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/mysqld_exporter ${MYSQLD_EXPORTER_FLAGS}
+       ;;
+*)
+       echo "Usage: $0 start" >&2
+       exit 1
+       ;;
+esac
+
+exit ${SMF_EXIT_OK}



Home | Main Index | Thread Index | Old Index