Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Apr 2021 08:09:35 GMT
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 8eca04cb1eed - main - Add a port of ancillary utilities and agent for VictoriaMetrics.
Message-ID:  <202104100809.13A89ZSQ076102@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by danfe:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8eca04cb1eedc479d78a0e655a9be3f0bd32dc02

commit 8eca04cb1eedc479d78a0e655a9be3f0bd32dc02
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2021-04-10 08:00:35 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2021-04-10 08:07:24 +0000

    Add a port of ancillary utilities and agent for VictoriaMetrics.
    
    Based on the work of:   Oleg Ginzburg
---
 net-mgmt/Makefile                 |  1 +
 net-mgmt/vmutils/Makefile         | 50 ++++++++++++++++++++++++++++++
 net-mgmt/vmutils/files/vmagent.in | 65 +++++++++++++++++++++++++++++++++++++++
 net-mgmt/vmutils/pkg-descr        |  6 ++++
 net-mgmt/vmutils/pkg-plist        | 17 ++++++++++
 5 files changed, 139 insertions(+)

diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile
index 92ee236c8e9f..f8a303d630d5 100644
--- a/net-mgmt/Makefile
+++ b/net-mgmt/Makefile
@@ -376,6 +376,7 @@
     SUBDIR += unifi6
     SUBDIR += victoria-metrics
     SUBDIR += virt-viewer
+    SUBDIR += vmutils
     SUBDIR += wdiag
     SUBDIR += whatmask
     SUBDIR += wifimgr
