Search in sources :

Example 6 with FsInfo

use of org.elasticsearch.monitor.fs.FsInfo in project elasticsearch by elastic.

the class DiskUsageTests method testFillDiskUsageSomeInvalidValues.

public void testFillDiskUsageSomeInvalidValues() {
    ImmutableOpenMap.Builder<String, DiskUsage> newLeastAvailableUsages = ImmutableOpenMap.builder();
    ImmutableOpenMap.Builder<String, DiskUsage> newMostAvailableUsages = ImmutableOpenMap.builder();
    FsInfo.Path[] node1FSInfo = new FsInfo.Path[] { new FsInfo.Path("/middle", "/dev/sda", 100, 90, 80), new FsInfo.Path("/least", "/dev/sdb", -1, -1, -1), new FsInfo.Path("/most", "/dev/sdc", 300, 290, 280) };
    FsInfo.Path[] node2FSInfo = new FsInfo.Path[] { new FsInfo.Path("/least_most", "/dev/sda", -2, -1, -1) };
    FsInfo.Path[] node3FSInfo = new FsInfo.Path[] { new FsInfo.Path("/most", "/dev/sda", 100, 90, 70), new FsInfo.Path("/least", "/dev/sda", 10, -8, 0) };
    List<NodeStats> nodeStats = Arrays.asList(new NodeStats(new DiscoveryNode("node_1", buildNewFakeTransportAddress(), emptyMap(), emptySet(), Version.CURRENT), 0, null, null, null, null, null, new FsInfo(0, null, node1FSInfo), null, null, null, null, null, null), new NodeStats(new DiscoveryNode("node_2", buildNewFakeTransportAddress(), emptyMap(), emptySet(), Version.CURRENT), 0, null, null, null, null, null, new FsInfo(0, null, node2FSInfo), null, null, null, null, null, null), new NodeStats(new DiscoveryNode("node_3", buildNewFakeTransportAddress(), emptyMap(), emptySet(), Version.CURRENT), 0, null, null, null, null, null, new FsInfo(0, null, node3FSInfo), null, null, null, null, null, null));
    InternalClusterInfoService.fillDiskUsagePerNode(logger, nodeStats, newLeastAvailableUsages, newMostAvailableUsages);
    DiskUsage leastNode_1 = newLeastAvailableUsages.get("node_1");
    DiskUsage mostNode_1 = newMostAvailableUsages.get("node_1");
    assertNull("node1 should have been skipped", leastNode_1);
    assertDiskUsage(mostNode_1, node1FSInfo[2]);
    DiskUsage leastNode_2 = newLeastAvailableUsages.get("node_2");
    DiskUsage mostNode_2 = newMostAvailableUsages.get("node_2");
    assertNull("node2 should have been skipped", leastNode_2);
    assertNull("node2 should have been skipped", mostNode_2);
    DiskUsage leastNode_3 = newLeastAvailableUsages.get("node_3");
    DiskUsage mostNode_3 = newMostAvailableUsages.get("node_3");
    assertDiskUsage(leastNode_3, node3FSInfo[1]);
    assertDiskUsage(mostNode_3, node3FSInfo[0]);
}
Also used : Path(java.nio.file.Path) ShardPath(org.elasticsearch.index.shard.ShardPath) NodeStats(org.elasticsearch.action.admin.cluster.node.stats.NodeStats) FsInfo(org.elasticsearch.monitor.fs.FsInfo) DiscoveryNode(org.elasticsearch.cluster.node.DiscoveryNode) ImmutableOpenMap(org.elasticsearch.common.collect.ImmutableOpenMap)

Example 7 with FsInfo

use of org.elasticsearch.monitor.fs.FsInfo in project elasticsearch by elastic.

the class MockInternalClusterInfoService method makeStats.

/** Create a fake NodeStats for the given node and usage */
public static NodeStats makeStats(String nodeName, DiskUsage usage) {
    FsInfo.Path[] paths = new FsInfo.Path[1];
    FsInfo.Path path = new FsInfo.Path("/dev/null", null, usage.getTotalBytes(), usage.getFreeBytes(), usage.getFreeBytes());
    paths[0] = path;
    FsInfo fsInfo = new FsInfo(System.currentTimeMillis(), null, paths);
    return new NodeStats(new DiscoveryNode(nodeName, ESTestCase.buildNewFakeTransportAddress(), emptyMap(), emptySet(), Version.CURRENT), System.currentTimeMillis(), null, null, null, null, null, fsInfo, null, null, null, null, null, null);
}
Also used : FsInfo(org.elasticsearch.monitor.fs.FsInfo) NodeStats(org.elasticsearch.action.admin.cluster.node.stats.NodeStats) DiscoveryNode(org.elasticsearch.cluster.node.DiscoveryNode)

Aggregations

FsInfo (org.elasticsearch.monitor.fs.FsInfo)7 DiscoveryNode (org.elasticsearch.cluster.node.DiscoveryNode)5 NodeStats (org.elasticsearch.action.admin.cluster.node.stats.NodeStats)4 JvmStats (org.elasticsearch.monitor.jvm.JvmStats)3 OsStats (org.elasticsearch.monitor.os.OsStats)3 ProcessStats (org.elasticsearch.monitor.process.ProcessStats)3 ScriptStats (org.elasticsearch.script.ScriptStats)3 Path (java.nio.file.Path)2 HashMap (java.util.HashMap)2 ImmutableOpenMap (org.elasticsearch.common.collect.ImmutableOpenMap)2 DiscoveryStats (org.elasticsearch.discovery.DiscoveryStats)2 PendingClusterStateStats (org.elasticsearch.discovery.zen.PendingClusterStateStats)2 HttpStats (org.elasticsearch.http.HttpStats)2 AllCircuitBreakerStats (org.elasticsearch.indices.breaker.AllCircuitBreakerStats)2 CircuitBreakerStats (org.elasticsearch.indices.breaker.CircuitBreakerStats)2 IngestStats (org.elasticsearch.ingest.IngestStats)2 ThreadPoolStats (org.elasticsearch.threadpool.ThreadPoolStats)2 TransportStats (org.elasticsearch.transport.TransportStats)2 CrateUnitTest (io.crate.test.integration.CrateUnitTest)1 ArrayList (java.util.ArrayList)1