From 974221f0cfce2c147592ae7c281b43c91307da0f Mon Sep 17 00:00:00 2001
From: Cameron Sparr <cameronsparr@gmail.com>
Date: Wed, 12 Oct 2016 11:58:38 +0100
Subject: [PATCH] Fix phpfpm fcgi client panic when URL doesnt exist

closes #1886
---
 CHANGELOG.md                    | 1 +
 plugins/inputs/phpfpm/phpfpm.go | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5fdd4bde..66b18c1f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -61,6 +61,7 @@ continue sending logs to /var/log/telegraf/telegraf.log.
 - [#1731](https://github.com/influxdata/telegraf/issues/1731): Fix Graphite template ordering, use most specific.
 - [#1836](https://github.com/influxdata/telegraf/pull/1836): Fix snmp table field initialization for non-automatic table.
 - [#1724](https://github.com/influxdata/telegraf/issues/1724): cgroups path being parsed as metric.
+- [#1886](https://github.com/influxdata/telegraf/issues/1886): Fix phpfpm fcgi client panic when URL does not exist.
 
 ## v1.0.1 [2016-09-26]
 
diff --git a/plugins/inputs/phpfpm/phpfpm.go b/plugins/inputs/phpfpm/phpfpm.go
index 3b23ef92..d7a14d0e 100644
--- a/plugins/inputs/phpfpm/phpfpm.go
+++ b/plugins/inputs/phpfpm/phpfpm.go
@@ -122,6 +122,9 @@ func (g *phpfpm) gatherServer(addr string, acc telegraf.Accumulator) error {
 		fcgiIp := socketAddr[0]
 		fcgiPort, _ := strconv.Atoi(socketAddr[1])
 		fcgi, err = newFcgiClient(fcgiIp, fcgiPort)
+		if err != nil {
+			return err
+		}
 		if len(u.Path) > 1 {
 			statusPath = strings.Trim(u.Path, "/")
 		} else {
-- 
GitLab