use of org.graylog2.indexer.cluster.health.NodeFileDescriptorStats in project graylog2-server by Graylog2.
the class IndexerClusterCheckerThread method checkOpenFiles.
@VisibleForTesting
void checkOpenFiles() {
if (notificationExists(Notification.Type.ES_OPEN_FILES)) {
return;
}
boolean allHigher = true;
final Set<NodeFileDescriptorStats> fileDescriptorStats = cluster.getFileDescriptorStats();
for (NodeFileDescriptorStats nodeFileDescriptorStats : fileDescriptorStats) {
final String name = nodeFileDescriptorStats.name();
final String ip = nodeFileDescriptorStats.ip();
final String host = nodeFileDescriptorStats.host();
final long maxFileDescriptors = nodeFileDescriptorStats.fileDescriptorMax().orElse(-1L);
if (maxFileDescriptors != -1L && maxFileDescriptors < MINIMUM_OPEN_FILES_LIMIT) {
// Write notification.
final String ipOrHostName = firstNonNull(host, ip);
final Notification notification = notificationService.buildNow().addType(Notification.Type.ES_OPEN_FILES).addSeverity(Notification.Severity.URGENT).addDetail("hostname", ipOrHostName).addDetail("max_file_descriptors", maxFileDescriptors);
if (notificationService.publishIfFirst(notification)) {
LOG.warn("Indexer node <{}> ({}) open file limit is too low: [{}]. Set it to at least {}.", name, ipOrHostName, maxFileDescriptors, MINIMUM_OPEN_FILES_LIMIT);
}
allHigher = false;
}
}
if (allHigher) {
Notification notification = notificationService.build().addType(Notification.Type.ES_OPEN_FILES);
notificationService.fixed(notification);
}
}
use of org.graylog2.indexer.cluster.health.NodeFileDescriptorStats in project graylog2-server by Graylog2.
the class ClusterAdapterES6 method fileDescriptorStats.
@Override
public Set<NodeFileDescriptorStats> fileDescriptorStats() {
final JsonNode nodes = catNodes("name", "host", "ip", "fileDescriptorMax");
final ImmutableSet.Builder<NodeFileDescriptorStats> setBuilder = ImmutableSet.builder();
for (JsonNode jsonElement : nodes) {
if (jsonElement.isObject()) {
final String name = jsonElement.path("name").asText();
final String host = jsonElement.path("host").asText(null);
final String ip = jsonElement.path("ip").asText();
final JsonNode fileDescriptorMax = jsonElement.path("fileDescriptorMax");
final Long maxFileDescriptors = fileDescriptorMax.isLong() ? fileDescriptorMax.asLong() : null;
setBuilder.add(NodeFileDescriptorStats.create(name, ip, host, maxFileDescriptors));
}
}
return setBuilder.build();
}
Aggregations