First commit

This commit is contained in:
yo 2022-05-18 13:59:07 +02:00
commit c9dd3e22a5
5 changed files with 83 additions and 0 deletions

31
Makefile Normal file
View File

@ -0,0 +1,31 @@
PORTNAME= carp_exporter
DISTVERSIONPREFIX= v
DISTVERSION= 1.1
CATEGORIES= sysutils
MASTER_SITES= https://git.nosd.in/yo/carp_exporter/archive/
DISTNAME= ${DISTVERSIONPREFIX}${DISTVERSION}
MAINTAINER= johan@nosd.in
COMMENT= Export CARP status in Prometheus format
LICENSE= BSD2CLAUSE
USES= shebangfix python
SHEBANG_FILES= *.py
# Gitea packaging need some tweaks
WRKSRC= ${WRKDIR}/${PORTNAME}-${DISTVERSION}
EXTRACT_AFTER_ARGS= && ( [ -d ${PORTNAME} ] && ${MV} ${PORTNAME} ${PORTNAME}-${DISTVERSION} )
USERS= nobody
GROUPS= nobody
NO_BUILD= YES
NO_TEST= YES
USE_RC_SUBR= carp_exporter
do-install:
${INSTALL_SCRIPT} ${WRKSRC}/carp_exporter.py ${STAGEDIR}${PREFIX}/bin
.include <bsd.port.mk>

3
distinfo Normal file
View File

@ -0,0 +1,3 @@
TIMESTAMP = 1652872508
SHA256 (v1.1.tar.gz) = 206ff06b0d573f648b512de8da191935753a4653ae637d286792d48aa47e5f15
SIZE (v1.1.tar.gz) = 1321

44
files/carp_exporter.in Normal file
View File

@ -0,0 +1,44 @@
#!/bin/sh
# carp_exporter/files/carp_exporter.in 2021-08-20 09:12:03Z yo $
#
# PROVIDE: carp_exporter
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# carp_exporter_enable (bool): Set to "YES" to enable carp_exporter.
# (default: "NO")
#
# carp_exporter_listen (str): Exporter listening address - NOT IMPLEMENTED
# (default: ":8992")
#
# carp_exporter_logfile (str): carp_exporter logfile
# (default: "/var/log/carp_exporter.log")
#
. /etc/rc.subr
name=carp_exporter
rcvar=carp_exporter_enable
load_rc_config $name
: ${carp_exporter_enable="NO"}
: ${carp_exporter_listen=":8992"}
: ${carp_exporter_pidfile:="/var/run/carp_exporter.pid"}
: ${carp_exporter_user:="nobody"}
: ${carp_exporter_logfile="/var/log/carp_exporter.log"}
command="python3"
command_args="/usr/local/bin/carp_exporter.py > ${carp_exporter_logfile} 2>&1"
start_cmd="/usr/sbin/daemon -u ${carp_exporter_user} ${command} ${command_args}"
start_precmd="${name}_prestart"
carp_exporter_prestart()
{
touch ${carp_exporter_logfile}
chown ${carp_exporter_user} ${carp_exporter_logfile}
}
run_rc_command "$1"

3
pkg-descr Normal file
View File

@ -0,0 +1,3 @@
Export CARP status in Prometheus format.
WWW: https://git.nosd.in/yo/carp_exporter

2
pkg-plist Normal file
View File

@ -0,0 +1,2 @@
bin/carp_exporter.py
etc/rc.d/carp_exporter