diff --git a/plugins/inputs/nginx_plus/nginx_plus.go b/plugins/inputs/nginx_plus/nginx_plus.go index ee3c93614a784..9cfb744fe1ce7 100644 --- a/plugins/inputs/nginx_plus/nginx_plus.go +++ b/plugins/inputs/nginx_plus/nginx_plus.go @@ -293,7 +293,7 @@ func (s *Status) gatherProcessesMetrics(tags map[string]string, acc telegraf.Acc acc.AddFields( "nginx_plus_processes", map[string]interface{}{ - "respawned": s.Processes.Respawned, + "respawned": *s.Processes.Respawned, }, tags, ) @@ -411,7 +411,7 @@ func (s *Status) gatherUpstreamMetrics(tags map[string]string, acc telegraf.Accu "healthchecks_unhealthy": peer.HealthChecks.Unhealthy, "downtime": peer.Downtime, "downstart": peer.Downstart, - "selected": peer.Selected, + "selected": *peer.Selected, } if peer.HealthChecks.LastPassed != nil { peerFields["healthchecks_last_passed"] = *peer.HealthChecks.LastPassed diff --git a/plugins/inputs/nginx_plus/nginx_plus_test.go b/plugins/inputs/nginx_plus/nginx_plus_test.go index c9aee571375f8..3357e1d065992 100644 --- a/plugins/inputs/nginx_plus/nginx_plus_test.go +++ b/plugins/inputs/nginx_plus/nginx_plus_test.go @@ -295,10 +295,7 @@ func TestNginxPlusGeneratesMetrics(t *testing.T) { t, "nginx_plus_processes", map[string]interface{}{ - "respawned": func() *int { - v := 9999 - return &v - }(), + "respawned": int(9999), }, map[string]string{ "server": host, @@ -403,17 +400,14 @@ func TestNginxPlusGeneratesMetrics(t *testing.T) { "healthchecks_unhealthy": int64(21), "downtime": int64(5432), "downstart": int64(4321), - "selected": func() *int64 { - var v int64 = 1451606400000 - return &v - }(), + "selected": int64(1451606400000), }, map[string]string{ - "server": host, - "port": port, - "upstream": "first_upstream", + "server": host, + "port": port, + "upstream": "first_upstream", "upstream_address": "1.2.3.123:80", - "id": "0", + "id": "0", }) }