New port: www/nginx-prometheus-exporter, exporter for nginx and nginx plus

PR:		234273
Submitted by:	arcade@b1t.name (maintainer)
This commit is contained in:
Thomas Zander 2018-12-30 19:23:56 +00:00
parent 4f6203b803
commit 2eb92d3a78
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=488732
5 changed files with 101 additions and 0 deletions

View file

@ -525,6 +525,7 @@
SUBDIR += nginx-full
SUBDIR += nginx-lite
SUBDIR += nginx-naxsi
SUBDIR += nginx-prometheus-exporter
SUBDIR += nibbleblog
SUBDIR += node
SUBDIR += node6

View file

@ -0,0 +1,29 @@
# Created by: Jev Björsell <ports@ecadlabs.com>
# $FreeBSD$
PORTNAME= nginx-prometheus-exporter
PORTVERSION= 0.2.0
DISTVERSIONPREFIX=v
CATEGORIES= www
MAINTAINER= arcade@b1t.name
COMMENT= Prometheus exporter for NGINX and NGINX Plus stats
LICENSE= APACHE20
USES= go
USE_GITHUB= yes
GH_ACCOUNT= nginxinc
GO_PKGNAME= github.com/${GH_ACCOUNT}/${PORTNAME}
GO_TARGET= github.com/${GH_ACCOUNT}/${PORTNAME}
PLIST_FILES= bin/${PORTNAME}
USE_RC_SUBR= ${PORTNAME}
do-install:
${INSTALL_PROGRAM} ${WRKDIR}/bin/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
.include <bsd.port.mk>

View file

@ -0,0 +1,3 @@
TIMESTAMP = 1546197812
SHA256 (nginxinc-nginx-prometheus-exporter-v0.2.0_GH0.tar.gz) = 5a85aab152eb69813cfff7736010e46b1cf4bf4bee6231c8807ce93e19ed9a2c
SIZE (nginxinc-nginx-prometheus-exporter-v0.2.0_GH0.tar.gz) = 236185

View file

@ -0,0 +1,64 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: nginx_prometheus_exporter
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# nginx_prometheus_exporter_enable (bool): Set to NO by default.
# Set it to YES to enable nginx_prometheus_exporter.
# nginx_prometheus_exporter_user (string): Set user that
# nginx_prometheus_exporter will run under
# Default is "nobody".
# nginx_prometheus_exporter_group (string): Set group that
# nginx_prometheus_exporter will run under
# Default is "nobody".
# nginx_prometheus_exporter_args (string): Set extra arguments to pass to
# nginx_prometheus_exporter
# Default is "".
# nginx_prometheus_exporter_listen_address (string): Set ip:port that
# nginx_prometheus_exporter will listen on
# Default is ":9113".
# nginx_prometheus_exporter_scrape_uri (string): Set server address to
# connect to
# Default is "http://127.0.0.1:8080/stub_status".
. /etc/rc.subr
name=nginx_prometheus_exporter
rcvar=nginx_prometheus_exporter_enable
load_rc_config $name
: ${nginx_prometheus_exporter_enable:="NO"}
: ${nginx_prometheus_exporter_user:="nobody"}
: ${nginx_prometheus_exporter_group:="nobody"}
: ${nginx_prometheus_exporter_args:=""}
: ${nginx_prometheus_exporter_listen_address:=":9113"}
: ${nginx_prometheus_exporter_scrape_uri:="http://127.0.0.1:8080/stub_status"}
pidfile=/var/run/nginx_prometheus_exporter.pid
command="/usr/sbin/daemon"
procname="%%PREFIX%%/bin/nginx-prometheus-exporter"
command_args="-p ${pidfile} /usr/bin/env ${procname} \
--nginx.scrape-uri=${nginx_prometheus_exporter_scrape_uri} \
--web.listen-address=${nginx_prometheus_exporter_listen_address} \
${nginx_prometheus_exporter_args}"
start_precmd=nginx_prometheus_exporter_startprecmd
nginx_prometheus_exporter_startprecmd()
{
if [ ! -e ${pidfile} ]; then
install -o ${nginx_prometheus_exporter_user} -g ${nginx_prometheus_exporter_group} /dev/null ${pidfile};
fi
}
load_rc_config $name
run_rc_command "$1"

View file

@ -0,0 +1,4 @@
NGINX Prometheus exporter makes it possible to monitor NGINX
or NGINX Plus using Prometheus.
WWW: https://github.com/nginxinc/nginx-prometheus-exporter