func Test_CollectServerStatus(t *testing.T) {
	shared.ParseEnabledGroups("assers,durability,backgrond_flushing,connections,extra_info,global_lock,index_counters,network,op_counters,memory,locks,metrics,cursors")
	collector := NewMongodbCollector(MongodbCollectorOpts{URI: "localhost"})
	serverStatus := collector.collectServerStatus(nil)

	if serverStatus.Asserts == nil {
		t.Error("Error loading document.")
	}
}
예제 #2
0
func main() {
	flag.Parse()
	shared.LoadGroupsDesc()
	shared.ParseEnabledGroups(*enabledGroupsFlag)

	mongodbCollector := collector.NewMongodbCollector(collector.MongodbCollectorOpts{
		URI: *mongodbUriFlag,
	})
	prometheus.MustRegister(mongodbCollector)

	startWebServer()
}