use of org.sonar.server.es.response.NodeStats in project sonarqube by SonarSource.
the class ElasticSearchMetricTask method updateFileSystemMetrics.
private void updateFileSystemMetrics() {
try {
NodeStatsResponse nodeStatsResponse = esClient.nodesStats();
if (nodeStatsResponse.getNodeStats().isEmpty()) {
LOG.error("Failed to query ES status, no nodes stats returned by elasticsearch API");
} else {
for (NodeStats nodeStat : nodeStatsResponse.getNodeStats()) {
serverMonitoringMetrics.setElasticSearchDiskSpaceFreeBytes(nodeStat.getName(), nodeStat.getDiskAvailableBytes());
serverMonitoringMetrics.setElasticSearchDiskSpaceTotalBytes(nodeStat.getName(), nodeStat.getDiskTotalBytes());
}
}
} catch (Exception e) {
LOG.error("Failed to query ES status", e);
}
}
Aggregations