hipages / php-fpm_exporter

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

Exporter scrape failed #108

Closed phutoan31299 closed 4 years ago

phutoan31299 commented 4 years ago

Hello, I'm having a problem\ Exporter doesn't get the metrics (Scrape failed). I think the reason is my config doesn't fit with my server I created file config in order to convenient for set up

#config.sh
#!/bin/bash
#PHP-FPM Environment Variables
PHP_FPM_WEB_LISTEN_ADDRESS="10.60.32.187:21201"
PHP_FPM_WEB_TELEMETRY_PATH="/metrics"
PHP_FPM_SCRAPE_URI=tcp://127.0.0.1:9000/status
PHP_FPM_FIX_PROCESS_COUNT=true
PHP_FPM_LOG_LEVEL=debug

After running exporter, exporter doesnt get the data, Pool is empty

# HELP phpfpm_scrape_failures The number of failures scraping from PHP-FPM.
# TYPE phpfpm_scrape_failures counter
phpfpm_scrape_failures{pool="",scrape_uri="tcp://127.0.0.1:9000/status"} 1
# HELP phpfpm_up Could PHP-FPM be reached?
# TYPE phpfpm_up gauge
phpfpm_up{pool="",scrape_uri="tcp://127.0.0.1:9000/status"} 0

I doubt about variables PHP_FPM_SCRAPE_URI was set up wrong, not fit vs system. (I get FastCGI address in file php-fpm.conf)

; The address on which to accept FastCGI requests.
; Valid syntaxes are:
;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific IPv4 address on
;                            a specific port;
;   '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
;                            a specific port;
;   'port'                 - to listen on a TCP socket to all IPv4 addresses on a
;                            specific port;
;   '[::]:port'            - to listen on a TCP socket to all addresses
;                            (IPv6 and IPv4-mapped) on a specific port;
;   '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 127.0.0.1:9000

I look forward to receiving the help of everyone. Thank you!

phutoan31299 commented 4 years ago

@estahn Can u help me plz :( Thanks a lot

phutoan31299 commented 4 years ago

(Update) I still cant fix the problem. Plz help me

[ttvtnet@localhost php-fpm_exporter]$ go run main.go get "tcp://127.0.0.1:9000/status"
ERRO[0000] Pool[tcp://127.0.0.1:9000/status]: File not found. 
ERRO[0000] invalid character 'F' looking for beginning of value 
ERRO[0000] invalid character 'F' looking for beginning of value 
Address:                tcp://127.0.0.1:9000/status    
Pool:                                                  
Start time:             Mon, 01 Jan 0001 00:00:00 +0000
Start since:            0                              
Accepted connections:   0                              
Listen Queue:           0                              
Max Listen Queue:       0                              
Listen Queue Length:    0                              
Idle Processes:         0                              
Active Processes:       0                              
Total Processes:        0                              
Max active processes:   0                              
Max children reached:   0                              
Slow requests:          0  
phutoan31299 commented 4 years ago

My problem is enable pm.status_path in file config PHP-FPM. I have done my work. Tks a lot <3

estahn commented 4 years ago

@phutoan31299 Apologies it has taken me so long to respond. I'm glad you could resolve your issue. 👍