summaryrefslogtreecommitdiff
path: root/filesystems/py-prometheus-zfs
diff options
context:
space:
mode:
authorRobert Clausecker <fuz@FreeBSD.org>2024-09-27 12:48:46 +0200
committerRobert Clausecker <fuz@FreeBSD.org>2024-11-06 16:17:35 +0100
commit6e2da9672f79f44048d597f0f61e4646cdeade9d (patch)
treec92e4b3158e3419e8cec38e00227d08dcdaab3e9 /filesystems/py-prometheus-zfs
parentmath/sdpa: speed up build (diff)
filesystems: add new category for file systems and related utilities
The filesystems category houses file systems and file system utilities. It is added mainly to turn the sysutils/fusefs-* pseudo-category into a proper one, but is also useful for the sundry of other file systems related ports found in the tree. Ports that seem like they belong there are moved to the new category. Two ports, sysutils/fusefs-funionfs and sysutils/fusefs-fusepak are not moved as they currently don't fetch and don't have TIMESTAMP set in their distinfo, but that is required to be able to push a rename of the port by the pre-receive hook. Approved by: portmgr (rene) Reviewed by: mat Pull Request: https://github.com/freebsd/freebsd-ports/pull/302 PR: 281988
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.