当前位置: 首页>>代码示例>>Java>>正文


Java MessageOutputConfigurationException类代码示例

本文整理汇总了Java中org.graylog2.plugin.outputs.MessageOutputConfigurationException的典型用法代码示例。如果您正苦于以下问题:Java MessageOutputConfigurationException类的具体用法?Java MessageOutputConfigurationException怎么用?Java MessageOutputConfigurationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MessageOutputConfigurationException类属于org.graylog2.plugin.outputs包,在下文中一共展示了MessageOutputConfigurationException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import org.graylog2.plugin.outputs.MessageOutputConfigurationException; //导入依赖的package包/类
@Before
public void setUp() throws MessageOutputConfigurationException {
    final Configuration configuration = new Configuration(
            ImmutableMap.of(
                    "redis_uri", "redis://" + REDIS_HOST + ":" + REDIS_PORT,
                    "redis_channel", "graylog"
            )

    );
    when(serverStatus.getClusterId()).thenReturn(CLUSTER_ID);
    when(nodeId.toString()).thenReturn(NODE_ID);
    when(serverStatus.getNodeId()).thenReturn(nodeId);

    output = new GELFRedisOutput(configuration, serverStatus);

    assumeTrue(output.isRunning());
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-redis,代码行数:18,代码来源:GELFRedisOutputIT.java

示例2: GraylogPluginDatadog

import org.graylog2.plugin.outputs.MessageOutputConfigurationException; //导入依赖的package包/类
@Inject
public GraylogPluginDatadog(@Assisted Stream stream, @Assisted Configuration configuration) throws MessageOutputConfigurationException {
    this.configuration = configuration;

    tags = configuration.getString(CK_DATADOG_TAGS, "").split(",");
    priority = configuration.getString(CK_DATADOG_PRIORITY, "normal");
    alertType = configuration.getString(CK_DATADOG_ALERT_TYPE, "info");
    aggregationKey = configuration.getString(CK_DATADOG_AGGREGATION_KEY, "");

    try {
        eventUrl = new URI(String.format("%s?api_key=%s&app_key=%s",
                                         DATADOG_API_URL,
                                         configuration.getString(CK_DATADOG_API_KEY),
                                         configuration.getString(CK_DATADOG_APP_KEY)));
    } catch (URISyntaxException e){
        throw new MessageOutputConfigurationException("Syntax error in datadog event URL");
    }

    Client client = ClientBuilder.newClient();
    eventTarget = client.target(eventUrl);
    isRunning.set(true);
}
 
开发者ID:underdogio,项目名称:graylog-plugin-datadog,代码行数:23,代码来源:GraylogPluginDatadog.java

示例3: RiemannOutput

import org.graylog2.plugin.outputs.MessageOutputConfigurationException; //导入依赖的package包/类
@Inject
public RiemannOutput(@Assisted Configuration configuration) throws MessageOutputConfigurationException {
    this.configuration = configuration;

    try {
        this.riemannClient = getClient(configuration.getString(CK_RIEMANN_PROTOCOL));
        disconnecting.set(false);
        needReconnect.set(false);
        riemannClient.connect();
    } catch (IOException e) {
        LOG.error("Can not connect to Riemann server " + configuration.getString(CK_RIEMANN_HOST), e);
    }

    new Thread(reconnectHandler).start();
    isRunning.set(true);
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-riemann,代码行数:17,代码来源:RiemannOutput.java

示例4: SlackMessageOutput

import org.graylog2.plugin.outputs.MessageOutputConfigurationException; //导入依赖的package包/类
@Inject
public SlackMessageOutput(
        @Assisted Stream stream,
        @Assisted Configuration configuration)
        throws MessageOutputConfigurationException {
    this.configuration = configuration;
    this.stream = stream;

    // Check configuration.
    try {
        checkConfiguration(configuration);
    } catch (ConfigurationException e) {
        throw new MessageOutputConfigurationException("Missing configuration: " + e.getMessage());
    }

    this.client = new SlackClient(configuration);

    running.set(true);
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-slack,代码行数:20,代码来源:SlackMessageOutput.java

示例5: GELFRedisOutput

import org.graylog2.plugin.outputs.MessageOutputConfigurationException; //导入依赖的package包/类
@Inject
public GELFRedisOutput(@Assisted Configuration configuration, ServerStatus serverStatus) throws MessageOutputConfigurationException {
    this(
            new RedisClientBuilder(configuration).buildClient(),
            configuration.getString(CK_CHANNEL, "graylog"),
            serverStatus.getNodeId().toString(),
            serverStatus.getClusterId()
    );
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-redis,代码行数:10,代码来源:GELFRedisOutput.java

示例6: WebHDFSOutput

import org.graylog2.plugin.outputs.MessageOutputConfigurationException; //导入依赖的package包/类
@Inject
public WebHDFSOutput(@Assisted Stream stream, @Assisted Configuration configuration)
        throws MessageOutputConfigurationException, IOException {
    this.configuration = configuration;

    LOG.info("WebHDFSOutput launching...");

    String hostname = configuration.getString(CK_HDFS_HOST_NAME);
    int port = configuration.getInt(CK_HDFS_PORT);
    String username = configuration.getString(CK_USERNAME);

    hdfsConnection = new WebHDFSConnection("http://" + hostname + ":" + port, username, "anything",
            AuthenticationType.PSEUDO);

    messagesToWrite = new LinkedList<>();


    fileToWrite = configuration.getString(CK_FILE);
    if(fileToWrite.contains("%")) {
        fileToWrite = fileToWrite.replaceAll("%","%1\\$t");
    }
    messageFormat = configuration.getString(CK_MESSAGE_FORMAT);
    flushIntervalInMillis = configuration.getInt(CK_FLUSH_INTERVAL) * 1000;

    if(flushIntervalInMillis > 0) {
        flushTimer = new Timer("WebHDFS-Flush-Timer", true);
        flushTask = createFlushTask();
        flushTimer.schedule(flushTask, flushIntervalInMillis, flushIntervalInMillis);
    }

    //append = configuration.getBoolean(CK_APPEND);
    isRunning.set(true);
    LOG.info("WebHDFSOutput launched");
}
 
开发者ID:sivasamyk,项目名称:graylog-plugin-output-webhdfs,代码行数:35,代码来源:WebHDFSOutput.java

示例7: MetricsOutput

import org.graylog2.plugin.outputs.MessageOutputConfigurationException; //导入依赖的package包/类
@Inject
public MetricsOutput(@Assisted Stream stream, @Assisted Configuration configuration) throws MessageOutputConfigurationException {
    this.configuration = configuration;
    metricFields = Arrays.asList(configuration.getString(CK_FIELDS).split(","));

    metricBuffer.clear();

    if (!checkConfiguration(configuration)) {
        throw new RuntimeException("Missing configuration parameters.");
    }

    URI uri = parseUrl(configuration.getString(CK_URL));

    switch (uri.getScheme()) {
        case "graphite":
            graphiteReporter = createGraphiteReporter(uri);
            break;
        case "ganglia":
            gangliaReporter = createGangliaReporter(uri);
            break;
        case "statsd":
            statsDReporter = createStatsDReporter(uri);
            break;
        default:
            LOG.error("Metrics backend not supported!");
            break;
    }

    isRunning.set(true);
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-metrics,代码行数:31,代码来源:MetricsOutput.java

示例8: Neo4JBoltTransport

import org.graylog2.plugin.outputs.MessageOutputConfigurationException; //导入依赖的package包/类
public Neo4JBoltTransport(Configuration config) throws MessageOutputConfigurationException {


        configuration = config;
        fields = new LinkedList<String>();;
        Session session = null;

        try {
            driver = GraphDatabase.driver( config.getString(Neo4jOutput.CK_NEO4J_URL),
                    AuthTokens.basic(config.getString(Neo4jOutput.CK_NEO4J_USER), config.getString(Neo4jOutput.CK_NEO4J_PASSWORD)) );
            session = driver.session();

            //run initialization query only once
            String createQueryOnce = config.getString(Neo4jOutput.CK_NEO4J_STARTUP_QUERY);

            if (createQueryOnce.length() > 0)
                session.run(createQueryOnce);
        }
        catch (ClientException e){
            throw new MessageOutputConfigurationException("Malformed neo4j configuration: " + e );
        }
        finally {
            session.close();
        }
        //get message fields needed by cypher query
        String createQuery = config.getString(Neo4jOutput.CK_NEO4J_QUERY);
        LOG.debug("Bolt protocol, create query: " + createQuery);

        Matcher m = Pattern.compile("\\{([^{}]*)\\}").matcher(createQuery);
        while (m.find()) {
            fields.add(m.group(1));
            LOG.debug("Found field in cypher statement: " + m.group(1));
        }
        LOG.info("Identified " + fields.size() + " fields in graph create query.");

        parsedCreateQery = parseQuery(createQuery);


    }
 
开发者ID:mariussturm,项目名称:graylog-plugin-output-neo4j,代码行数:40,代码来源:Neo4JBoltTransport.java

示例9: Neo4jOutput

import org.graylog2.plugin.outputs.MessageOutputConfigurationException; //导入依赖的package包/类
@Inject
public Neo4jOutput(@Assisted Stream stream, @Assisted Configuration config) throws MessageOutputConfigurationException {
    configuration = config;
    final Neo4jTransports transportSelection;
    switch (configuration.getString(CK_PROTOCOL).toUpperCase(Locale.ENGLISH)) {
        case "BOLT":
            transportSelection = Neo4jTransports.BOLT;
            break;
        case "HTTP":
            transportSelection = Neo4jTransports.HTTP;
            break;

        default:
            throw new MessageOutputConfigurationException("Unknown protocol " + configuration.getString(CK_PROTOCOL));
    }

    try {
        transport = Neo4jTransports.create(transportSelection, configuration);
    } catch (Exception e) {
        final String error = "Error initializing " + INeo4jTransport.class;
        LOG.error(error, e);
        throw new MessageOutputConfigurationException(error);
    }

    LOG.info("Neo4j output started!");
    isRunning.set(true);
}
 
开发者ID:mariussturm,项目名称:graylog-plugin-output-neo4j,代码行数:28,代码来源:Neo4jOutput.java

示例10: SplunkOutput

import org.graylog2.plugin.outputs.MessageOutputConfigurationException; //导入依赖的package包/类
@Inject
public SplunkOutput(@Assisted Configuration configuration) throws MessageOutputConfigurationException {
    // Check configuration.
    if (!checkConfiguration(configuration)) {
        throw new MessageOutputConfigurationException("Missing configuration.");
    }

    // Set up sender.
    sender = new TCPSender(
            configuration.getString(CK_SPLUNK_HOST),
            configuration.getInt(CK_SPLUNK_PORT)
    );

    running = true;
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-splunk,代码行数:16,代码来源:SplunkOutput.java

示例11: testGetAttributes

import org.graylog2.plugin.outputs.MessageOutputConfigurationException; //导入依赖的package包/类
@Test
public void testGetAttributes() throws MessageOutputConfigurationException {
    SlackMessageOutput output = new SlackMessageOutput(null, new Configuration(VALID_CONFIG_SOURCE));

    final Map<String, Object> attributes = output.getConfiguration();
    assertThat(attributes.keySet(), hasItems("webhook_url", "channel", "user_name",
            "notify_channel", "link_names", "icon_url", "icon_emoji", "graylog2_url", "color"));
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-slack,代码行数:9,代码来源:SlackMessageOutputTest.java

示例12: checkConfiguration

import org.graylog2.plugin.outputs.MessageOutputConfigurationException; //导入依赖的package包/类
private void checkConfiguration() throws MessageOutputConfigurationException {
    for (String field : REQUIRED_FIELDS) {
        if (!configSet(configuration, field)) {
            throw new MessageOutputConfigurationException("Missing configuration option: " + field);
        }
    }
}
 
开发者ID:intelie,项目名称:graylog2-plugin-output-syslog,代码行数:8,代码来源:SyslogOutput.java

示例13: setUp

import org.graylog2.plugin.outputs.MessageOutputConfigurationException; //导入依赖的package包/类
@Before
public void setUp() throws MessageOutputConfigurationException {
    eventBus = new EventBus();
    localMetricRegistry = new LocalMetricRegistry();
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-redis,代码行数:6,代码来源:RedisTransportIT.java

示例14: checkConfigurationSucceedsWithValidConfiguration

import org.graylog2.plugin.outputs.MessageOutputConfigurationException; //导入依赖的package包/类
@Test
public void checkConfigurationSucceedsWithValidConfiguration() throws MessageOutputConfigurationException {
    new SlackMessageOutput(null, new Configuration(VALID_CONFIG_SOURCE));
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-slack,代码行数:5,代码来源:SlackMessageOutputTest.java

示例15: checkConfigurationFailsIfApiTokenIsMissing

import org.graylog2.plugin.outputs.MessageOutputConfigurationException; //导入依赖的package包/类
@Test(expected = MessageOutputConfigurationException.class)
public void checkConfigurationFailsIfApiTokenIsMissing() throws MessageOutputConfigurationException {
    new SlackMessageOutput(null, validConfigurationWithout("webhook_url"));
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-slack,代码行数:5,代码来源:SlackMessageOutputTest.java


注:本文中的org.graylog2.plugin.outputs.MessageOutputConfigurationException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。