aboutsummaryrefslogtreecommitdiff
path: root/sysutils/phpfpm_exporter
diff options
context:
space:
mode:
authorLi-Wen Hsu <lwhsu@FreeBSD.org>2018-02-21 07:49:21 +0000
committerLi-Wen Hsu <lwhsu@FreeBSD.org>2018-02-21 07:49:21 +0000
commitf6147c3ac7063d550a95b37d3b0067cf03648e46 (patch)
tree0303b2244783781df3a42d8ee0cfb190ca46c024 /sysutils/phpfpm_exporter
parent2f7e93963af687017ec9bbc52b4fbff998ff8268 (diff)
Notes
Diffstat (limited to 'sysutils/phpfpm_exporter')
-rw-r--r--sysutils/phpfpm_exporter/Makefile29
-rw-r--r--sysutils/phpfpm_exporter/distinfo3
-rw-r--r--sysutils/phpfpm_exporter/files/phpfpm_exporter.in54
-rw-r--r--sysutils/phpfpm_exporter/pkg-descr3
4 files changed, 89 insertions, 0 deletions
diff --git a/sysutils/phpfpm_exporter/Makefile b/sysutils/phpfpm_exporter/Makefile
new file mode 100644
index 000000000000..c59260e670fa
--- /dev/null
+++ b/sysutils/phpfpm_exporter/Makefile
@@ -0,0 +1,29 @@
+# $FreeBSD$
+
+PORTNAME= phpfpm_exporter
+PORTVERSION= 0.3.3
+DISTVERSIONPREFIX=v
+CATEGORIES= sysutils
+
+MAINTAINER= gasol.wu@gmail.com
+COMMENT= Export php-fpm metrics in Prometheus format
+
+LICENSE= MIT
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+USES= go
+USE_GITHUB= yes
+GH_ACCOUNT= bakins
+GH_PROJECT= php-fpm-exporter
+
+GO_PKGNAME= github.com/${GH_ACCOUNT}/${GH_PROJECT}
+PLIST_FILES= bin/${PORTNAME}
+USE_RC_SUBR= phpfpm_exporter
+
+do-build:
+ @(cd ${GO_WRKSRC}; ${SETENV} ${MAKE_ENV} ${GO_ENV} CGO_ENABLED=0 ${GO_CMD} build -o ${PORTNAME} ./cmd/${GH_PROJECT})
+
+do-install:
+ ${INSTALL_PROGRAM} ${GO_WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
+
+.include <bsd.port.mk>
diff --git a/sysutils/phpfpm_exporter/distinfo b/sysutils/phpfpm_exporter/distinfo
new file mode 100644
index 000000000000..cf36c110989d
--- /dev/null
+++ b/sysutils/phpfpm_exporter/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1512723537
+SHA256 (bakins-php-fpm-exporter-v0.3.3_GH0.tar.gz) = 02b6ee16d3c595430dd875953639daa95e2b41e9f78e1aca45656e9f5e196b4c
+SIZE (bakins-php-fpm-exporter-v0.3.3_GH0.tar.gz) = 1510300
diff --git a/sysutils/phpfpm_exporter/files/phpfpm_exporter.in b/sysutils/phpfpm_exporter/files/phpfpm_exporter.in
new file mode 100644
index 000000000000..af0907efe345
--- /dev/null
+++ b/sysutils/phpfpm_exporter/files/phpfpm_exporter.in
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+# $FreeBSD$
+#
+# PROVIDE: phpfpm_exporter
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# phpfpm_exporter_enable (bool): Set to NO by default.
+# Set it to YES to enable phpfpm_exporter.
+# phpfpm_exporter_user (string): Set user that phpfpm_exporter will run under
+# Default is "nobody".
+# phpfpm_exporter_group (string): Set group that phpfpm_exporter will run under
+# Default is "nobody".
+# phpfpm_exporter_endpoint (string): Set status endpoint
+# Default is "http://127.0.0.1:9000/status".
+# phpfpm_exporter_listen_address (string): Set ip:port that phpfpm_exporter will listen on
+# Default is "127.0.0.1:8080".
+
+. /etc/rc.subr
+
+name=phpfpm_exporter
+rcvar=phpfpm_exporter_enable
+
+load_rc_config $name
+
+: ${phpfpm_exporter_enable:="NO"}
+: ${phpfpm_exporter_user:="nobody"}
+: ${phpfpm_exporter_group:="nobody"}
+: ${phpfpm_exporter_endpoint:="http://127.0.0.1:9000/status"}
+: ${phpfpm_exporter_listen_address:="127.0.0.1:8080"}
+
+
+pidfile=/var/run/phpfpm_exporter.pid
+command="/usr/sbin/daemon"
+procname="%%PREFIX%%/bin/phpfpm_exporter"
+command_args="-p ${pidfile} /usr/bin/env ${procname} \
+ --addr ${phpfpm_exporter_listen_address} \
+ --endpoint ${phpfpm_exporter_endpoint}"
+
+start_precmd=phpfpm_exporter_startprecmd
+
+phpfpm_exporter_startprecmd()
+{
+ if [ ! -e ${pidfile} ]; then
+ install -o ${phpfpm_exporter_user} -g ${phpfpm_exporter_group} /dev/null ${pidfile};
+ fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/sysutils/phpfpm_exporter/pkg-descr b/sysutils/phpfpm_exporter/pkg-descr
new file mode 100644
index 000000000000..b4909edfdc81
--- /dev/null
+++ b/sysutils/phpfpm_exporter/pkg-descr
@@ -0,0 +1,3 @@
+Export php-fpm metrics in Prometheus format.
+
+WWW: https://github.com/bakins/php-fpm-exporter