Package org.graylog2.notifications

Examples of org.graylog2.notifications.Notification


                        new CacheLoader<String, Optional<MessageInput>>() {
                            @Override
                            public Optional<MessageInput> load(String key) throws Exception {
                                LOG.debug("Loading message input {}", key);
                                try {
                                    final Input input = inputService.find(key);
                                    return Optional.fromNullable(inputService.buildMessageInput(input));
                                } catch (NotFoundException | NoSuchInputTypeException e) {
                                    return Optional.absent();
                                }
                            }
View Full Code Here


        inputData.put("creator_user_id", rir.creatorUserId);
        inputData.put("configuration", rir.configuration);
        inputData.put("created_at", Tools.iso8601());
        inputData.put("radio_id", rir.radioId);

        Input mongoInput = new InputImpl(inputData);

        // Write to database.
        String id;
        try {
            id = inputService.save(mongoInput);
View Full Code Here

            LOG.debug("Version check reports current version: " + parsedResponse);

            if (reportedVersion.greaterMinor(ServerVersion.VERSION)) {
                LOG.debug("Reported version is higher than ours ({}). Writing notification.", ServerVersion.VERSION);

                Notification notification = notificationService.buildNow()
                        .addSeverity(Notification.Severity.NORMAL)
                        .addType(Notification.Type.OUTDATED_VERSION)
                        .addDetail("current_version", parsedResponse.toString());
                notificationService.publishIfFirst(notification);
            } else {
View Full Code Here

            final String osName = node.getJvm().getSystemProperties().get("os.name");
            if (null != osName && osName.startsWith("Windows")) {
                LOG.debug("Skipping open file limit check for Indexer node <{}> on Windows", node.getNode().getName());
            } else if (node.getProcess().getMaxFileDescriptors() < MINIMUM_OPEN_FILES_LIMIT) {
                // Write notification.
                final Notification notification = notificationService.buildNow()
                        .addType(Notification.Type.ES_OPEN_FILES)
                        .addSeverity(Notification.Severity.URGENT);

                if (notificationService.publishIfFirst(notification)) {
                    LOG.warn("Indexer node <{}> open file limit is too low: [{}]. Set it to at least {}.",
                            node.getNode().getName(),
                            node.getProcess().getMaxFileDescriptors(),
                            MINIMUM_OPEN_FILES_LIMIT);
                }
                allHigher = false;
            }
        }

        if (allHigher) {
            Notification notification = notificationService.build().addType(Notification.Type.ES_OPEN_FILES);
            notificationService.fixed(notification);
        }
    }
View Full Code Here

        for (final GarbageCollectorMXBean gc : garbageCollectors) {
            if (gc.getCollectionTime() >= gcWarningThresholdMillis) {
                LOG.warn("Last GC run with {} took longer than {}ms (count={}, time={}ms)",
                        gc.getName(), gcWarningThresholdMillis, gc.getCollectionCount(), gc.getCollectionTime());

                final Notification notification = notificationService.buildNow()
                        .addNode(nodeId.toString())
                        .addTimestamp(Tools.iso8601())
                        .addSeverity(Notification.Severity.URGENT)
                        .addType(Notification.Type.GC_TOO_LONG)
                        .addDetail("gc_name", gc.getName())
View Full Code Here

    protected Logger getLogger() {
        return LOG;
    }

    protected Notification getNotification() throws NodeNotFoundException {
        Notification notification = notificationService.buildNow();
        notification.addType(Notification.Type.NO_INPUT_RUNNING);
        notification.addSeverity(Notification.Severity.URGENT);
        notification.addNode(nodeId.toString());

        return notification;
    }
View Full Code Here

    protected void checkAndRepair() {
        if (!deflector.isUp()) {
            if (indices.exists(deflector.getName())) {
                // Publish a notification if there is an *index* called graylog2_deflector
                Notification notification = notificationService.buildNow()
                        .addType(Notification.Type.DEFLECTOR_EXISTS_AS_INDEX)
                        .addSeverity(Notification.Severity.URGENT);
                final boolean published = notificationService.publishIfFirst(notification);
                if (published) {
                    LOG.warn("There is an index called [" + deflector.getName() + "]. Cannot fix this automatically and published a notification.");
View Full Code Here

                } else {
                    alertSender.sendEmails(stream, result);
                }
            } catch (TransportConfigurationException e) {
                LOG.warn("Stream [{}] has alert receivers and is triggered, but email transport is not configured.", stream);
                Notification notification = notificationService.buildNow()
                        .addNode(nodeId.toString())
                        .addType(Notification.Type.EMAIL_TRANSPORT_CONFIGURATION_INVALID)
                        .addSeverity(Notification.Severity.NORMAL)
                        .addDetail("stream_id", stream.getId())
                        .addDetail("exception", new ExceptionStringFormatter(e).toString());
                notificationService.publishIfFirst(notification);
            } catch (Exception e) {
                LOG.error("Stream [" + stream + "] has alert receivers and is triggered, but sending emails failed", e);
                Notification notification = notificationService.buildNow()
                        .addNode(nodeId.toString())
                        .addType(Notification.Type.EMAIL_TRANSPORT_FAILED)
                        .addSeverity(Notification.Severity.NORMAL)
                        .addDetail("stream_id", stream.getId())
                        .addDetail("exception", e.toString() + " (" + e.getCause().toString() + "");
View Full Code Here

                String msg = "Completed starting [" + state.getMessageInput().getClass().getCanonicalName() + "] input with ID <" + state.getMessageInput().getId() + ">";
                activityWriter.write(new Activity(msg, InputRegistry.class));
                break;
            case FAILED:
                activityWriter.write(new Activity(state.getDetailedMessage(), InputRegistry.class));
                Notification notification = notificationService.buildNow();
                notification.addType(Notification.Type.INPUT_FAILED_TO_START).addSeverity(Notification.Severity.NORMAL);
                notification.addNode(serverStatus.getNodeId().toString());
                notification.addDetail("input_id", state.getMessageInput().getId());
                notification.addDetail("reason", state.getDetailedMessage());
                notificationService.publishIfFirst(notification);
                break;
        }
    }
View Full Code Here

                        streamService.pause(stream);
                        faultCount.set(0);
                        getStreamFaultsExceededMeter(stream.getId()).mark();
                        LOG.error("Processing of stream <" + stream.getId() + "> failed to return within " + timeout + "ms for more than " + maxFaultCount + " times. Disabling stream.");

                        Notification notification = notificationService.buildNow()
                                .addType(Notification.Type.STREAM_PROCESSING_DISABLED)
                                .addSeverity(Notification.Severity.URGENT)
                                .addDetail("stream_id", stream.getId())
                                .addDetail("fault_count", streamFaultCount);
                        notificationService.publishIfFirst(notification);
View Full Code Here

TOP

Related Classes of org.graylog2.notifications.Notification

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.