From 7f67bf593fea50939df1fd891234e8b52f8fa158 Mon Sep 17 00:00:00 2001 From: Steve Nardone Date: Tue, 30 May 2017 14:02:26 -0400 Subject: [PATCH] Fix panic in mongo input (#2848) (cherry picked from commit e7f9db297eb309f722597023a73d175e5ff81431) --- plugins/inputs/mongodb/mongostat.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/inputs/mongodb/mongostat.go b/plugins/inputs/mongodb/mongostat.go index c5ccf5a86..bddd3fda9 100644 --- a/plugins/inputs/mongodb/mongostat.go +++ b/plugins/inputs/mongodb/mongostat.go @@ -564,7 +564,7 @@ func NewStatLine(oldMongo, newMongo MongoStatus, key string, all bool, sampleSec // BEGIN code modification if newStat.Repl.IsMaster.(bool) { returnVal.NodeType = "PRI" - } else if newStat.Repl.Secondary.(bool) { + } else if newStat.Repl.Secondary != nil && newStat.Repl.Secondary.(bool) { returnVal.NodeType = "SEC" } else if newStat.Repl.ArbiterOnly != nil && newStat.Repl.ArbiterOnly.(bool) { returnVal.NodeType = "ARB"