Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Paste
P362
/opt/phpfpm_exporter/run.sh
Active
Public
Actions
Authored by
dereckson
on Oct 10 2024, 23:37.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F3644054: /opt/phpfpm_exporter/run.sh
Oct 10 2024, 23:37
2024-10-10 23:37:10 (UTC+0)
Subscribers
None
#!/bin/sh
# -------------------------------------------------------------
# Run php-fpm metrics exporter
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: BSD-2-Clause
# -------------------------------------------------------------
set
-e
# -------------------------------------------------------------
# Ensure user is root
#
# Note: POSIX shells don't always define $UID or $EUID.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# shellcheck disable=SC3028
if
[
"
${
EUID
:-$(
id -u
)
}
"
-ne
0
]
;
then
echo
"This command must be run as root."
>
&
2
exit
1
fi
# -------------------------------------------------------------
# Service configuration
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PHP_FPM_SOCKETS_ROOT
=
/var/run/web
PHP_FPM_SOCKETS_PATTERN
=
"php-fpm.sock"
BIND_ADDRESS
=
"127.0.0.1:9253"
BIND_ADDRESS
=
"172.27.27.35:9253"
# -------------------------------------------------------------
# Run service
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SOCKET_PATHS
=
$(
find
"
$PHP_FPM_SOCKETS_ROOT
"
-type s -name
"
$PHP_FPM_SOCKETS_PATTERN
"
-print0
|
xargs -0 -n1
echo
--phpfpm.socket-paths
|
paste -sd
" "
-
)
# shellcheck disable=SC2086
echo
sudo -u web-admin phpfpm_exporter --web.listen-address
=
"
$BIND_ADDRESS
"
--phpfpm.status-path
=
"/php-fpm-status"
$SOCKET_PATHS
Event Timeline
dereckson
created this paste.
Oct 10 2024, 23:37
2024-10-10 23:37:10 (UTC+0)
dereckson
mentioned this in
T1999: Export metrics for php-fpm
.
Oct 10 2024, 23:37
2024-10-10 23:37:35 (UTC+0)
Log In to Comment