bszabo97 commented on code in PR #1182: URL: https://github.com/apache/solr/pull/1182#discussion_r1035705543
########## solr/core/src/java/org/apache/solr/util/SolrCLI.java: ########## @@ -968,38 +978,39 @@ public Map<String, Object> getStatus(String solrUrl) throws Exception { if (!solrUrl.endsWith("/")) solrUrl += "/"; - String systemInfoUrl = solrUrl + "admin/info/system"; - CloseableHttpClient httpClient = getHttpClient(); - try { - // hit Solr to get system info - Map<String, Object> systemInfo = getJson(httpClient, systemInfoUrl, 2, true); + try (var solrClient = getHttpSolrClient(solrUrl)) { + NamedList<Object> systemInfo = + solrClient.request( + new GenericSolrRequest( + SolrRequest.METHOD.GET, + CommonParams.SYSTEM_INFO_PATH, + new ModifiableSolrParams())); // convert raw JSON into user-friendly output - status = reportStatus(solrUrl, systemInfo, httpClient); - } finally { - closeHttpClient(httpClient); + status = reportStatus(systemInfo, solrClient); } return status; } - public Map<String, Object> reportStatus( - String solrUrl, Map<String, Object> info, HttpClient httpClient) throws Exception { + public Map<String, Object> reportStatus(NamedList<Object> info, SolrClient solrClient) + throws Exception { Map<String, Object> status = new LinkedHashMap<>(); String solrHome = (String) info.get("solr_home"); status.put("solr_home", solrHome != null ? solrHome : "?"); - status.put("version", asString("/lucene/solr-impl-version", info)); - status.put("startTime", asString("/jvm/jmx/startTime", info)); - status.put("uptime", uptime(asLong("/jvm/jmx/upTimeMS", info))); + status.put("version", ((NamedList) info.get("lucene")).get("solr-impl-version")); - String usedMemory = asString("/jvm/memory/used", info); - String totalMemory = asString("/jvm/memory/total", info); + @SuppressWarnings("unchecked") + NamedList<Object> jvm = (NamedList<Object>) info.get("jvm"); + status.put("startTime", ((NamedList) jvm.get("jmx")).get("startTime")); + status.put("uptime", uptime((Long) ((NamedList) jvm.get("jmx")).get("upTimeMS"))); + String usedMemory = (String) ((NamedList) jvm.get("memory")).get("used"); + String totalMemory = (String) ((NamedList) jvm.get("memory")).get("total"); status.put("memory", usedMemory + " of " + totalMemory); - // if this is a Solr in solrcloud mode, gather some basic cluster info Review Comment: I was not aware I deleted this comment. Looking at it, it is kind of obvious, maybe a bit redundant, but if you think it has a purpose we can put it back. -- 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: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org