|
Lines 7-24
Link Here
|
| 7 |
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf |
7 |
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf |
| 8 |
# to enable this service: |
8 |
# to enable this service: |
| 9 |
# |
9 |
# |
| 10 |
# prometheus_enable (bool): Set to NO by default |
10 |
# prometheus_enable (bool) |
| 11 |
# Set it to YES to enable prometheus |
11 |
# Set to NO by default |
| 12 |
# prometheus_user (string): Set user to run prometheus |
12 |
# Set it to YES to enable prometheus |
| 13 |
# Default is "prometheus" |
13 |
# prometheus_user (string) |
| 14 |
# prometheus_group (string): Set group to run prometheus |
14 |
# Set user to run prometheus |
| 15 |
# Default is "prometheus" |
15 |
# Default is "%%PROMETHEUS_USER%%" |
| 16 |
# prometheus_data_dir (string): Set dir to run prometheus in |
16 |
# prometheus_group (string) |
| 17 |
# Default is "/var/db/prometheus" |
17 |
# Set group to run prometheus |
| 18 |
# prometheus_log_file (string): Set file that prometheus will log to |
18 |
# Default is "%%PROMETHEUS_GROUP%%" |
| 19 |
# Default is "/var/log/prometheus.log" |
19 |
# prometheus_data_dir (string) |
| 20 |
# prometheus_args (string): Set additional command line arguments |
20 |
# Set dir to run prometheus in |
| 21 |
# Default is "" |
21 |
# Default is "%%PROMETHEUS_DB_DIR%%" |
|
|
22 |
# prometheus_consoles (string) |
| 23 |
# Set dir that contains Prometheus consoles |
| 24 |
# Default is "%%PROMETHEUS_CONSOLES_DIR%%" |
| 25 |
# prometheus_console_libraries (string) |
| 26 |
# Set dir containing Prometheus console libraries |
| 27 |
# Default is "%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%" |
| 28 |
# prometheus_flags (string) |
| 29 |
# Set additional command line arguments |
| 30 |
# Default is "" |
| 22 |
|
31 |
|
| 23 |
. /etc/rc.subr |
32 |
. /etc/rc.subr |
| 24 |
|
33 |
|
|
Lines 28-39
rcvar=prometheus_enable
Link Here
|
| 28 |
load_rc_config $name |
37 |
load_rc_config $name |
| 29 |
|
38 |
|
| 30 |
: ${prometheus_enable:="NO"} |
39 |
: ${prometheus_enable:="NO"} |
| 31 |
: ${prometheus_user:="prometheus"} |
40 |
: ${prometheus_user:="%%PROMETHEUS_USER%%"} |
| 32 |
: ${prometheus_group:="prometheus"} |
41 |
: ${prometheus_group:="%%PROMETHEUS_GROUP%%"} |
| 33 |
: ${prometheus_config:="%%PREFIX%%/etc/prometheus.yml"} |
42 |
: ${prometheus_config:="%%PREFIX%%/etc/prometheus.yml"} |
| 34 |
: ${prometheus_data_dir:="/var/db/prometheus"} |
43 |
: ${prometheus_data_dir:="%%PROMETHEUS_DB_DIR%%"} |
| 35 |
: ${prometheus_log_file:="/var/log/prometheus.log"} |
44 |
: ${prometheus_consoles_dir:="%%PROMETHEUS_CONSOLES_DIR%%"} |
| 36 |
: ${prometheus_args:=""} |
45 |
: ${prometheus_console_libraries_dir:="%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%"} |
|
|
46 |
: ${prometheus_flags:=""} |
| 37 |
|
47 |
|
| 38 |
pidfile="/var/run/${name}.pid" |
48 |
pidfile="/var/run/${name}.pid" |
| 39 |
required_files="${prometheus_config}" |
49 |
required_files="${prometheus_config}" |
|
Lines 41-50
command="/usr/sbin/daemon"
Link Here
|
| 41 |
procname="%%PREFIX%%/bin/${name}" |
51 |
procname="%%PREFIX%%/bin/${name}" |
| 42 |
sig_reload="HUP" |
52 |
sig_reload="HUP" |
| 43 |
extra_commands="reload" |
53 |
extra_commands="reload" |
| 44 |
command_args="-p ${pidfile} /usr/bin/env ${procname} \ |
54 |
command_args="-p ${pidfile} -m 3 -T prometheus \ |
|
|
55 |
/usr/bin/env ${procname} \ |
| 45 |
--config.file=${prometheus_config} \ |
56 |
--config.file=${prometheus_config} \ |
| 46 |
--storage.tsdb.path=${prometheus_data_dir} \ |
57 |
--storage.tsdb.path=${prometheus_data_dir} \ |
| 47 |
${prometheus_args} >> ${prometheus_log_file} 2>&1" |
58 |
--web.console.templates=${prometheus_consoles_dir} \ |
|
|
59 |
--web.console.libraries=${prometheus_console_libraries_dir} \ |
| 60 |
${prometheus_flags}" |
| 48 |
|
61 |
|
| 49 |
start_precmd=prometheus_startprecmd |
62 |
start_precmd=prometheus_startprecmd |
| 50 |
|
63 |
|
|
Lines 73-85
prometheus_startprecmd()
Link Here
|
| 73 |
-g ${prometheus_group} \ |
86 |
-g ${prometheus_group} \ |
| 74 |
/dev/null ${pidfile}; |
87 |
/dev/null ${pidfile}; |
| 75 |
fi |
88 |
fi |
| 76 |
if [ ! -f "${prometheus_log_file}" ]; then |
|
|
| 77 |
install \ |
| 78 |
-o ${prometheus_user} \ |
| 79 |
-g ${prometheus_group} \ |
| 80 |
-m 640 \ |
| 81 |
/dev/null ${prometheus_log_file}; |
| 82 |
fi |
| 83 |
if [ ! -d ${prometheus_data_dir} ]; then |
89 |
if [ ! -d ${prometheus_data_dir} ]; then |
| 84 |
install \ |
90 |
install \ |
| 85 |
-d \ |
91 |
-d \ |