Search in sources :

Example 56 with Version

use of org.graylog2.plugin.Version in project graylog2-server by Graylog2.

the class ESVersionCheckPeriodical method doRun.

@Override
public void doRun() {
    if (versionOverride.isPresent()) {
        LOG.debug("Elasticsearch version is set manually. Not running check.");
        return;
    }
    final Optional<SearchVersion> probedVersion = this.versionProbe.probe(this.elasticsearchHosts);
    probedVersion.ifPresent(version -> {
        if (compatible(this.initialElasticsearchVersion, version)) {
            notificationService.fixed(Notification.Type.ES_VERSION_MISMATCH);
        } else {
            LOG.warn("Elasticsearch version currently running ({}) is incompatible with the one Graylog was started " + "with ({}) - a restart is required!", version, initialElasticsearchVersion);
            final Notification notification = notificationService.buildNow().addType(Notification.Type.ES_VERSION_MISMATCH).addSeverity(Notification.Severity.URGENT).addDetail("initial_version", initialElasticsearchVersion.toString()).addDetail("current_version", version.toString());
            notificationService.publishIfFirst(notification);
        }
    });
}
Also used : SearchVersion(org.graylog2.storage.SearchVersion) DetectedSearchVersion(org.graylog2.storage.DetectedSearchVersion) Notification(org.graylog2.notifications.Notification)

Example 57 with Version

use of org.graylog2.plugin.Version in project graylog2-server by Graylog2.

the class GettingStartedResource method dismissGettingStarted.

@POST
@Path("dismiss")
@ApiOperation("Dismiss auto-showing getting started guide for this version")
@AuditEvent(type = AuditEventTypes.GETTING_STARTED_GUIDE_OPT_OUT_CREATE)
public void dismissGettingStarted() {
    final GettingStartedState gettingStartedState = clusterConfigService.getOrDefault(GettingStartedState.class, GettingStartedState.create(Sets.<String>newHashSet()));
    gettingStartedState.dismissedInVersions().add(currentMinorVersionString());
    clusterConfigService.write(gettingStartedState);
}
Also used : GettingStartedState(org.graylog2.gettingstarted.GettingStartedState) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) ApiOperation(io.swagger.annotations.ApiOperation) AuditEvent(org.graylog2.audit.jersey.AuditEvent)

Example 58 with Version

use of org.graylog2.plugin.Version in project graylog2-server by Graylog2.

the class NodeAdapterES6 method version.

@Override
public Optional<SearchVersion> version() {
    final Ping request = new Ping.Builder().build();
    final JestResult jestResult = JestUtils.execute(jestClient, request, () -> "Unable to retrieve Elasticsearch version");
    return Optional.ofNullable(jestResult.getJsonObject().path("version").path("number").asText(null)).map(this::parseVersion).map(SearchVersion::elasticsearch);
}
Also used : Ping(io.searchbox.core.Ping) SearchVersion(org.graylog2.storage.SearchVersion) JestResult(io.searchbox.client.JestResult)

Aggregations

Test (org.junit.Test)29 RawMessage (org.graylog2.plugin.journal.RawMessage)28 Message (org.graylog2.plugin.Message)15 SearchVersion (org.graylog2.storage.SearchVersion)13 JsonNode (com.fasterxml.jackson.databind.JsonNode)7 IOException (java.io.IOException)5 Inject (javax.inject.Inject)5 DateTime (org.joda.time.DateTime)5 ZonedDateTime (java.time.ZonedDateTime)4 Map (java.util.Map)4 Optional (java.util.Optional)4 Constraint (org.graylog2.contentpacks.model.constraints.Constraint)4 GraylogVersionConstraint (org.graylog2.contentpacks.model.constraints.GraylogVersionConstraint)4 PluginVersionConstraint (org.graylog2.contentpacks.model.constraints.PluginVersionConstraint)4 Logger (org.slf4j.Logger)4 LoggerFactory (org.slf4j.LoggerFactory)4 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)3 ApiOperation (io.swagger.annotations.ApiOperation)3 URI (java.net.URI)3 HashSet (java.util.HashSet)3