Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdds.conf.ConfigurationSource;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
import org.apache.hadoop.hdds.scm.client.HddsClientUtils;
import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.ozone.conf.OMClientConfig;
Expand All @@ -49,6 +50,7 @@
import org.apache.hadoop.ozone.om.helpers.OMNodeDetails;
import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
import org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo;
import org.apache.hadoop.ozone.om.helpers.ServiceInfo;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos;

import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -789,4 +791,30 @@ public static String getOMAddressListPrintString(List<OMNodeDetails> omList) {
printString.append("]");
return printString.toString();
}

public static String format(List<ServiceInfo> nodes, int port) {
Comment thread
ArafatKhan2198 marked this conversation as resolved.
Outdated
StringBuilder sb = new StringBuilder();
int count = 0;
for (ServiceInfo info : nodes) {
Comment thread
ArafatKhan2198 marked this conversation as resolved.
Outdated
// Printing only the OM's running
if (info.getNodeType() == HddsProtos.NodeType.OM) {
sb.append(
String.format(
"{ HostName: %s | Node-Id: %s | Ratis-Port : %d | Role: %s } ",
info.getHostname(),
info.getOmRoleInfo().getNodeId(),
port,
info.getOmRoleInfo().getServerRole()
));
count++;
}
}
// Print Stand-alone if only one OM exists
if (count == 1) {
return "STANDALONE";
} else {
return sb.toString();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public interface OMMXBean extends ServiceRuntimeInfo {

String getRpcPort();

String getOmRatisRoles();
Comment thread
ArafatKhan2198 marked this conversation as resolved.
Outdated

String getRatisLogDirectory();

String getRocksDbDirectory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2966,6 +2966,19 @@ public String getRpcPort() {
}

@Override

public String getOmRatisRoles() {
List<ServiceInfo> serviceList = null;
int port = omNodeDetails.getRatisPort();
try {
serviceList = getServiceList();
} catch (IOException e) {
Comment thread
sadanand48 marked this conversation as resolved.
Outdated
LOG.error("IO-Exception Occurred", e);
return "Exception: " + e.toString();
}
return OmUtils.format(serviceList, port);
}

public String getRatisLogDirectory() {
return OzoneManagerRatisUtils.getOMRatisDirectory(configuration);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ <h2>Status</h2>
<td>Rpc port</td>
<td>{{$ctrl.overview.jmx.RpcPort}}</td>
</tr>
<tr>
<td>OM Roles (HA) </td>
<td>{{$ctrl.overview.jmx.OmRatisRoles}}</td>
</tr>
<tr>
<td>Current-Role</td>
<td>{{$ctrl.role.Role}}</td>
</tr>
<tr>
<td>Group-Id</td>
<td>{{$ctrl.role.GroupId}}</td>
</tr>
</tbody>
</table>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,12 @@
require: {
overview: "^overview"
},
controller: function ($http) {
var ctrl = this;
$http.get("jmx?qry=Ratis:service=RaftServer,group=*,id=*")
.then(function (result) {
Comment thread
ArafatKhan2198 marked this conversation as resolved.
ctrl.role = result.data.beans[0];
});
}
});
})();