Date: Thu, 17 Oct 2019 18:37:57 +0000 (UTC) From: Ryan Steinmetz <zi@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r514678 - in head/net-mgmt: . ping_exporter ping_exporter/files Message-ID: <201910171837.x9HIbvD4064737@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: zi Date: Thu Oct 17 18:37:57 2019 New Revision: 514678 URL: https://svnweb.freebsd.org/changeset/ports/514678 Log: New port: net-mgmt/ping_exporter: Prometheus exporter for ICMP echo requests. This is a simple server that scrapes go-ping stats and exports them via HTTP for Prometheus consumption. The go-ping library is build and maintained by Digineo GmbH. WWW: https://github.com/czerwonk/ping_exporter Submitted by: JP <jp+ports@supplntr.io> Added: head/net-mgmt/ping_exporter/ head/net-mgmt/ping_exporter/Makefile (contents, props changed) head/net-mgmt/ping_exporter/distinfo (contents, props changed) head/net-mgmt/ping_exporter/files/ head/net-mgmt/ping_exporter/files/ping_exporter.in (contents, props changed) head/net-mgmt/ping_exporter/files/ping_exporter.yml.sample (contents, props changed) head/net-mgmt/ping_exporter/pkg-descr (contents, props changed) head/net-mgmt/ping_exporter/pkg-plist (contents, props changed) Modified: head/net-mgmt/Makefile Modified: head/net-mgmt/Makefile ============================================================================== --- head/net-mgmt/Makefile Thu Oct 17 18:32:41 2019 (r514677) +++ head/net-mgmt/Makefile Thu Oct 17 18:37:57 2019 (r514678) @@ -289,6 +289,7 @@ SUBDIR += php74-snmp SUBDIR += phpipam SUBDIR += phpweathermap + SUBDIR += ping_exporter SUBDIR += pktstat SUBDIR += pmacct SUBDIR += pnp Added: head/net-mgmt/ping_exporter/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net-mgmt/ping_exporter/Makefile Thu Oct 17 18:37:57 2019 (r514678) @@ -0,0 +1,25 @@ +# $FreeBSD$ + +PORTNAME= ping_exporter +DISTVERSION= 0.44 +CATEGORIES= net-mgmt + +MAINTAINER= jp+ports@supplntr.io +COMMENT= Prometheus exporter for ICMP echo requests + +LICENSE= APACHE20 + +USES= go +USE_GITHUB= yes +GH_ACCOUNT= czerwonk + +GO_PKGNAME= github.com/${GH_ACCOUNT}/${PORTNAME} +GO_TARGET= github.com/${GH_ACCOUNT}/${PORTNAME} + +USE_RC_SUBR= ping_exporter + +post-install: + ${INSTALL_DATA} ${PATCHDIR}/ping_exporter.yml.sample \ + ${STAGEDIR}${PREFIX}/etc/ping_exporter.yml.sample + +.include <bsd.port.mk> Added: head/net-mgmt/ping_exporter/distinfo ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net-mgmt/ping_exporter/distinfo Thu Oct 17 18:37:57 2019 (r514678) @@ -0,0 +1,3 @@ +TIMESTAMP = 1571270240 +SHA256 (czerwonk-ping_exporter-0.44_GH0.tar.gz) = 03d0c825fdb8d3c8701743897726ad7960879211238135363879161bbdcd06a7 +SIZE (czerwonk-ping_exporter-0.44_GH0.tar.gz) = 4595291 Added: head/net-mgmt/ping_exporter/files/ping_exporter.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net-mgmt/ping_exporter/files/ping_exporter.in Thu Oct 17 18:37:57 2019 (r514678) @@ -0,0 +1,67 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: ping_exporter +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# ping_exporter_enable (bool): Set to NO by default. +# Set it to YES to enable ping_exporter. +# ping_exporter_user (string): Set user that ping_exporter will run under +# Default is "nobody". +# ping_exporter_group (string): Set group that ping_exporter will run under +# Default is "nobody". +# ping_exporter_args (string): Set extra arguments to pass to ping_exporter +# Default is "". +# ping_exporter_listen_address (string):Set ip:port that ping_exporter will listen on +# Default is "localhost:9427". +# ping_exporter_config (string): Set configuration file of ping_exporter +# Default is "%%PREFIX%%/etc/ping_exporter.yml". +# ping_exporter_log_file (string): Set log file of ping_exporter +# Default is "/var/log/ping_exporter.log". + +. /etc/rc.subr + +name=ping_exporter +desc="Ping exporter for use with Prometheus" +rcvar=ping_exporter_enable + +load_rc_config $name + +: ${ping_exporter_enable:=NO} +: ${ping_exporter_user:=nobody} +: ${ping_exporter_group:=nobody} +: ${ping_exporter_listen_address=localhost:9427} +: ${ping_exporter_config="%%PREFIX%%/etc/ping_exporter.yml"} +: ${ping_exporter_log_file=/var/log/ping_exporter.log} + +required_files="${ping_exporter_config}" +pidfile=/var/run/ping_exporter.pid +command=/usr/sbin/daemon +procname="%%PREFIX%%/bin/ping_exporter" +command_args="-p ${pidfile} /usr/bin/env ${procname} \ + -web.listen-address ${ping_exporter_listen_address} \ + -config.path ${ping_exporter_config} \ + ${ping_exporter_args} >> ${ping_exporter_log_file} 2>&1" + +start_precmd=ping_exporter_startprecmd + +ping_exporter_startprecmd() +{ + if [ ! -e ${pidfile} ]; then + install -o ${ping_exporter_user} -g ${ping_exporter_group} /dev/null ${pidfile}; + else + chown ${ping_exporter_user}:${ping_exporter_group} ${pidfile}; + fi + if [ ! -e ${ping_exporter_log_file} ]; then + install -o ${ping_exporter_user} -g ${ping_exporter_group} -m 640 /dev/null ${ping_exporter_log_file}; + else + chown ${ping_exporter_user}:${ping_exporter_group} ${ping_exporter_log_file}; + fi +} + +run_rc_command "$1" Added: head/net-mgmt/ping_exporter/files/ping_exporter.yml.sample ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net-mgmt/ping_exporter/files/ping_exporter.yml.sample Thu Oct 17 18:37:57 2019 (r514678) @@ -0,0 +1,14 @@ +targets: + - one.one.one.one + - google-public-dns-a.google.com + - google-public-dns-b.google.com + +dns: + refresh: 2m15s + nameserver: 1.1.1.1 + +ping: + interval: 2s + timeout: 3s + history-size: 42 + payload-size: 120 Added: head/net-mgmt/ping_exporter/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net-mgmt/ping_exporter/pkg-descr Thu Oct 17 18:37:57 2019 (r514678) @@ -0,0 +1,7 @@ +Prometheus exporter for ICMP echo requests. + +This is a simple server that scrapes go-ping stats and exports them via HTTP +for Prometheus consumption. The go-ping library is build and maintained by +Digineo GmbH. + +WWW: https://github.com/czerwonk/ping_exporter Added: head/net-mgmt/ping_exporter/pkg-plist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net-mgmt/ping_exporter/pkg-plist Thu Oct 17 18:37:57 2019 (r514678) @@ -0,0 +1,2 @@ +bin/ping_exporter +@sample %%ETCDIR%%.yml.sample
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910171837.x9HIbvD4064737>