Lusitaniae / phpfpm_exporter

Prometheus exporter for PHP-FPM.
Apache License 2.0
80 stars 20 forks source link

Failed to scrape socket: Failed to parse File not found. #23

Closed maze-m closed 2 years ago

maze-m commented 3 years ago

Hi there!

I've downloaded the PHP-FPM Exporter and installed it in /opt/phpfpm_exporter/ and have written an Unit-File with the following content:

[Unit] Description=PHP-FPM Exporter After=network.target

[Service] Type=simple User=nginx Group=nginx ExecStart=/opt/phpfpm_exporter/phpfpm_exporter --phpfpm.socket-directories=/var/run/ SyslogIdentifier=php-fpm-exporter Restart=always

[Install] WantedBy=multi-user.target`

I've multiple Sockets under '/var/run/' which I wanna have a in my Grafana Dashboard. When I start it I can see the following in '/var/log/messages':

Oct 14 22:05:25 host11 php-fpm-exporter: 2021/10/14 22:05:25 Failed to scrape socket: dial unix /var/run/systemd/cgroups-agent: connect: permission denied Oct 14 22:05:25 host11 php-fpm-exporter: 2021/10/14 22:05:25 Failed to scrape socket: dial unix /var/run/systemd/journal/socket: connect: protocol wrong type for socket Oct 14 22:05:25 host11 php-fpm-exporter: 2021/10/14 22:05:25 Failed to scrape socket: unexpected EOF Oct 14 22:05:25 host11 php-fpm-exporter: 2021/10/14 22:05:25 Failed to scrape socket: dial unix /var/run/systemd/notify: connect: protocol wrong type for socket Oct 14 22:05:25 host11 systemd: Incoming private connection from unprivileged client, refusing: Operation not permitted Oct 14 22:05:25 host11 php-fpm-exporter: 2021/10/14 22:05:25 Failed to scrape socket: read unix @->/run/systemd/private: read: connection reset by peer Oct 14 22:05:25 host11 php-fpm-exporter: 2021/10/14 22:05:25 Failed to scrape socket: dial unix /var/run/systemd/shutdownd: connect: permission denied Oct 14 22:05:25 host11 php-fpm-exporter: 2021/10/14 22:05:25 Failed to scrape socket: dial unix /var/run/udev/control: connect: permission denied Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: read unix @->/run/dbus/system_bus_socket: read: connection reset by peer Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: Failed to parse 403 Forbidden Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: read unix @->/run/gssproxy.sock: read: connection reset by peer Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: Failed to parse File not found. Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: Failed to parse File not found. Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: Failed to parse File not found. Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: Failed to parse File not found. Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: Failed to parse File not found. Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: Failed to parse File not found. Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: Failed to parse File not found. Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: Failed to parse File not found. Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: Failed to parse File not found. Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: Failed to parse File not found. Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: read unix @->/var/run/rpcbind.sock: read: connection reset by peer Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: dial unix /var/run/systemd/cgroups-agent: connect: permission denied Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: dial unix /var/run/systemd/journal/socket: connect: protocol wrong type for socket Oct 14 22:05:55 host11 systemd: Incoming private connection from unprivileged client, refusing: Operation not permitted Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: unexpected EOF Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: dial unix /var/run/systemd/notify: connect: protocol wrong type for socket Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: write unix @->/run/systemd/private: write: broken pipe Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: dial unix /var/run/systemd/shutdownd: connect: permission denied Oct 14 22:05:55 host11 php-fpm-exporter: 2021/10/14 22:05:55 Failed to scrape socket: dial unix /var/run/udev/control: connect: permission denied

What is wrong with my code especially under 'ExecStart' in my Unit-File?

Nenoni13 commented 2 years ago

Hello. I have the same problem with mulitples socket fpm.

Oct 11 17:45:29 nenonipark phpfpm_exporter[164004]: 2022/10/11 17:45:29 Failed to scrape socket: Failed to parse File not found. Oct 11 17:45:29 nenonipark phpfpm_exporter[164004]: 2022/10/11 17:45:29 Failed to scrape socket: Failed to parse File not found. Oct 11 17:45:44 nenonipark phpfpm_exporter[164004]: 2022/10/11 17:45:44 Failed to scrape socket: Failed to parse File not found. Oct 11 17:45:44 nenonipark phpfpm_exporter[164004]: 2022/10/11 17:45:44 Failed to scrape socket: Failed to parse File not found.

Have you any idea ?

Regards,

Lusitaniae commented 2 years ago

error is --phpfpm.socket-directories=/var/run/

/var/run is used by many different processes and phpfpm_exporter will have no access to such files, hence all the permission errors while trying to connect to a variety of files in /var/run

you should make a directory used by php-fpm processes only i.e. /var/run/php-fpm/

Nenoni13 commented 2 years ago

okay great thank you!