Hello All,
We are working on a project where we need to fetch the disk usage report from the following URL:
/etc/reports/diskusage.html
Once fetched, we need to share this report via email to clients on a daily basis.
We tried to achieve this by utilizing a service, scheduler, and JavaScript functionality. Below is the Java code we used to attempt fetching the data:
try (CloseableHttpResponse reportResponse = httpClient.execute(new HttpGet("http://localhost:4502/etc/reports/diskusage.html"))) {
if (reportResponse.getStatusLine().getStatusCode() == 200) {
String reportContent = EntityUtils.toString(reportResponse.getEntity());
Document doc = Jsoup.parse(reportContent);
Element restable = doc.getElementById("restable");
if (restable != null && !restable.text().isEmpty()) {
isReportGenerated = true;
String reportData = restable.html();
logger.info("Report content captured successfully.{}", reportData);
}
}
}
Issue:
Attempts Made:
Thanks in advance!
@AravindB1 : Not sure if you have noticed but this page takes lot of time to load as it is trying to gather information about various things. For instance, it look close to 4 minutes on a local instance with not so much of data (< 5GB in jcr:system).
You will have to wait until the entire page is done loading and time it will take to load completely is going to vary on instances (on subsequent requests, the time got reduced to approx 2 minutes).
Views
Replies
Total Likes
Hi,
What status is being returned? I believe the issue is that you’re trying to access the Author instance, which requires authentication. If you directly hit the URL with localhost:4502
, you'll be prompted for an authentication token.
You have 3 options:
Hope this helps!
Views
Likes
Replies