Page MenuHomeDevCentral

Export metrics for php-fpm
Closed, ResolvedPublic

Description

As part of the webserver-alkane role, we could expose Prometheus metrics.

Candidates

For bakins, a port is available under net-mgmt/phpfpm_exporter.

Event Timeline

dereckson renamed this task from Metrics for php-fpm to Export metrics for php-fpm.Aug 4 2024, 17:05
dereckson moved this task from Backlog to Prometheus on the Monitoring and reporting board.
dereckson triaged this task as High priority.Aug 4 2024, 17:31

Test of https://github.com/Lusitaniae/phpfpm_exporter available for WindRiver on Grafana:

There is already a FreeBSD port called php-fpm_exporter, it's for https://github.com/hipages/php-fpm_exporter

The one we test is nice, as it uses sockets.

dereckson updated the task description. (Show Details)

D3502 operations configuration is ready.

A service with this logic would be useful to add in port:

1#!/bin/sh
2
3# -------------------------------------------------------------
4# Run php-fpm metrics exporter
5# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6# Project: Nasqueron
7# License: BSD-2-Clause
8# -------------------------------------------------------------
9
10set -e
11
12# -------------------------------------------------------------
13# Ensure user is root
14#
15# Note: POSIX shells don't always define $UID or $EUID.
16# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
17
18# shellcheck disable=SC3028
19if [ "${EUID:-$(id -u)}" -ne 0 ]; then
20 echo "This command must be run as root." >&2
21 exit 1
22fi
23
24# -------------------------------------------------------------
25# Service configuration
26# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
27
28PHP_FPM_SOCKETS_ROOT=/var/run/web
29PHP_FPM_SOCKETS_PATTERN="php-fpm.sock"
30BIND_ADDRESS="127.0.0.1:9253"
31BIND_ADDRESS="172.27.27.35:9253"
32
33# -------------------------------------------------------------
34# Run service
35# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
36
37SOCKET_PATHS=$(find "$PHP_FPM_SOCKETS_ROOT" -type s -name "$PHP_FPM_SOCKETS_PATTERN" -print0 | xargs -0 -n1 echo --phpfpm.socket-paths | paste -sd " " -)
38
39# shellcheck disable=SC2086
40echo sudo -u web-admin phpfpm_exporter --web.listen-address="$BIND_ADDRESS" --phpfpm.status-path="/php-fpm-status" $SOCKET_PATHS

Logic from P362 run.sh has been injected to D3509 service.