|
Lines 22-27
Link Here
|
| 22 |
# snmp_exporter_config_file (string) Set the location of the snmp_exporter config |
22 |
# snmp_exporter_config_file (string) Set the location of the snmp_exporter config |
| 23 |
# configuration file. |
23 |
# configuration file. |
| 24 |
# Default is "%%PREFIX%%/etc/snmp_exporter/snmp.yml" |
24 |
# Default is "%%PREFIX%%/etc/snmp_exporter/snmp.yml" |
|
|
25 |
# snmp_exporter_log_file (string) Set file that snmp_exporter will log to. |
| 26 |
# Default is "/var/log/snmp_exporter.log" |
| 25 |
|
27 |
|
| 26 |
. /etc/rc.subr |
28 |
. /etc/rc.subr |
| 27 |
|
29 |
|
|
Lines 36-46
load_rc_config $name
Link Here
|
| 36 |
: ${snmp_exporter_args:=""} |
38 |
: ${snmp_exporter_args:=""} |
| 37 |
: ${snmp_exporter_listen_address:=":9116"} |
39 |
: ${snmp_exporter_listen_address:=":9116"} |
| 38 |
: ${snmp_exporter_config_file:="%%PREFIX%%/etc/snmp_exporter/snmp.yml"} |
40 |
: ${snmp_exporter_config_file:="%%PREFIX%%/etc/snmp_exporter/snmp.yml"} |
|
|
41 |
: ${snmp_exporter_log_file:="/var/log/snmp_exporter.log"} |
| 39 |
|
42 |
|
| 40 |
pidfile=/var/run/snmp_exporter.pid |
43 |
pidfile=/var/run/snmp_exporter.pid |
| 41 |
command="/usr/sbin/daemon" |
44 |
command="/usr/sbin/daemon" |
| 42 |
procname="%%PREFIX%%/bin/snmp_exporter" |
45 |
procname="%%PREFIX%%/bin/snmp_exporter" |
| 43 |
command_args="-p ${pidfile} /usr/bin/env ${procname} \ |
46 |
command_args="-p ${pidfile} -o ${snmp_exporter_log_file} \ |
|
|
47 |
/usr/bin/env ${procname} \ |
| 44 |
--web.listen-address=${snmp_exporter_listen_address} \ |
48 |
--web.listen-address=${snmp_exporter_listen_address} \ |
| 45 |
--config.file=${snmp_exporter_config_file} \ |
49 |
--config.file=${snmp_exporter_config_file} \ |
| 46 |
${snmp_exporter_args}" |
50 |
${snmp_exporter_args}" |
|
Lines 52-59
snmp_exporter_startprecmd()
Link Here
|
| 52 |
if [ ! -e ${pidfile} ]; then |
56 |
if [ ! -e ${pidfile} ]; then |
| 53 |
install -o ${snmp_exporter_user} -g ${snmp_exporter_group} /dev/null ${pidfile}; |
57 |
install -o ${snmp_exporter_user} -g ${snmp_exporter_group} /dev/null ${pidfile}; |
| 54 |
fi |
58 |
fi |
| 55 |
if [ ! -d ${snmp_exporter_textfile_dir} ]; then |
59 |
if [ ! -f ${snmp_exporter_log_file} ]; then |
| 56 |
install -d -o ${snmp_exporter_user} -g ${snmp_exporter_group} -m 1755 ${snmp_exporter_textfile_dir} |
60 |
install -o ${snmp_exporter_user} -g ${snmp_exporter_group} -m 640 /dev/null ${snmp_exporter_log_file} |
| 57 |
fi |
61 |
fi |
| 58 |
} |
62 |
} |
| 59 |
|
63 |
|