ports/sysutils/ipmi_exporter/files/ipmi_exporter.in
Andreas E 364d89e1c0 sysutils/ipmi_exporter: Add listen-address configuration variable
Add separate configuration variable in the same way as
sysutils/node_exporter has for configuring a specific IP/hostname to
listen on.

PR:		281453
Approved by:	Goran Mekić <meka@tilda.center> (maintainer)
2024-10-28 06:51:33 +01:00

40 lines
990 B
Bash

#!/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: ""
# ipmi_exporter_listen_address (str): Set to the IP or hostname and port to bind to.
# Default: ":9290"
. /etc/rc.subr
name=ipmi_exporter
rcvar=${name}_enable
load_rc_config $name
: ${ipmi_exporter_enable:="NO"}
: ${ipmi_exporter_config:=""}
: ${ipmi_exporter_listen_address:=":9290"}
pidfile="/var/run/${name}.pid"
command="/usr/sbin/daemon"
procname="%%PREFIX%%/bin/${name}"
command_args="-S -p ${pidfile} ${procname} \
--web.listen-address=${ipmi_exporter_listen_address} \
--config.file=\"${ipmi_exporter_config}\""
start_precmd="${name}_precmd"
ipmi_exporter_precmd()
{
export PATH=${PATH}:/usr/local/sbin
}
run_rc_command "$1"