hipages / php-fpm_exporter

A prometheus exporter for PHP-FPM.
Apache License 2.0
604 stars 123 forks source link

Unable to use configuration file #93

Open J5lx opened 4 years ago

J5lx commented 4 years ago

I spied in the help output of the program that it seems to support a configuration file. So I tried to set phpfpm.scrape-uri through this configuration file (both in the default location ~/.php-fpm_exporter.yaml and in a custom location via --config), however in the end I was unable to pass the configuration to the exporter that way, even though the file does seem to be found (output: “Using config file: /home/j5lx/.php-fpm_exporter.yaml”). I tried various syntaxes:

…but to no avail. Supplying the uri via the PHP_FPM_SCRAPE_URI environment variable, however, did work. Is there some secret syntax that I just can’t figure out or is the configuration file perhaps not entirely wired up to the rest of the program?

I’m using version 1.1.1.

estahn commented 4 years ago

@J5lx Great question. To be frank I have not tested the config file part and just assumed cobra (the library we use) is dealing with it.

I will investigate this and document the use.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

J5lx commented 4 years ago

I would still like to see this bug fixed.

LcLz0 commented 2 years ago

How is this going? I see pr #154 addresses this issue, but is not reviewd yet?

rlf89 commented 1 year ago

If you are using systemd, then you can modify service which starts prometheus-php-fpm-exporter process.

systemctl edit --full prometheus-php-fpm-exporter.service

It has line Environment=PHP_FPM_SCRAPE_URI=unix:///run/php-fpm/php-fpm.sock;/status