Lines 9-22
Link Here
|
9 |
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf |
9 |
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf |
10 |
# to enable this service: |
10 |
# to enable this service: |
11 |
# |
11 |
# |
12 |
# phpfpm_exporter_enable (bool): Set to NO by default. |
12 |
# phpfpm_exporter_enable (bool): Set to NO by default. |
13 |
# Set it to YES to enable phpfpm_exporter. |
13 |
# Set it to YES to enable phpfpm_exporter. |
14 |
# phpfpm_exporter_user (string): Set user that phpfpm_exporter will run under |
14 |
# phpfpm_exporter_user (string): Set user that phpfpm_exporter will run under |
15 |
# Default is "nobody". |
15 |
# Default is "prometheus". |
16 |
# phpfpm_exporter_group (string): Set group that phpfpm_exporter will run under |
16 |
# phpfpm_exporter_group (string): Set group that phpfpm_exporter will run under |
17 |
# Default is "nobody". |
17 |
# Default is "prometheus". |
18 |
# phpfpm_exporter_endpoint (string): Set status endpoint |
18 |
# phpfpm_exporter_endpoint (string): Set status endpoint |
19 |
# Default is "http://127.0.0.1:9000/status". |
19 |
# Default is "http://127.0.0.1:9000/status". |
|
|
20 |
# phpfpm_exporter_fastcgi (string): Set fastcgi url |
21 |
# Default is "", If this is set, fastcgi will be used instead of HTTP. |
20 |
# phpfpm_exporter_listen_address (string): Set ip:port that phpfpm_exporter will listen on |
22 |
# phpfpm_exporter_listen_address (string): Set ip:port that phpfpm_exporter will listen on |
21 |
# Default is "127.0.0.1:8080". |
23 |
# Default is "127.0.0.1:8080". |
22 |
|
24 |
|
Lines 24-42
Link Here
|
24 |
|
26 |
|
25 |
name=phpfpm_exporter |
27 |
name=phpfpm_exporter |
26 |
rcvar=phpfpm_exporter_enable |
28 |
rcvar=phpfpm_exporter_enable |
|
|
29 |
desc="PHP-FPM prometheus exporter" |
27 |
|
30 |
|
28 |
load_rc_config $name |
31 |
load_rc_config $name |
29 |
|
32 |
|
30 |
: ${phpfpm_exporter_enable:="NO"} |
33 |
: ${phpfpm_exporter_enable:=NO} |
31 |
: ${phpfpm_exporter_user:="nobody"} |
34 |
: ${phpfpm_exporter_user:=prometheus} |
32 |
: ${phpfpm_exporter_group:="nobody"} |
35 |
: ${phpfpm_exporter_group:=prometheus} |
33 |
: ${phpfpm_exporter_endpoint:="http://127.0.0.1:9000/status"} |
36 |
: ${phpfpm_exporter_endpoint=http://127.0.0.1:9000/status} |
34 |
: ${phpfpm_exporter_listen_address:="127.0.0.1:8080"} |
37 |
: ${phpfpm_exporter_listen_address:=127.0.0.1:8080} |
35 |
|
38 |
|
36 |
|
39 |
|
37 |
pidfile=/var/run/phpfpm_exporter.pid |
40 |
pidfile=/var/run/phpfpm_exporter.pid |
38 |
command="/usr/sbin/daemon" |
41 |
command=/usr/sbin/daemon |
39 |
procname="%%PREFIX%%/bin/phpfpm_exporter" |
42 |
procname=%%PREFIX%%/bin/phpfpm_exporter |
40 |
command_args="-p ${pidfile} /usr/bin/env ${procname} \ |
43 |
command_args="-p ${pidfile} /usr/bin/env ${procname} \ |
41 |
--addr ${phpfpm_exporter_listen_address} \ |
44 |
--addr ${phpfpm_exporter_listen_address} \ |
42 |
--endpoint ${phpfpm_exporter_endpoint}" |
45 |
--endpoint ${phpfpm_exporter_endpoint}" |
Lines 45-54
Link Here
|
45 |
|
48 |
|
46 |
phpfpm_exporter_startprecmd() |
49 |
phpfpm_exporter_startprecmd() |
47 |
{ |
50 |
{ |
48 |
if [ ! -e ${pidfile} ]; then |
51 |
if [ -n "$phpfpm_exporter_fastcgi" ]; then |
49 |
install -o ${phpfpm_exporter_user} -g ${phpfpm_exporter_group} /dev/null ${pidfile}; |
52 |
command_args="$command_args --fastcgi $phpfpm_exporter_fastcgi" |
50 |
fi |
53 |
fi |
|
|
54 |
|
55 |
if [ -e ${pidfile} ]; then |
56 |
chown ${phpfpm_exporter_user}:${phpfpm_exporter_group} ${pidfile}; |
57 |
else |
58 |
install -o ${phpfpm_exporter_user} -g ${phpfpm_exporter_group} /dev/null ${pidfile}; |
59 |
fi |
51 |
} |
60 |
} |
52 |
|
61 |
|
53 |
load_rc_config $name |
|
|
54 |
run_rc_command "$1" |
62 |
run_rc_command "$1" |