summaryrefslogtreecommitdiff
path: root/filesystems/py-prometheus-zfs
diff options
context:
space:
mode:
Diffstat (limited to 'filesystems/py-prometheus-zfs')
-rw-r--r--filesystems/py-prometheus-zfs/Makefile33
-rw-r--r--filesystems/py-prometheus-zfs/distinfo3
-rw-r--r--filesystems/py-prometheus-zfs/files/zfsprom.in32
-rw-r--r--filesystems/py-prometheus-zfs/pkg-descr3
4 files changed, 71 insertions, 0 deletions
diff --git a/filesystems/py-prometheus-zfs/Makefile b/filesystems/py-prometheus-zfs/Makefile
new file mode 100644
index 000000000000..b25e5527cb09
--- /dev/null
+++ b/filesystems/py-prometheus-zfs/Makefile
@@ -0,0 +1,33 @@
+PORTNAME= prometheus-zfs
+DISTVERSIONPREFIX= v
+DISTVERSION= 1.0.4
+CATEGORIES= filesystems sysutils python
+PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER= 0mp@FreeBSD.org
+COMMENT= Prometheus exporter for ZFS statistics using py-libzfs
+WWW= https://github.com/matusnovak/prometheus-zfs
+
+LICENSE= UNLICENSE
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}libzfs>=0:filesystems/py-libzfs@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}prometheus-client>=0:net-mgmt/py-prometheus-client@${PY_FLAVOR}
+
+USES= python shebangfix
+USE_GITHUB= yes
+GH_ACCOUNT= matusnovak
+USE_RC_SUBR= zfsprom
+SHEBANG_FILES= zfsprom.py
+
+NO_ARCH= yes
+NO_BUILD= yes
+
+SUB_LIST= PYTHON_CMD=${PYTHON_CMD}
+
+PLIST_FILES= sbin/zfsprom.py
+
+do-install:
+ ${INSTALL_SCRIPT} ${WRKSRC}/zfsprom.py ${STAGEDIR}${PREFIX}/sbin
+
+.include <bsd.port.mk>
diff --git a/filesystems/py-prometheus-zfs/distinfo b/filesystems/py-prometheus-zfs/distinfo
new file mode 100644
index 000000000000..89dbf2a5a11c
--- /dev/null
+++ b/filesystems/py-prometheus-zfs/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1642968848
+SHA256 (matusnovak-prometheus-zfs-v1.0.4_GH0.tar.gz) = aa005e5df3b8dfd3e4944a09cf7dbb21fe4150653a5e6b95681283ec86e6df25
+SIZE (matusnovak-prometheus-zfs-v1.0.4_GH0.tar.gz) = 3933
diff --git a/filesystems/py-prometheus-zfs/files/zfsprom.in b/filesystems/py-prometheus-zfs/files/zfsprom.in
new file mode 100644
index 000000000000..f4e3fbfc2e49
--- /dev/null
+++ b/filesystems/py-prometheus-zfs/files/zfsprom.in
@@ -0,0 +1,32 @@
+#! /bin/sh -
+#
+# SPDX-License-Identifier: (BSD-2-Clause or Unlicense)
+#
+# Copyright (c) 2021 Mateusz Piotrowski <0mp@FreeBSD.org>
+#
+
+# Add the following lines to rc.conf(5) to configure the zfsprom service:
+#
+# zfsprom_enable (bool): Set to "YES" to enable the service.
+# Default: "NO".
+
+# PROVIDE: zfsprom
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+
+. /etc/rc.subr
+
+name="zfsprom"
+rcvar="zfsprom_enable"
+
+load_rc_config "${name}"
+
+: "${zfsprom_enable:=NO}"
+
+pidfile="/var/run/${name}.pid"
+procname="%%PREFIX%%/sbin/zfsprom.py"
+command_interpreter="%%PYTHON_CMD%%"
+command="/usr/sbin/daemon"
+command_args="-o /var/log/${name}.log -p ${pidfile} -- ${procname}"
+
+run_rc_command "$1"
diff --git a/filesystems/py-prometheus-zfs/pkg-descr b/filesystems/py-prometheus-zfs/pkg-descr
new file mode 100644
index 000000000000..a75059149294
--- /dev/null
+++ b/filesystems/py-prometheus-zfs/pkg-descr
@@ -0,0 +1,3 @@
+This is a simple exporter for the Prometheus metrics for ZFS using
+py-libzfs. It comes with a zfsprom service that can be run in the
+background as an HTTP server.