org.elasticsearch.monitor.fs.FsInfo Java Examples
The following examples show how to use
org.elasticsearch.monitor.fs.FsInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClusterStatsNodes.java From Elasticsearch with Apache License 2.0 | 6 votes |
@Override public void readFrom(StreamInput in) throws IOException { counts = Counts.readCounts(in); int size = in.readVInt(); versions = new HashSet<>(size); for (; size > 0; size--) { versions.add(Version.readVersion(in)); } os = OsStats.readOsStats(in); process = ProcessStats.readStats(in); jvm = JvmStats.readJvmStats(in); fs = FsInfo.Path.readInfoFrom(in); size = in.readVInt(); plugins = new HashSet<>(size); for (; size > 0; size--) { plugins.add(PluginInfo.readFromStream(in)); } }
Example #2
Source File: NodeStats.java From Elasticsearch with Apache License 2.0 | 6 votes |
public NodeStats(DiscoveryNode node, long timestamp, @Nullable NodeIndicesStats indices, @Nullable OsStats os, @Nullable ProcessStats process, @Nullable JvmStats jvm, @Nullable ThreadPoolStats threadPool, @Nullable FsInfo fs, @Nullable TransportStats transport, @Nullable HttpStats http, @Nullable AllCircuitBreakerStats breaker, @Nullable ScriptStats scriptStats) { super(node); this.timestamp = timestamp; this.indices = indices; this.os = os; this.process = process; this.jvm = jvm; this.threadPool = threadPool; this.fs = fs; this.transport = transport; this.http = http; this.breaker = breaker; this.scriptStats = scriptStats; }
Example #3
Source File: MockInternalClusterInfoService.java From crate with Apache License 2.0 | 6 votes |
private List<NodeStats> adjustNodesStats(List<NodeStats> nodesStats) { BiFunction<DiscoveryNode, FsInfo.Path, FsInfo.Path> diskUsageFunction = this.diskUsageFunction; if (diskUsageFunction == null) { return nodesStats; } return nodesStats.stream().map(nodeStats -> { final DiscoveryNode discoveryNode = nodeStats.getNode(); final FsInfo oldFsInfo = nodeStats.getFs(); return new NodeStats( discoveryNode, nodeStats.getTimestamp(), new FsInfo( oldFsInfo.getTimestamp(), oldFsInfo.getIoStats(), StreamSupport.stream(oldFsInfo.spliterator(), false) .map(fsInfoPath -> diskUsageFunction.apply(discoveryNode, fsInfoPath)) .toArray(FsInfo.Path[]::new) )); }).collect(Collectors.toList()); }
Example #4
Source File: ClusterStatsNodes.java From Elasticsearch with Apache License 2.0 | 5 votes |
public ClusterStatsNodes(ClusterStatsNodeResponse[] nodeResponses) { this.counts = new Counts(); this.versions = new HashSet<>(); this.os = new OsStats(); this.jvm = new JvmStats(); this.fs = new FsInfo.Path(); this.plugins = new HashSet<>(); this.process = new ProcessStats(); Set<InetAddress> seenAddresses = new HashSet<>(nodeResponses.length); for (ClusterStatsNodeResponse nodeResponse : nodeResponses) { counts.addNodeInfo(nodeResponse.nodeInfo()); versions.add(nodeResponse.nodeInfo().getVersion()); process.addNodeStats(nodeResponse.nodeStats()); jvm.addNodeInfoStats(nodeResponse.nodeInfo(), nodeResponse.nodeStats()); plugins.addAll(nodeResponse.nodeInfo().getPlugins().getPluginInfos()); // now do the stats that should be deduped by hardware (implemented by ip deduping) TransportAddress publishAddress = nodeResponse.nodeInfo().getTransport().address().publishAddress(); InetAddress inetAddress = null; if (publishAddress.uniqueAddressTypeId() == 1) { inetAddress = ((InetSocketTransportAddress) publishAddress).address().getAddress(); } if (!seenAddresses.add(inetAddress)) { continue; } os.addNodeInfoStats(nodeResponse.nodeInfo(), nodeResponse.nodeStats()); if (nodeResponse.nodeStats().getFs() != null) { fs.add(nodeResponse.nodeStats().getFs().total()); } } }
Example #5
Source File: IndexShard.java From Elasticsearch with Apache License 2.0 | 5 votes |
public void checkDiskSpace(FsService fsService) { Path shardRootDataPath = shardPath().getRootDataPath(); FsInfo.Path fsPath = fsService.stats().getPath(shardRootDataPath.toString()); if (fsPath.getFree().bytes() < 10) { throw new ElasticsearchException("the shard path {} is full, with total space {} and already used {}", path.getDataPath().toString(), fsPath.getTotal().bytes(), fsPath.getTotal().bytes() - fsPath.getFree().bytes()); } return; }
Example #6
Source File: NodeStats.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); timestamp = in.readVLong(); if (in.readBoolean()) { indices = NodeIndicesStats.readIndicesStats(in); } if (in.readBoolean()) { os = OsStats.readOsStats(in); } if (in.readBoolean()) { process = ProcessStats.readProcessStats(in); } if (in.readBoolean()) { jvm = JvmStats.readJvmStats(in); } if (in.readBoolean()) { threadPool = ThreadPoolStats.readThreadPoolStats(in); } if (in.readBoolean()) { fs = FsInfo.readFsInfo(in); } if (in.readBoolean()) { transport = TransportStats.readTransportStats(in); } if (in.readBoolean()) { http = HttpStats.readHttpStats(in); } breaker = AllCircuitBreakerStats.readOptionalAllCircuitBreakerStats(in); scriptStats = in.readOptionalStreamable(new ScriptStats()); }
Example #7
Source File: PrometheusMetricsCollector.java From elasticsearch-prometheus-exporter with Apache License 2.0 | 5 votes |
private void updateFsMetrics(FsInfo fs) { if (fs != null) { catalog.setNodeGauge("fs_total_total_bytes", fs.getTotal().getTotal().getBytes()); catalog.setNodeGauge("fs_total_available_bytes", fs.getTotal().getAvailable().getBytes()); catalog.setNodeGauge("fs_total_free_bytes", fs.getTotal().getFree().getBytes()); if (fs.getMostDiskEstimate() != null) { catalog.setNodeGauge("fs_most_usage_free_bytes", fs.getMostDiskEstimate().getFreeBytes(), fs.getMostDiskEstimate().getPath()); catalog.setNodeGauge("fs_most_usage_total_bytes", fs.getMostDiskEstimate().getTotalBytes(), fs.getMostDiskEstimate().getPath()); } if (fs.getLeastDiskEstimate() != null) { catalog.setNodeGauge("fs_least_usage_free_bytes", fs.getLeastDiskEstimate().getFreeBytes(), fs.getLeastDiskEstimate().getPath()); catalog.setNodeGauge("fs_least_usage_total_bytes", fs.getLeastDiskEstimate().getTotalBytes(), fs.getLeastDiskEstimate().getPath()); } for (FsInfo.Path fspath : fs) { String path = fspath.getPath(); String mount = fspath.getMount(); String type = fspath.getType(); catalog.setNodeGauge("fs_path_total_bytes", fspath.getTotal().getBytes(), path, mount, type); catalog.setNodeGauge("fs_path_available_bytes", fspath.getAvailable().getBytes(), path, mount, type); catalog.setNodeGauge("fs_path_free_bytes", fspath.getFree().getBytes(), path, mount, type); } FsInfo.IoStats ioStats = fs.getIoStats(); if (ioStats != null) { catalog.setNodeGauge("fs_io_total_operations", fs.getIoStats().getTotalOperations()); catalog.setNodeGauge("fs_io_total_read_operations", fs.getIoStats().getTotalReadOperations()); catalog.setNodeGauge("fs_io_total_write_operations", fs.getIoStats().getTotalWriteOperations()); catalog.setNodeGauge("fs_io_total_read_bytes", fs.getIoStats().getTotalReadKilobytes() * 1024); catalog.setNodeGauge("fs_io_total_write_bytes", fs.getIoStats().getTotalWriteKilobytes() * 1024); } } }
Example #8
Source File: NodeStatsContext.java From crate with Apache License 2.0 | 5 votes |
public NodeStatsContext(StreamInput in, boolean complete) throws IOException { this.complete = complete; this.id = DataTypes.STRING.readValueFrom(in); this.name = DataTypes.STRING.readValueFrom(in); this.hostname = DataTypes.STRING.readValueFrom(in); this.timestamp = in.readLong(); this.version = in.readBoolean() ? Version.readVersion(in) : null; this.build = in.readBoolean() ? Build.readBuild(in) : null; this.restUrl = DataTypes.STRING.readValueFrom(in); this.pgPort = in.readOptionalVInt(); this.httpPort = in.readOptionalVInt(); this.transportPort = in.readOptionalVInt(); this.jvmStats = in.readOptionalWriteable(JvmStats::new); this.osInfo = in.readOptionalWriteable(OsInfo::new); this.processStats = in.readOptionalWriteable(ProcessStats::new); this.osStats = in.readOptionalWriteable(OsStats::new); this.fsInfo = in.readOptionalWriteable(FsInfo::new); this.extendedOsStats = in.readOptionalWriteable(ExtendedOsStats::new); this.threadPools = in.readOptionalWriteable(ThreadPoolStats::new); this.httpStats = in.readOptionalWriteable(HttpStats::new); this.psqlStats = in.readOptionalWriteable(ConnectionStats::new); this.openTransportConnections = in.readLong(); this.clusterStateVersion = in.readLong(); this.osName = DataTypes.STRING.readValueFrom(in); this.osArch = DataTypes.STRING.readValueFrom(in); this.osVersion = DataTypes.STRING.readValueFrom(in); this.javaVersion = DataTypes.STRING.readValueFrom(in); this.jvmName = DataTypes.STRING.readValueFrom(in); this.jvmVendor = DataTypes.STRING.readValueFrom(in); this.jvmVersion = DataTypes.STRING.readValueFrom(in); }
Example #9
Source File: DiskUsagesITest.java From crate with Apache License 2.0 | 4 votes |
private static FsInfo.Path setDiskUsage(FsInfo.Path original, long totalBytes, long freeBytes) { return new FsInfo.Path(original.getPath(), original.getMount(), totalBytes, freeBytes, freeBytes); }
Example #10
Source File: FsInfoHelpers.java From crate with Apache License 2.0 | 4 votes |
public static Long bytesWritten(FsInfo.IoStats ioStats) { if (ioStats != null) { return ioStats.getTotalWriteKilobytes() * 1024L; } return -1L; }
Example #11
Source File: FsInfoHelpers.java From crate with Apache License 2.0 | 4 votes |
public static Long writeOperations(FsInfo.IoStats ioStats) { if (ioStats != null) { return ioStats.getTotalWriteOperations(); } return -1L; }
Example #12
Source File: FsInfoHelpers.java From crate with Apache License 2.0 | 4 votes |
public static Long bytesRead(FsInfo.IoStats ioStats) { if (ioStats != null) { return ioStats.getTotalReadKilobytes() * 1024L; } return -1L; }
Example #13
Source File: FsInfoHelpers.java From crate with Apache License 2.0 | 4 votes |
public static Long readOperations(FsInfo.IoStats ioStats) { if (ioStats != null) { return ioStats.getTotalReadOperations(); } return -1L; }
Example #14
Source File: FsInfoHelpers.java From crate with Apache License 2.0 | 4 votes |
public static Long available(FsInfo.Path path) { return path.getAvailable().getBytes(); }
Example #15
Source File: FsInfoHelpers.java From crate with Apache License 2.0 | 4 votes |
public static Long used(FsInfo.Path path) { return path.getTotal().getBytes() == -1L || path.getAvailable().getBytes() == -1L ? -1L : path.getTotal().getBytes() - path.getAvailable().getBytes(); }
Example #16
Source File: FsInfoHelpers.java From crate with Apache License 2.0 | 4 votes |
public static Long size(FsInfo.Path path) { return path.getTotal().getBytes(); }
Example #17
Source File: FsInfoHelpers.java From crate with Apache License 2.0 | 4 votes |
public static String dev(FsInfo.Path path) { return path.getMount() == null ? "" : path.getMount(); }
Example #18
Source File: NodeStatsContext.java From crate with Apache License 2.0 | 4 votes |
public FsInfo fsInfo() { return fsInfo; }
Example #19
Source File: NodeStats.java From crate with Apache License 2.0 | 4 votes |
public FsInfo getFs() { return fs; }
Example #20
Source File: NodeStats.java From crate with Apache License 2.0 | 4 votes |
public NodeStats(StreamInput in) throws IOException { super(in); timestamp = in.readVLong(); fs = in.readOptionalWriteable(FsInfo::new); }
Example #21
Source File: NodeStats.java From crate with Apache License 2.0 | 4 votes |
public NodeStats(DiscoveryNode node, long timestamp, FsInfo fs) { super(node); this.timestamp = timestamp; this.fs = fs; }
Example #22
Source File: FsStatsMonitor.java From Raigad with Apache License 2.0 | 4 votes |
@Override public void execute() throws Exception { // Only start monitoring if Elasticsearch is started if (!ElasticsearchProcessMonitor.isElasticsearchRunning()) { String exceptionMsg = "Elasticsearch is not yet started, check back again later"; logger.info(exceptionMsg); return; } FsStatsBean fsStatsBean = new FsStatsBean(); try { NodesStatsResponse nodesStatsResponse = ElasticsearchTransportClient.getNodesStatsResponse(config); NodeStats nodeStats = null; List<NodeStats> nodeStatsList = nodesStatsResponse.getNodes(); if (nodeStatsList.size() > 0) { nodeStats = nodeStatsList.get(0); } if (nodeStats == null) { logger.info("File system info is not available (node stats are not available)"); return; } FsInfo fsInfo = nodeStats.getFs(); if (fsInfo == null) { logger.info("File system info is not available"); return; } fsStatsBean.total = fsInfo.getTotal().getTotal().getBytes(); fsStatsBean.free = fsInfo.getTotal().getFree().getBytes(); fsStatsBean.available = fsInfo.getTotal().getAvailable().getBytes(); fsStatsBean.availableDiskPercent = (fsStatsBean.available * 100) / fsStatsBean.total; } catch (Exception e) { logger.warn("Failed to load file system stats data", e); } fsStatsReporter.fsStatsBean.set(fsStatsBean); }
Example #23
Source File: NodeStats.java From Elasticsearch with Apache License 2.0 | 4 votes |
/** * File system level stats. */ @Nullable public FsInfo getFs() { return fs; }
Example #24
Source File: ClusterStatsNodes.java From Elasticsearch with Apache License 2.0 | 4 votes |
public FsInfo.Path getFs() { return fs; }