View | Details | Raw Unified | Return to bug 226402 | Differences between
and this patch

Collapse All | Expand All

(-)sysutils/node_exporter/files/node_exporter.in (-1 / +7 lines)
Lines 1-59 Link Here
1
#!/bin/sh
1
#!/bin/sh
2
2
3
# PROVIDE: node_exporter
3
# PROVIDE: node_exporter
4
# REQUIRE: LOGIN
4
# REQUIRE: LOGIN
5
# KEYWORD: shutdown
5
# KEYWORD: shutdown
6
#
6
#
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
# node_exporter_enable (bool):          Set to NO by default.
10
# node_exporter_enable (bool):          Set to NO by default.
11
#               Set it to YES to enable node_exporter.
11
#               Set it to YES to enable node_exporter.
12
# node_exporter_user (string):          Set user that node_exporter will run under
12
# node_exporter_user (string):          Set user that node_exporter will run under
13
#               Default is "nobody".
13
#               Default is "nobody".
14
# node_exporter_group (string):         Set group that node_exporter will run under
14
# node_exporter_group (string):         Set group that node_exporter will run under
15
#               Default is "nobody".
15
#               Default is "nobody".
16
# node_exporter_args (string):          Set extra arguments to pass to node_exporter
16
# node_exporter_args (string):          Set extra arguments to pass to node_exporter
17
#               Default is "".
17
#               Default is "".
18
# node_exporter_listen_address (string):Set ip:port that node_exporter will listen on
18
# node_exporter_listen_address (string):Set ip:port that node_exporter will listen on
19
#               Default is ":9100".
19
#               Default is ":9100".
20
# node_exporter_textfile_dir (string):  Set directory that node_exporter will watch
20
# node_exporter_textfile_dir (string):  Set directory that node_exporter will watch
21
#               Default is "/var/tmp/node_exporter".
21
#               Default is "/var/tmp/node_exporter".
22
# node_exporter_log_file (string):      Set file that node_exporter will log to.
23
#               Default is "/var/log/node_exporter.log"
22
24
23
. /etc/rc.subr
25
. /etc/rc.subr
24
26
25
name=node_exporter
27
name=node_exporter
26
rcvar=node_exporter_enable
28
rcvar=node_exporter_enable
27
29
28
load_rc_config $name
30
load_rc_config $name
29
31
30
: ${node_exporter_enable:="NO"}
32
: ${node_exporter_enable:="NO"}
31
: ${node_exporter_user:="nobody"}
33
: ${node_exporter_user:="nobody"}
32
: ${node_exporter_group:="nobody"}
34
: ${node_exporter_group:="nobody"}
33
: ${node_exporter_args:=""}
35
: ${node_exporter_args:=""}
34
: ${node_exporter_listen_address:=":9100"}
36
: ${node_exporter_listen_address:=":9100"}
35
: ${node_exporter_textfile_dir:="/var/tmp/node_exporter"}
37
: ${node_exporter_textfile_dir:="/var/tmp/node_exporter"}
38
: ${node_exporter_log_file:="/var/log/node_exporter.log"}
36
39
37
40
38
pidfile=/var/run/node_exporter.pid
41
pidfile=/var/run/node_exporter.pid
39
command="/usr/sbin/daemon"
42
command="/usr/sbin/daemon"
40
procname="%%PREFIX%%/bin/node_exporter"
43
procname="%%PREFIX%%/bin/node_exporter"
41
command_args="-p ${pidfile} /usr/bin/env ${procname} \
44
command_args="-p ${pidfile} /usr/bin/env ${procname} \
42
    --web.listen-address=${node_exporter_listen_address} \
45
    --web.listen-address=${node_exporter_listen_address} \
43
    --collector.textfile.directory=${node_exporter_textfile_dir} \
46
    --collector.textfile.directory=${node_exporter_textfile_dir} \
44
    ${node_exporter_args}"
47
    ${node_exporter_args} >> ${node_exporter_log_file} 2>&1"
45
48
46
start_precmd=node_exporter_startprecmd
49
start_precmd=node_exporter_startprecmd
47
50
48
node_exporter_startprecmd()
51
node_exporter_startprecmd()
49
{
52
{
50
    if [ ! -e ${pidfile} ]; then
53
    if [ ! -e ${pidfile} ]; then
51
        install -o ${node_exporter_user} -g ${node_exporter_group} /dev/null ${pidfile};
54
        install -o ${node_exporter_user} -g ${node_exporter_group} /dev/null ${pidfile};
52
    fi
55
    fi
53
    if [ ! -d ${node_exporter_textfile_dir} ]; then
56
    if [ ! -d ${node_exporter_textfile_dir} ]; then
54
        install -d -o ${node_exporter_user} -g ${node_exporter_group} -m 1755 ${node_exporter_textfile_dir}
57
        install -d -o ${node_exporter_user} -g ${node_exporter_group} -m 1755 ${node_exporter_textfile_dir}
55
    fi
58
    fi
59
    if [ ! -f ${node_exporter_log_file} ]; then
60
        install -o ${node_exporter_user} -g ${node_exporter_group} -m 640 /dev/null ${node_exporter_log_file}
61
    fi
56
}
62
}
57
63
58
load_rc_config $name
64
load_rc_config $name
59
run_rc_command "$1"
65
run_rc_command "$1"

Return to bug 226402