git: 237cbc12220c - main - sysutils/ipmi_exporter: New Port

From: Guangyuan Yang <ygy_at_FreeBSD.org>
Date: Mon, 07 Nov 2022 18:05:26 UTC
The branch main has been updated by ygy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=237cbc12220cc789e21d75cda4622e090b534f3f

commit 237cbc12220cc789e21d75cda4622e090b534f3f
Author:     Goran Mekić <meka@tilda.center>
AuthorDate: 2022-11-07 18:05:15 +0000
Commit:     Guangyuan Yang <ygy@FreeBSD.org>
CommitDate: 2022-11-07 18:05:15 +0000

    sysutils/ipmi_exporter: New Port
    
    Changelog:      https://github.com/prometheus-community/ipmi_exporter
    
    PR:             267578
---
 sysutils/Makefile                             |  1 +
 sysutils/ipmi_exporter/Makefile               | 29 +++++++++++++++++++++++
 sysutils/ipmi_exporter/distinfo               |  5 ++++
 sysutils/ipmi_exporter/files/ipmi_exporter.in | 34 +++++++++++++++++++++++++++
 sysutils/ipmi_exporter/pkg-descr              |  5 ++++
 5 files changed, 74 insertions(+)

diff --git a/sysutils/Makefile b/sysutils/Makefile
index 378cf179681b..a59b7afef052 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -567,6 +567,7 @@
     SUBDIR += ipfs-go-fs-repo-migrations
     SUBDIR += ipget
     SUBDIR += ipmitool
+    SUBDIR += ipmi_exporter
     SUBDIR += ipsc
     SUBDIR += isc-cron
     SUBDIR += isomaster
diff --git a/sysutils/ipmi_exporter/Makefile b/sysutils/ipmi_exporter/Makefile
new file mode 100644
index 000000000000..15f34ae9687e
--- /dev/null
+++ b/sysutils/ipmi_exporter/Makefile
@@ -0,0 +1,29 @@
+PORTNAME=	ipmi_exporter
+DISTVERSIONPREFIX=	v
+DISTVERSION=	1.6.1
+CATEGORIES=	sysutils
+
+MAINTAINER=	meka@tilda.center
+COMMENT=	IPMI exporter for Prometheus
+WWW=		https://github.com/prometheus-community/ipmi_exporter
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+LIB_DEPENDS=	libfreeipmi.so:sysutils/freeipmi
+
+USES=		go:modules
+USE_RC_SUBR=	${PORTNAME}
+
+GO_MODULE=	github.com/prometheus-community/${PORTNAME}
+
+PLIST_FILES=	bin/${PORTNAME} \
+		etc/${PORTNAME}/ipmi_local.yml.sample \
+		etc/${PORTNAME}/ipmi_remote.yml.sample
+
+post-install:
+	@${MKDIR} ${STAGEDIR}${ETCDIR}
+	${INSTALL_DATA} ${WRKSRC}/ipmi_local.yml ${STAGEDIR}${ETCDIR}/ipmi_local.yml.sample
+	${INSTALL_DATA} ${WRKSRC}/ipmi_remote.yml ${STAGEDIR}${ETCDIR}/ipmi_remote.yml.sample
+
+.include <bsd.port.mk>
diff --git a/sysutils/ipmi_exporter/distinfo b/sysutils/ipmi_exporter/distinfo
new file mode 100644
index 000000000000..03dfd1ddfcbe
--- /dev/null
+++ b/sysutils/ipmi_exporter/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1661430489
+SHA256 (go/sysutils_ipmi_exporter/ipmi_exporter-v1.6.1/v1.6.1.mod) = fb908a34735a343073c6dfd6b58660577da1d42b6dc662a23dfa133e22c6a349
+SIZE (go/sysutils_ipmi_exporter/ipmi_exporter-v1.6.1/v1.6.1.mod) = 1398
+SHA256 (go/sysutils_ipmi_exporter/ipmi_exporter-v1.6.1/v1.6.1.zip) = 79cc9c0a435d3f2aa124ee85b6bfa0aa95a1fd2843dfc8a995880773b8529016
+SIZE (go/sysutils_ipmi_exporter/ipmi_exporter-v1.6.1/v1.6.1.zip) = 57539
diff --git a/sysutils/ipmi_exporter/files/ipmi_exporter.in b/sysutils/ipmi_exporter/files/ipmi_exporter.in
new file mode 100644
index 000000000000..da8e1c4b16ac
--- /dev/null
+++ b/sysutils/ipmi_exporter/files/ipmi_exporter.in
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# PROVIDE: ipmi_exporter
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# ipmi_exporter_enable (bool):	Set to YES to enable the IPMI exporter.
+#			Default: NO
+# ipmi_exporter_config (str):	Set to the path of configuration file.
+#			Default: ""
+
+. /etc/rc.subr
+name=ipmi_exporter
+rcvar=${name}_enable
+load_rc_config $name
+
+: ${impi_exporter_enable:="NO"}
+: ${impi_exporter_config:=""}
+
+pidfile="/var/run/${name}.pid"
+command="/usr/sbin/daemon"
+procname="%%PREFIX%%/bin/${name}"
+command_args="-S -p ${pidfile} ${procname} --config.file=\"${impi_exporter_config}\""
+start_precmd="${name}_precmd"
+
+ipmi_exporter_precmd()
+{
+  export PATH=${PATH}:/usr/local/sbin
+}
+
+run_rc_command "$1"
diff --git a/sysutils/ipmi_exporter/pkg-descr b/sysutils/ipmi_exporter/pkg-descr
new file mode 100644
index 000000000000..2c19bc0f0e71
--- /dev/null
+++ b/sysutils/ipmi_exporter/pkg-descr
@@ -0,0 +1,5 @@
+IPMI exporter for Prometheus.
+It supports both the regular /metrics endpoint, exposing metrics from the host
+that the exporter is running on, as well as an /ipmi endpoint that supports
+IPMI over RMCP - one exporter running on one host can be used to monitor a
+large number of IPMI interfaces by passing the target parameter to a scrape.