Documentation
¶
Overview ¶
Package phpfpm provides convenient access to PHP-FPM pool data
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Exporter ¶
type Exporter struct {
PoolManager PoolManager
// 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 int `json:"start since"`
AcceptedConnections int `json:"accepted conn"`
ListenQueue int `json:"listen queue"`
MaxListenQueue int `json:"max listen queue"`
ListenQueueLength int `json:"listen queue len"`
IdleProcesses int `json:"idle processes"`
ActiveProcesses int `json:"active processes"`
TotalProcesses int `json:"total processes"`
MaxActiveProcesses int `json:"max active processes"`
MaxChildrenReached int `json:"max children reached"`
SlowRequests int `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 int `json:"pid"`
State string `json:"state"`
StartTime int `json:"start time"`
StartSince int `json:"start since"`
Requests int `json:"requests"`
RequestDuration int `json:"request duration"`
RequestMethod string `json:"request method"`
RequestURI string `json:"request uri"`
ContentLength int `json:"content length"`
User string `json:"user"`
Script string `json:"script"`
LastRequestCPU float32 `json:"last request cpu"`
LastRequestMemory int `json:"last request memory"`
}
PoolProcess describes a single PHP-FPM process. A pool can have multiple processes.