Skip to content

Commit 95cf0b1

Browse files
committed
php-fpm prometheus exporter
1 parent 1643d4c commit 95cf0b1

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LABEL Description="Lightweight container with Nginx 1.22 & PHP 8.1 based on Alpi
55
# Setup document root
66
WORKDIR /var/www/html
77

8+
#RUN #wget https://github.com/hipages/php-fpm_exporter/releases/download/v2.2.0/php-fpm_exporter_2.2.0_darwin_amd64 -O /usr/bin/php-fpm_exporter
9+
810
# Install packages and remove default server definition
911
RUN apk add --no-cache \
1012
curl \
@@ -52,12 +54,18 @@ COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
5254
# Make sure files/folders needed by the processes are accessable when they run under the nobody user
5355
RUN chown -R nobody.nobody /var/www/html /run /var/lib/nginx /var/log/nginx
5456

57+
COPY --from=hipages/php-fpm_exporter /php-fpm_exporter /usr/bin/php-fpm_exporter
58+
RUN chmod +x /usr/bin/php-fpm_exporter
59+
5560
# Switch to use a non-root user from here on
5661
USER nobody
5762

5863
# Expose the port nginx is reachable on
5964
EXPOSE 8080
6065

66+
# Expose php-fpm_exporter port
67+
EXPOSE 9253
68+
6169
# Let supervisord start nginx & php-fpm
6270
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
6371

config/supervisord.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,12 @@ stderr_logfile=/dev/stderr
2121
stderr_logfile_maxbytes=0
2222
autorestart=false
2323
startretries=0
24+
25+
[program:php-fpm_exporter]
26+
command=php-fpm_exporter server --phpfpm.fix-process-count true --phpfpm.scrape-uri unix:///run/php-fpm.sock;/fpm-status
27+
stdout_logfile=/dev/stdout
28+
stdout_logfile_maxbytes=0
29+
stderr_logfile=/dev/stderr
30+
stderr_logfile_maxbytes=0
31+
autorestart=false
32+
startretries=0

0 commit comments

Comments
 (0)