diff --git a/htroot/Status.java b/htroot/Status.java index 7e0c98211..5ff0dbaf8 100644 --- a/htroot/Status.java +++ b/htroot/Status.java @@ -123,7 +123,7 @@ public class Status final boolean adminaccess = sb.adminAuthenticated(header) >= 2; if ( adminaccess ) { prop.put("showPrivateTable", "1"); - prop.put("privateStatusTable", "Status_p.inc"); + prop.put("privateStatusTable", "status_p.inc"); } else { prop.put("showPrivateTable", "0"); prop.put("privateStatusTable", ""); @@ -318,9 +318,10 @@ public class Status } // memory usage and system attributes - prop.put("freeMemory", Formatter.bytesToString(MemoryControl.free())); - prop.put("totalMemory", Formatter.bytesToString(MemoryControl.total())); + prop.put("usedMemory", Formatter.bytesToString(MemoryControl.total())); prop.put("maxMemory", Formatter.bytesToString(MemoryControl.maxMemory())); + prop.put("usedDisk", Formatter.bytesToString(sb.observer.getSizeOfDataPath())); + prop.put("freeDisk", Formatter.bytesToString(sb.observer.getUsableSpace())); prop.put("processors", WorkflowProcessor.availableCPU); prop.put("load", Memory.load()); diff --git a/htroot/Status_p.inc b/htroot/Status_p.inc index fc5708368..87c2082f4 100644 --- a/htroot/Status_p.inc +++ b/htroot/Status_p.inc @@ -67,10 +67,12 @@
Memory Usage
-
- free: #[freeMemory]#
- total: #[totalMemory]#
- max: #[maxMemory]#
+
+ + + + +
RAM used:#[usedMemory]#
RAM max:#[maxMemory]#
DISK used:#[usedDisk]#
DISK free:#[freeDisk]#
Traffic [Reset]
Proxy: #[trafficProxy]#
Crawler: #[trafficCrawler]#
diff --git a/source/net/yacy/search/ResourceObserver.java b/source/net/yacy/search/ResourceObserver.java index 32e8d2396..f7941a09f 100644 --- a/source/net/yacy/search/ResourceObserver.java +++ b/source/net/yacy/search/ResourceObserver.java @@ -26,6 +26,8 @@ package net.yacy.search; import java.io.File; +import org.apache.commons.io.FileUtils; + import net.yacy.cora.document.WordCache; import net.yacy.cora.protocol.Domains; import net.yacy.cora.util.ConcurrentLog; @@ -70,7 +72,7 @@ public class ResourceObserver { if (this.normalizedDiskFree.compareTo(Space.HIGH) < 0 || this.normalizedMemoryFree.compareTo(Space.HIGH) < 0 ) { String reason = ""; - if (this.normalizedDiskFree.compareTo(Space.HIGH) < 0) reason += " not enough disk space, " + this.path.getUsableSpace(); + if (this.normalizedDiskFree.compareTo(Space.HIGH) < 0) reason += " not enough disk space, " + getUsableSpace(); if (this.normalizedMemoryFree.compareTo(Space.HIGH) < 0 ) reason += " not enough memory space"; if (!this.sb.crawlJobIsPaused(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL)) { log.info("pausing local crawls"); @@ -100,6 +102,19 @@ public class ResourceObserver { } } + private long sizeOfDirectory_lastCountTime = 0; + private long sizeOfDirectory_lastCountValue = 0; + public long getSizeOfDataPath() { + if (System.currentTimeMillis() - this.sizeOfDirectory_lastCountTime < 60000) return this.sizeOfDirectory_lastCountValue; + this.sizeOfDirectory_lastCountTime = System.currentTimeMillis(); + this.sizeOfDirectory_lastCountValue = FileUtils.sizeOfDirectory(this.path); + return this.sizeOfDirectory_lastCountValue; + } + + public long getUsableSpace() { + return this.path.getUsableSpace(); + } + /** * returns the amount of disk space available * @return */ private Space getNormalizedDiskFree() { - final long currentSpace = this.path.getUsableSpace(); + final long currentSpace = getUsableSpace(); //final long currentSpace = getUsableSpace(this.path); if (currentSpace < 1L) return Space.HIGH; Space ret = Space.HIGH;