diff --git a/net-mgmt/vmutils/Makefile b/net-mgmt/vmutils/Makefile
new file mode 100644
index 000000000000..754534b5f087
--- /dev/null
+++ b/net-mgmt/vmutils/Makefile
@@ -0,0 +1,50 @@
+# Created by: Alexey Dokuchaev <danfe@FreeBSD.org>
+
+PORTNAME=	vmutils
+DISTVERSIONPREFIX=	v
+DISTVERSION=	1.58.0
+CATEGORIES=	net-mgmt
+DISTINFO_FILE=	${.CURDIR}/../victoria-metrics/distinfo
+
+MAINTAINER=	danfe@FreeBSD.org
+COMMENT=	Ancillary utilities and agent for VictoriaMetrics
+
+LICENSE=	APACHE20
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		gmake go:modules,no_targets
+USE_RC_SUBR=	vmagent
+MAKE_ENV=	PKG_TAG=${DISTVERSIONPREFIX}${DISTVERSION} \
+		BUILDINFO_TAG=edd1590 GOOS=${OPSYS:tl}
+ALL_TARGET=	${PORTNAME}-pure
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	VictoriaMetrics
+GH_PROJECT=	VictoriaMetrics
+
+.include "${.CURDIR}/../victoria-metrics/Makefile.deps"
+
+USERS=		victoria-metrics
+GROUPS=		victoria-metrics
+VICTORIA_DATA?=	/var/db/victoria-metrics
+
+SUB_LIST+=	VICTORIA_DATA=${VICTORIA_DATA} \
+		VICTORIA_USER=${USERS}
+
+PLIST_SUB+=	VICTORIA_DATA=${VICTORIA_DATA} \
+		VICTORIA_GROUP=${GROUPS} \
+		VICTORIA_USER=${USERS}
+
+OPTIONS_DEFINE=	DOCS
+
+do-install:
+.for p in agent alert auth backup ctl restore
+	${INSTALL_PROGRAM} ${WRKSRC}/bin/vm${p}-pure \
+		${STAGEDIR}${PREFIX}/bin/vm${p}
+.endfor
+
+do-install-DOCS-on:
+	@${MKDIR} ${STAGEDIR}${DOCSDIR}
+	${INSTALL_DATA} ${INSTALL_WRKSRC}/docs/vm* ${STAGEDIR}${DOCSDIR}
+
+.include <bsd.port.mk>
diff --git a/net-mgmt/vmutils/files/vmagent.in b/net-mgmt/vmutils/files/vmagent.in
new file mode 100644
index 000000000000..b07a662486a9
--- /dev/null
+++ b/net-mgmt/vmutils/files/vmagent.in
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+# PROVIDE: victoria_vmagent
+# REQUIRE: NETWORK
+# BEFORE: DAEMON
+
+. /etc/rc.subr
+
+name="victoria_vmagent"
+desc="Fast, cost-effective, and scalable time series database"
+rcvar="victoria_vmagent_enable"
+pidfile="/var/run/${name}.pid"
+daemon_pidfile="/var/run/${name}-daemon.pid"
+logdir="/var/log/${name}"
+logfile="${logdir}/victoria_vmagent.log"
+command="%%PREFIX%%/bin/vmagent"
+victoria_vmagent_args=${cbsd_mq_router_config-"--remoteWrite.tmpDataPath=/tmp --promscrape.config=%%PREFIX%%/etc/prometheus/prometheus.yml --remoteWrite.url=http://127.0.0.1:8429/api/v1/write -httpListenAddr=:9429 --memory.allowedPercent=80"}
+victoria_vmagent_user="%%VICTORIA_USER%%"
+load_rc_config ${name}
+
+start_cmd="start"
+stop_cmd="stop"
+status_cmd="status"
+
+start()
+{
+	[ ! -d ${logdir} ] && mkdir -p ${logdir}
+	touch ${logfile}
+	chown ${victoria_vmagent_user} ${logdir} ${logfile}
+	/usr/sbin/daemon -u ${victoria_vmagent_user} -f -R5 -p ${pidfile} -P ${daemon_pidfile} -o ${logfile} ${command} ${victoria_vmagent_args}
+}
+
+stop()
+{
+	if [ -f "${daemon_pidfile}" ]; then
+		pids=$( pgrep -F ${daemon_pidfile} 2>&1 )
+		_err=$?
+		[ ${_err} -eq 0 ] && kill -9 ${pids} && /bin/rm -f ${daemon_pidfile}
+	fi
+	if [ -f "${pidfile}" ]; then
+		pids=$( pgrep -F ${pidfile} 2>&1 )
+		_err=$?
+		[ ${_err} -eq 0 ] && kill -9 ${pids} && /bin/rm -f ${pidfile}
+	fi
+}
+
+status()
+{
+	if [ -f "${pidfile}" ]; then
+		pids=$( pgrep -F ${pidfile} 2>&1 )
+		_err=$?
+		if [ ${_err} -eq 0 ]; then
+			echo "${name} is running as pid ${pids}"
+			exit 0
+		else
+			echo "wrong pid: ${pids}"
+			exit 1
+		fi
+	else
+		echo "no pidfile $pidfile"
+		exit 1
+	fi
+}
+
+run_rc_command "$1"
diff --git a/net-mgmt/vmutils/pkg-descr b/net-mgmt/vmutils/pkg-descr
new file mode 100644
index 000000000000..84f9ad399c4f
--- /dev/null
+++ b/net-mgmt/vmutils/pkg-descr
@@ -0,0 +1,6 @@
+VictoriaMetrics is fast, cost-effective, and scalable monitoring solution
+and time series database.
+
+This package installs ancillary utilities and agent for VictoriaMetrics.
+
+WWW: https://victoriametrics.github.io/
diff --git a/net-mgmt/vmutils/pkg-plist b/net-mgmt/vmutils/pkg-plist
new file mode 100644
index 000000000000..606b04af287f
--- /dev/null
+++ b/net-mgmt/vmutils/pkg-plist
@@ -0,0 +1,17 @@
+bin/vmagent
+bin/vmalert
+bin/vmauth
+bin/vmbackup
+bin/vmctl
+bin/vmrestore
+%%PORTDOCS%%%%DOCSDIR%%/vmagent.md
+%%PORTDOCS%%%%DOCSDIR%%/vmagent.png
+%%PORTDOCS%%%%DOCSDIR%%/vmalert.md
+%%PORTDOCS%%%%DOCSDIR%%/vmauth.md
+%%PORTDOCS%%%%DOCSDIR%%/vmbackup.md
+%%PORTDOCS%%%%DOCSDIR%%/vmctl.md
+%%PORTDOCS%%%%DOCSDIR%%/vmgateway-access-control.jpg
+%%PORTDOCS%%%%DOCSDIR%%/vmgateway-overview.jpeg
+%%PORTDOCS%%%%DOCSDIR%%/vmgateway-rate-limiting.jpg
+%%PORTDOCS%%%%DOCSDIR%%/vmgateway.md
+%%PORTDOCS%%%%DOCSDIR%%/vmrestore.md



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