+clu #15489 expose cluster member roles in JMX getClusterStatus

This commit is contained in:
kustosz 2014-11-21 17:14:02 +01:00
parent c0235ceee6
commit 8d32c88b6d
2 changed files with 37 additions and 9 deletions

View file

@ -42,19 +42,31 @@ trait ClusterNodeMBean {
* "members": [
* {
* "address": "akka.tcp://system@host1:2552",
* "status": "Up"
* "status": "Up",
* "roles": [
* "frontend"
* ]
* },
* {
* "address": "akka.tcp://system@host2:2552",
* "status": "Up"
* "status": "Up",
* "roles": [
* "frontend"
* ]
* },
* {
* "address": "akka.tcp://system@host3:2552",
* "status": "Down"
* "status": "Down",
* "roles": [
* "backend"
* ]
* },
* {
* "address": "akka.tcp://system@host4:2552",
* "status": "Joining"
* "status": "Joining",
* "roles": [
* "backend"
* ]
* }
* ],
* "unreachable": [
@ -137,7 +149,10 @@ private[akka] class ClusterJmx(cluster: Cluster, log: LoggingAdapter) {
val members = clusterView.members.toSeq.sorted(Member.ordering).map { m
s"""{
| "address": "${m.address}",
| "status": "${m.status}"
| "status": "${m.status}",
| "roles": [
| ${m.roles.map("\"" + _ + "\"").mkString(",\n ")}
| ]
| }""".stripMargin
} mkString (",\n ")

View file

@ -22,6 +22,7 @@ object MBeanMultiJvmSpec extends MultiNodeConfig {
commonConfig(debugConfig(on = false).withFallback(ConfigFactory.parseString("""
akka.cluster.jmx.enabled = on
akka.cluster.roles = [testNode]
""")).withFallback(MultiNodeClusterSpec.clusterConfig))
}
@ -119,19 +120,31 @@ abstract class MBeanSpec
| "members": [
| {
| "address": "${sortedNodes(0)}",
| "status": "Up"
| "status": "Up",
| "roles": [
| "testNode"
| ]
| },
| {
| "address": "${sortedNodes(1)}",
| "status": "Up"
| "status": "Up",
| "roles": [
| "testNode"
| ]
| },
| {
| "address": "${sortedNodes(2)}",
| "status": "Up"
| "status": "Up",
| "roles": [
| "testNode"
| ]
| },
| {
| "address": "${sortedNodes(3)}",
| "status": "Up"
| "status": "Up",
| "roles": [
| "testNode"
| ]
| }
| ],
| "unreachable": [