Page MenuHomeDevCentral

/opt/phpfpm_exporter/run.sh

Authored By
dereckson
Oct 10 2024, 23:37
Size
1 KB
Referenced Files
None
Subscribers
None

/opt/phpfpm_exporter/run.sh

#!/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

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2188340
Default Alt Text
/opt/phpfpm_exporter/run.sh (1 KB)

Event Timeline