func getClusterStats(couch *cbmgr.Couchbase) {
clstInf, err := couch.ClusterInfo()
if err != nil {
log.Printf("getClusterStats error:%s", err.Error())
}
if clstInf.Balanced {
ClusterStats.WithLabelValues("balanced").Set(0)
} else {
ClusterStats.WithLabelValues("balanced").Set(1)
}
2018/03/15 19:52:21 [Get http://localhost:8091/pools/default/buckets/: dial tcp 127.0.0.1:8091: connect: connection refused]
2018/03/15 19:52:21 getClusterStats error:[Get http://localhost:8091/pools/default: dial tcp 127.0.0.1:8091: connect: connection refused]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0x6b8e7d]
goroutine 9 [running]:
main.getClusterStats(0xc420096240)
/Users/elvis/prog/go/src/github.com/lelvisl/couchbase_exporter/couchbase_stats.go:47 +0x5d
main.main.func1(0xc420096240)
/Users/elvis/prog/go/src/github.com/lelvisl/couchbase_exporter/couchbase_exporter.go:56 +0x39
created by main.main
/Users/elvis/prog/go/src/github.com/lelvisl/couchbase_exporter/couchbase_exporter.go:53 +0x227