Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Mar 2018 05:37:37 +0000 (UTC)
From:      Li-Wen Hsu <lwhsu@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r465147 - in head/net-mgmt: . grok_exporter grok_exporter/files
Message-ID:  <201803210537.w2L5bbf8015483@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: lwhsu
Date: Wed Mar 21 05:37:37 2018
New Revision: 465147
URL: https://svnweb.freebsd.org/changeset/ports/465147

Log:
  Add net-mgmt/grok_exporter, export Prometheus metrics from arbitrary
  unstructured log data
  
  PR:		224455
  Submitted by:	Gasol Wu <gasol.wu@gmail.com>

Added:
  head/net-mgmt/grok_exporter/
  head/net-mgmt/grok_exporter/Makefile   (contents, props changed)
  head/net-mgmt/grok_exporter/distinfo   (contents, props changed)
  head/net-mgmt/grok_exporter/files/
  head/net-mgmt/grok_exporter/files/config.yml.in   (contents, props changed)
  head/net-mgmt/grok_exporter/files/grok_exporter.in   (contents, props changed)
  head/net-mgmt/grok_exporter/pkg-descr   (contents, props changed)
  head/net-mgmt/grok_exporter/pkg-plist   (contents, props changed)
Modified:
  head/net-mgmt/Makefile

Modified: head/net-mgmt/Makefile
==============================================================================
--- head/net-mgmt/Makefile	Wed Mar 21 03:51:44 2018	(r465146)
+++ head/net-mgmt/Makefile	Wed Mar 21 05:37:37 2018	(r465147)
@@ -76,6 +76,7 @@
     SUBDIR += gnu-ipcalc
     SUBDIR += grepcidr
     SUBDIR += grepip
+    SUBDIR += grok_exporter
     SUBDIR += gsnmp
     SUBDIR += guifi-snpservices
     SUBDIR += hastmon

