// MaxNsqdConnHealthCheck asserts that the total number of established tcp connections to all nsqd's fall
// below a given max threshold.
func MaxNsqdConnHealthCheck(maxconns int) healthcheck.Checker {
	return func() (map[string]string, error) {
		pubHosts := getHosts(4150, "hailo", "service", "nsq", "pubHosts")
		subHosts := getHosts(4150, "hailo", "service", "nsq", "subHosts")
		return connhealthcheck.MaxTcpConnections(append(pubHosts, subHosts...), maxconns)()
	}
}
// MaxConnHealthCheck asserts that the total number of established connections to all zookeeper nodes
// falls below a given max threshold.
func MaxConnHealthCheck(maxconns int) healthcheck.Checker {
	return func() (map[string]string, error) {
		nodes := config.AtPath("hailo", "service", "zookeeper", "hosts").AsHostnameArray(2181)
		return connhealthcheck.MaxTcpConnections(nodes, maxconns)()
	}
}
// MaxConnHealthCheck asserts that the total number of established connections to all C* nodes falls below a given max
// threshold.
func MaxConnHealthCheck(maxconns int) healthcheck.Checker {
	return func() (map[string]string, error) {
		return connhealthcheck.MaxTcpConnections(getHosts(), maxconns)()
	}
}