Documentation
¶
Overview ¶
Package phpfpm provides convenient access to PHP-FPM pool data
Package phpfpm provides convenient access to PHP-FPM pool data
Index ¶
Constants ¶
const PoolProcessRequestEnding string = "Ending"
PoolProcessRequestEnding defines a process that is about to end.
const PoolProcessRequestFinishing string = "Finishing"
PoolProcessRequestFinishing defines a process that is about to finish.
const PoolProcessRequestIdle string = "Idle"
PoolProcessRequestIdle defines a process that is idle.
const PoolProcessRequestInfo string = "Getting request informations"
PoolProcessRequestInfo defines a process that is getting request information.
const PoolProcessRequestReadingHeaders string = "Reading headers"
PoolProcessRequestReadingHeaders defines a process that is reading headers.
const PoolProcessRequestRunning string = "Running"
PoolProcessRequestRunning defines a process that is running.
Variables ¶
This section is empty.
Functions ¶
func CountProcessState ¶ added in v0.3.0
func CountProcessState(processes []PoolProcess) (active int64, idle int64, total int64)
CountProcessState return the calculated metrics based on the reported processes.
Types ¶
type Exporter ¶
type Exporter struct {
PoolManager PoolManager
CountProcessState bool
// contains filtered or unexported fields
}
Exporter configures and exposes PHP-FPM metrics to Prometheus.
func NewExporter ¶
func NewExporter(pm PoolManager) *Exporter
NewExporter creates a new Exporter for a PoolManager and configures the necessary metrics.
func (*Exporter) Collect ¶
func (e *Exporter) Collect(ch chan<- prometheus.Metric)
Collect updates the Pools and sends the collected metrics to Prometheus
func (*Exporter) Describe ¶
func (e *Exporter) Describe(ch chan<- *prometheus.Desc)
Describe exposes the metric description to Prometheus
type Pool ¶
type Pool struct {
// The address of the pool, e.g. tcp://127.0.0.1:9000 or unix:///tmp/php-fpm.sock
Address string `json:"-"`
ScrapeError error `json:"-"`
ScrapeFailures int64 `json:"-"`
Name string `json:"pool"`
ProcessManager string `json:"process manager"`
StartTime timestamp `json:"start time"`
StartSince int64 `json:"start since"`
AcceptedConnections int64 `json:"accepted conn"`
ListenQueue int64 `json:"listen queue"`
MaxListenQueue int64 `json:"max listen queue"`
ListenQueueLength int64 `json:"listen queue len"`
IdleProcesses int64 `json:"idle processes"`
ActiveProcesses int64 `json:"active processes"`
TotalProcesses int64 `json:"total processes"`
MaxActiveProcesses int64 `json:"max active processes"`
MaxChildrenReached int64 `json:"max children reached"`
SlowRequests int64 `json:"slow requests"`
Processes []PoolProcess `json:"processes"`
}
Pool describes a single PHP-FPM pool that can be reached via a Socket or TCP address
type PoolManager ¶
type PoolManager struct {
Pools []Pool `json:"pools"`
}
PoolManager manages all configured Pools
func (*PoolManager) Add ¶
func (pm *PoolManager) Add(uri string) Pool
Add will add a pool to the pool manager based on the given URI.
func (*PoolManager) Update ¶
func (pm *PoolManager) Update() (err error)
Update will run the pool.Update() method concurrently on all Pools.
type PoolProcess ¶
type PoolProcess struct {
PID int64 `json:"pid"`
State string `json:"state"`
StartTime int64 `json:"start time"`
StartSince int64 `json:"start since"`
Requests int64 `json:"requests"`
RequestDuration int64 `json:"request duration"`
RequestMethod string `json:"request method"`
RequestURI string `json:"request uri"`
ContentLength int64 `json:"content length"`
User string `json:"user"`
Script string `json:"script"`
LastRequestCPU float64 `json:"last request cpu"`
LastRequestMemory int64 `json:"last request memory"`
}
PoolProcess describes a single PHP-FPM process. A pool can have multiple processes.