beckbikang / php-fpm-exporter

Prometheus exporter for php-fpm status. 需要在metric里面增加一些自定义的标签

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

php-fpm-exporter

增加了application参数

Export php-fpm metrics in Prometheus format.

See Releases for pre-built binaries.

Also availible on Docker Hub bakins/php-fpm-exporter

Build

Requires Go. Tested with Go 1.12.

Clone this repo locally and run build:

mkdir -p $HOME/src
cd $HOME/src
git clone https://github.com/beckbikang/php-fpm-exporter
cd php-fpm-exporter
./script/build

You should then have two executables: php-fpm-exporter.linux.amd64 and php-fpm-exporter.darwin.amd64

You may want to rename for your local OS, ie mv php-fpm-exporter.darwin.amd64 php-fpm-exporter

Running

./main
usage: main [<flags>]

Flags:
  -h, --help                   Show context-sensitive help (also try --help-long and --help-man).
      --addr="127.0.0.1:8080"  listen address for metrics handler
      --application="default"  application name
      --endpoint="http://127.0.0.1:9000/status"  
                               url for php-fpm status
      --fastcgi=FASTCGI        fastcgi url. If this is set, fastcgi will be used instead of HTTP
      --web.telemetry-path="/metrics"  
                               Path under which to expose metrics. Cannot be 

When running, a simple healthcheck is available on /healthz

To use the HTTP endpoint you must pass through /status in your webserver and configure php-fpm to handle status requests. Example for nginx: https://easyengine.io/tutorials/php/fpm-status-page/

To use Fastcgi, set --fastcgi to a url such as tcp://127.0.0.1:9090/status if php-fpm is listening on a tcp socket or unix:///path/to/php.sock for a unix socket. Note: php-fpm must be configured to use /status if using a unix socket, php-fpm-exporter does not currently support changing this.

Metrics

Metrics will be exposes on /metrics

LICENSE

See LICENSE

loosely based on https://github.com/peakgames/php-fpm-prometheus/ which is MIT.

About

Prometheus exporter for php-fpm status. 需要在metric里面增加一些自定义的标签

License:MIT License


Languages

Language:Go 89.9%Language:Shell 8.9%Language:Dockerfile 1.2%