sodonnel commented on code in PR #6083:
URL: https://github.com/apache/ozone/pull/6083#discussion_r1469738359
##########
hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/DecommissionStatusSubCommand.java:
##########
@@ -94,4 +133,95 @@ private void printDetails(DatanodeDetails datanode) {
" (" + datanode.getNetworkLocation() + "/" + datanode.getIpAddress()
+ "/" + datanode.getHostName() + ")");
}
+ private void printCounts(DatanodeDetails datanode, Map<String, Object>
counts, int numDecomNodes) {
+ try {
+ for (int i = 1; i <= numDecomNodes; i++) {
+ if (datanode.getHostName().equals(counts.get("tag.datanode." + i))) {
+ int pipelines = ((Double)counts.get("PipelinesWaitingToCloseDN." +
i)).intValue();
+ int underReplicated = ((Double)counts.get("UnderReplicatedDN." +
i)).intValue();
+ int unclosed = ((Double)counts.get("UnclosedContainersDN." +
i)).intValue();
+ long startTime = ((Double)counts.get("StartTimeDN." +
i)).longValue();
+ System.out.print("Decommission started at : ");
+ Date date = new Date(startTime);
+ DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss z");
+ System.out.println(formatter.format(date));
+ System.out.println("No. of Pipelines: " + pipelines);
+ System.out.println("No. of UnderReplicated containers: " +
underReplicated);
+ System.out.println("No. of Unclosed Containers: " + unclosed);
+ return;
+ }
+ }
+ System.err.println("Error getting pipeline and container counts for " +
datanode.getHostName());
+ } catch (NullPointerException ex) {
+ System.err.println("Error getting pipeline and container counts for " +
datanode.getHostName());
+ }
+ }
+
+ private Map<String, Object> getCounts() {
+ Map<String, Object> finalResult = new HashMap<>();
+ try {
+ StringBuffer url = new StringBuffer();
+ final OzoneConfiguration ozoneConf = parent
+ .getParent()
+ .getParent()
+ .getOzoneConf();
+ final String protocol;
+ final URLConnectionFactory connectionFactory =
URLConnectionFactory.newDefaultURLConnectionFactory(ozoneConf);
+ final HttpConfig.Policy webPolicy = getHttpPolicy(ozoneConf);
+ String host;
+ InputStream inputStream;
+ int errorCode;
+
+ if (webPolicy.isHttpsEnabled()) {
Review Comment:
This is a good idea, to pull the metrics rather than having a special
command for getting these details.
Does this work if Kerberos is enabled and the SCM webUI has kerberos
authentication enabled too?
Also, what about HA SCM? We need to get the metrics from the active SCM, not
the standbys as they will not have the correct metrics.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]