Added: head/net-mgmt/grok_exporter/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/grok_exporter/Makefile	Wed Mar 21 05:37:37 2018	(r465147)
@@ -0,0 +1,39 @@
+# $FreeBSD$
+
+PORTNAME=	grok_exporter
+PORTVERSION=	0.2.3
+DISTVERSIONPREFIX=v
+CATEGORIES=	net-mgmt
+
+MAINTAINER=	gasol.wu@gmail.com
+COMMENT=	Export Prometheus metrics from arbitrary unstructured log data
+
+LICENSE=	APACHE20
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+ONLY_FOR_ARCHS=	amd64
+
+LIB_DEPENDS=	libonig.so:devel/oniguruma
+
+USES=		go
+USE_GITHUB=	yes
+GH_ACCOUNT=	fstab logstash-plugins:plugins
+GH_PROJECT=	logstash-patterns-core:plugins
+GH_TAGNAME=	6d25c13:plugins
+
+GO_PKGNAME=	github.com/${GH_ACCOUNT}/${PORTNAME}
+USE_RC_SUBR=	grok_exporter
+SUB_FILES=	config.yml
+
+do-build:
+	${LN} -sf ${WRKSRC}/tailer/fileTailer_darwin.go ${WRKSRC}/tailer/fileTailer_freebsd.go
+	@(cd ${GO_WRKSRC}; ${SETENV} ${MAKE_ENV} ${GO_ENV} ${GO_CMD} build -o ${PORTNAME} .)
+
+do-install:
+	${INSTALL_PROGRAM} ${GO_WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
+	${MKDIR} ${STAGEDIR}${ETCDIR}
+	${INSTALL_DATA} ${WRKDIR}/config.yml ${STAGEDIR}${ETCDIR}
+	@(cd ${WRKSRC} && ${COPYTREE_SHARE} example ${STAGEDIR}${DATADIR})
+	@(cd ${WRKSRC_plugins} && ${COPYTREE_SHARE} patterns ${STAGEDIR}${DATADIR})
+
+.include <bsd.port.mk>

Added: head/net-mgmt/grok_exporter/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/grok_exporter/distinfo	Wed Mar 21 05:37:37 2018	(r465147)
@@ -0,0 +1,5 @@
+TIMESTAMP = 1513652246
+SHA256 (fstab-grok_exporter-v0.2.3_GH0.tar.gz) = 2dd92d93b59979d409e11c2e5ca3fce28299529f63dde3423234264c0a846338
+SIZE (fstab-grok_exporter-v0.2.3_GH0.tar.gz) = 470262
+SHA256 (logstash-plugins-logstash-patterns-core-6d25c13_GH0.tar.gz) = 7f4986b695d82bcfd585b47635607267ce473a601df504672072b242ae7c607f
+SIZE (logstash-plugins-logstash-patterns-core-6d25c13_GH0.tar.gz) = 27383

Added: head/net-mgmt/grok_exporter/files/config.yml.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/grok_exporter/files/config.yml.in	Wed Mar 21 05:37:37 2018	(r465147)
@@ -0,0 +1,15 @@
+global:
+    config_version: 2
+
+grok:
+    patterns_dir: %%DATADIR%%/patterns
+
+metrics:
+    - type: counter
+      name: log_messages_total
+      help: Number of lines in /var/log/messages
+      match: '%{GREEDYDATA}'
+
+server:
+    host: localhost
+    port: 9144

Added: head/net-mgmt/grok_exporter/files/grok_exporter.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/grok_exporter/files/grok_exporter.in	Wed Mar 21 05:37:37 2018	(r465147)
@@ -0,0 +1,47 @@
+#!/bin/sh
+# $FreeBSD$
+
+# PROVIDE: grok_exporter
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# grok_exporter_enable (bool):            Set to NO by default.
+#               Set it to YES to enable grok_exporter.
+# grok_exporter_config (string):          Set path to config file
+#               Default is "%%ETCDIR%%/config.yml".
+# grok_exporter_user (string):            Set user that grok_exporter will run under
+#               Default is "nobody".
+# grok_exporter_group (string):           Set group that grok_exporter will run under
+#               Default is "nobody".
+
+. /etc/rc.subr
+
+name=grok_exporter
+desc="Grok prometheus exporter"
+rcvar=grok_exporter_enable
+
+load_rc_config $name
+
+: ${grok_exporter_enable:=NO}
+: ${grok_exporter_config:=%%ETCDIR%%/config.yml}
+: ${grok_exporter_user:=nobody}
+: ${grok_exporter_group:=nobody}
+
+pidfile=/var/run/grok_exporter.pid
+command=/usr/sbin/daemon
+procname=%%PREFIX%%/bin/grok_exporter
+command_args="-p ${pidfile} /usr/bin/env ${procname} -config ${grok_exporter_config}"
+
+start_precmd=grok_exporter_startprecmd
+
+grok_exporter_startprecmd()
+{
+    if [ ! -e ${pidfile} ]; then
+        install -o ${grok_exporter_user} -g ${grok_exporter_group} /dev/null ${pidfile};
+    fi
+}
+
+run_rc_command "$1"

Added: head/net-mgmt/grok_exporter/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/grok_exporter/pkg-descr	Wed Mar 21 05:37:37 2018	(r465147)
@@ -0,0 +1,12 @@
+Grok is a tool to parse crappy unstructured log data into something structured
+and queryable. Grok is heavily used in Logstash to provide log data as input for
+ElasticSearch.
+
+Grok ships with about 120 predefined patterns for syslog logs, apache and other
+webserver logs, mysql logs, etc. It is easy to extend Grok with custom patterns.
+
+The grok_exporter aims at porting Grok from the ELK stack to Prometheus
+monitoring. The goal is to use Grok patterns for extracting Prometheus metrics
+from arbitrary log files.
+
+WWW: https://github.com/fstab/grok_exporter

Added: head/net-mgmt/grok_exporter/pkg-plist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/grok_exporter/pkg-plist	Wed Mar 21 05:37:37 2018	(r465147)
@@ -0,0 +1,22 @@
+bin/grok_exporter
+%%ETCDIR%%/config.yml
+%%DATADIR%%/example/config.yml
+%%DATADIR%%/example/exim-rejected-RCPT-examples.log
+%%DATADIR%%/patterns/aws
+%%DATADIR%%/patterns/bacula
+%%DATADIR%%/patterns/bro
+%%DATADIR%%/patterns/exim
+%%DATADIR%%/patterns/firewalls
+%%DATADIR%%/patterns/grok-patterns
+%%DATADIR%%/patterns/haproxy
+%%DATADIR%%/patterns/java
+%%DATADIR%%/patterns/junos
+%%DATADIR%%/patterns/linux-syslog
+%%DATADIR%%/patterns/mcollective
+%%DATADIR%%/patterns/mcollective-patterns
+%%DATADIR%%/patterns/mongodb
+%%DATADIR%%/patterns/nagios
+%%DATADIR%%/patterns/postgresql
+%%DATADIR%%/patterns/rails
+%%DATADIR%%/patterns/redis
+%%DATADIR%%/patterns/ruby



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803210537.w2L5bbf8015483>