diff --git a/cmd/server.go b/cmd/server.go index 4cb2beb..8794ac8 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -57,7 +57,7 @@ to quickly create a Cobra application.`, if fixProcessCount { log.Info("Idle/Active/Total Processes will be calculated by php-fpm_exporter.") - exporter.CalculateProcessScoreboard = true + exporter.CountProcessState = true } prometheus.MustRegister(exporter) diff --git a/phpfpm/exporter.go b/phpfpm/exporter.go index effe289..b4cba35 100644 --- a/phpfpm/exporter.go +++ b/phpfpm/exporter.go @@ -30,7 +30,7 @@ type Exporter struct { mutex sync.Mutex PoolManager PoolManager - CalculateProcessScoreboard bool + CountProcessState bool up *prometheus.Desc scrapeFailues *prometheus.Desc @@ -56,7 +56,7 @@ func NewExporter(pm PoolManager) *Exporter { return &Exporter{ PoolManager: pm, - CalculateProcessScoreboard: false, + CountProcessState: false, up: prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "up"), @@ -179,11 +179,11 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) { } active, idle, total := CountProcessState(pool.Processes) - if !e.CalculateProcessScoreboard && (active != pool.ActiveProcesses || idle != pool.IdleProcesses) { + if !e.CountProcessState && (active != pool.ActiveProcesses || idle != pool.IdleProcesses) { log.Error("Inconsistent active and idle processes reported. Set `--fix-process-count` to have this calculated by php-fpm_exporter instead.") } - if e.CalculateProcessScoreboard { + if !e.CountProcessState { active = pool.ActiveProcesses idle = pool.IdleProcesses total = pool.TotalProcesses