本文整理汇总了Java中org.graylog2.plugin.inputs.MisfireException类的典型用法代码示例。如果您正苦于以下问题:Java MisfireException类的具体用法?Java MisfireException怎么用?Java MisfireException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MisfireException类属于org.graylog2.plugin.inputs包,在下文中一共展示了MisfireException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doLaunch
import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void doLaunch(MessageInput input) throws MisfireException {
serverStatus.awaitRunning(() -> lifecycleStateChange(Lifecycle.RUNNING));
LOG.info("Starting s3 subscriber");
final String legacyRegionName = input.getConfiguration().getString(CK_LEGACY_AWS_REGION, DEFAULT_REGION.getName());
final String sqsRegionName = input.getConfiguration().getString(CK_AWS_SQS_REGION, legacyRegionName);
final String s3RegionName = input.getConfiguration().getString(CK_AWS_S3_REGION, legacyRegionName);
subscriber = new S3Subscriber(
Region.getRegion(Regions.fromName(sqsRegionName)),
Region.getRegion(Regions.fromName(s3RegionName)),
input.getConfiguration().getString(CK_SQS_NAME),
input,
input.getConfiguration().getString(CK_ACCESS_KEY),
input.getConfiguration().getString(CK_SECRET_KEY),
input.getConfiguration().getInt(CK_THREAD_COUNT)
);
subscriber.start();
}
示例2: doLaunch
import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
protected void doLaunch(final MessageInput input) throws MisfireException {
consumer = new NsqClientBuilder(configuration).buildLookupd(new NSQMessageCallback() {
@Override
public void message(NSQMessage nsqMessage) {
final RawMessage rawMessage = new RawMessage(nsqMessage.getMessage());
nsqMessage.finished();
input.processRawMessage(rawMessage);
// do throttle the code
if (isThrottled()) {
blockUntilUnthrottled();
}
}
});
consumer.start();
}
示例3: launch
import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void launch(MessageInput input) throws MisfireException {
appender = new DirectConsumingAppender(
"graylog-plugin-internal-logs",
logEvent -> input.processRawMessage(new RawMessage(logEvent)),
threshold);
addAppender(appender);
}
示例4: launch
import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void launch(final MessageInput messageInput) throws MisfireException {
LogEventListener listener = new LogEventListener() {
@Override
public void onEvents(List<LogEvent> list) {
ObjectMapper mapper = new ObjectMapper();
try {
for (LogEvent event : list) {
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
mapper.writeValue(byteStream,convertToGELF(event));
messageInput.processRawMessage(new RawMessage(byteStream.toByteArray()));
byteStream.close();
}
} catch (Exception e) {
LOGGER.warn("Exception while processing event ",e);
}
}
};
ServerConfiguration serverConfiguration = new ServerConfiguration();
serverConfiguration.setIpAddress(configuration.getString(CK_BIND_IP));
serverConfiguration.setPort(configuration.getInt(CK_BIND_PORT));
serverConfiguration.setKeyStorePath(configuration.getString(CK_KEYSTORE_PATH));
serverConfiguration.setKeyStorePass(configuration.getString(CK_KEYSTORE_PASSWORD));
serverConfiguration.setKeyPass(configuration.getString(CK_KEY_PASSWORD));
LOGGER.info("Starting LumberjackTransport with config :" + configuration);
lumberjackServer = new LumberjackServer(serverConfiguration,
listener);
lumberjackServer.start();
LOGGER.info("Lumberjack transport started");
}
示例5: launch
import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void launch(final MessageInput messageInput) throws MisfireException {
EventListener listener = new EventListener() {
@Override
public void onEvents(List<Event> list) {
ObjectMapper mapper = new ObjectMapper();
try {
for (Event event : list) {
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
mapper.writeValue(byteStream,convertToGELF(event));
messageInput.processRawMessage(new RawMessage(byteStream.toByteArray()));
byteStream.close();
}
} catch (Exception e) {
LOGGER.warn("Exception while processing event ",e);
}
}
};
ServerConfiguration serverConfiguration = new ServerConfiguration();
serverConfiguration.setIpAddress(configuration.getString(CK_BIND_IP));
serverConfiguration.setPort(configuration.getInt(CK_BIND_PORT));
serverConfiguration.setKeyStorePath(configuration.getString(CK_KEYSTORE_PATH));
serverConfiguration.setKeyStorePass(configuration.getString(CK_KEYSTORE_PASSWORD));
serverConfiguration.setKeyPass(configuration.getString(CK_KEY_PASSWORD));
LOGGER.info("Starting BeatsTransport with config :" + configuration);
lumberjackServer = new LumberjackServer(serverConfiguration,
listener);
lumberjackServer.start();
LOGGER.info("BeatsTransport started");
}
示例6: launch
import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void launch(MessageInput input) throws MisfireException {
ExecutorService executor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder()
.setDaemon(true)
.setNameFormat("aws-kinesis-reader-%d")
.setUncaughtExceptionHandler((t, e) -> LOG.error("Uncaught exception in AWS Kinesis reader.", e))
.build());
final AWSPluginConfiguration awsConfig = clusterConfigService.getOrDefault(AWSPluginConfiguration.class,
AWSPluginConfiguration.createDefault());
AWSAuthProvider authProvider = new AWSAuthProvider(
awsConfig, configuration.getString(CK_ACCESS_KEY),
configuration.getString(CK_SECRET_KEY),
configuration.getString(CK_AWS_REGION),
configuration.getString(CK_ASSUME_ROLE_ARN)
);
this.reader = new KinesisConsumer(
configuration.getString(CK_KINESIS_STREAM_NAME),
Region.getRegion(Regions.fromName(configuration.getString(CK_AWS_REGION))),
kinesisCallback(input),
awsConfig,
authProvider,
nodeId,
graylogConfiguration.getHttpProxyUri() == null ? null : HttpUrl.get(graylogConfiguration.getHttpProxyUri())
);
LOG.info("Starting Kinesis reader thread for input [{}/{}]", input.getName(), input.getId());
executor.submit(this.reader);
}
示例7: doLaunch
import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void doLaunch(MessageInput input) throws MisfireException {
serverStatus.awaitRunning(() -> lifecycleStateChange(Lifecycle.RUNNING));
final AWSPluginConfiguration config = clusterConfigService.getOrDefault(AWSPluginConfiguration.class,
AWSPluginConfiguration.createDefault());
LOG.info("Starting cloud trail subscriber");
final String legacyRegionName = input.getConfiguration().getString(CK_LEGACY_AWS_REGION, DEFAULT_REGION.getName());
final String sqsRegionName = input.getConfiguration().getString(CK_AWS_SQS_REGION, legacyRegionName);
final String s3RegionName = input.getConfiguration().getString(CK_AWS_S3_REGION, legacyRegionName);
final HttpUrl proxyUrl = config.proxyEnabled() && httpProxyUri != null ? HttpUrl.get(httpProxyUri) : null;
final AWSAuthProvider authProvider = new AWSAuthProvider(
config,
input.getConfiguration().getString(CK_ACCESS_KEY),
input.getConfiguration().getString(CK_SECRET_KEY),
input.getConfiguration().getString(CK_AWS_SQS_REGION),
input.getConfiguration().getString(CK_ASSUME_ROLE_ARN)
);
subscriber = new CloudTrailSubscriber(
Region.getRegion(Regions.fromName(sqsRegionName)),
Region.getRegion(Regions.fromName(s3RegionName)),
input.getConfiguration().getString(CK_SQS_NAME),
input,
authProvider,
proxyUrl,
objectMapper
);
subscriber.start();
}
示例8: launch
import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void launch(MessageInput messageInput) throws MisfireException {
this.executionInterval = configuration.getInt(CK_CONFIG_INTERVAL);
this.getExecutionIntervalTimeUnit = TimeUnit.valueOf(configuration.getString(CK_CONFIG_INTERVAL_UNIT));
this.label = configuration.getString(CK_CONFIG_LABEL);
String hosts[] = configuration.getString(CK_CONFIG_HOSTS).split(",");
servers = new ArrayList<>(hosts.length);
for (String host : hosts) {
Server server = Server.builder().setHost(host.trim())
.setPort(String.valueOf(configuration.getInt(CK_CONFIG_PORT)))
.setUsername(configuration.getString(CK_CONFIG_USER_NAME))
.setPassword(configuration.getString(CK_CONFIG_PASSWORD))
.setTrustStorePath(configuration.getString(CK_CONFIG_TRUSTSTORE_PATH))
.setTrustStorePass(configuration.getString(CK_CONFIG_TRUSTSTORE_PASS))
.build();
servers.add(server);
}
String jmxObjectType = configuration.getString(CK_CONFIG_TYPE);
ObjectMapper configMapper = new ObjectMapper();
String jsonFilePath = jmxObjectType;
try {
if ("custom".equals(jmxObjectType)) {
jsonFilePath = configuration.getString(CK_CONFIG_CUSTOM_FILE_PATH);
if (jsonFilePath != null && jsonFilePath.length() > 0) {
if (new File(jsonFilePath).exists()) {
queryConfig = configMapper.readValue(new File(jsonFilePath), GLQueryConfig.class);
} else {
LOGGER.error("Custom config file not present." + jsonFilePath);
throw new MisfireException("Cannot find custom config file " + jsonFilePath);
}
} else {
LOGGER.error("Custom config file not entered.");
throw new MisfireException("Custom config file not entered");
}
} else {
queryConfig = configMapper.readValue(
JMXTransport.class.getClassLoader().getResourceAsStream(jsonFilePath),
GLQueryConfig.class);
}
} catch (IOException e) {
LOGGER.error("Exception while parsing config file", e);
throw new MisfireException("Exception while parsing config file " + jsonFilePath, e);
}
startMonitoring(messageInput);
}
示例9: launch
import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void launch(MessageInput messageInput) throws MisfireException {
scheduler.scheduleAtFixedRate(readDataFromNOAA(messageInput), 0, 60, TimeUnit.SECONDS);
}
示例10: launch
import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void launch(MessageInput messageInput) throws MisfireException {
this.messageInput = messageInput;
URLMonitorConfig urlMonitorConfig = new URLMonitorConfig();
urlMonitorConfig.setUrl(configuration.getString(CK_CONFIG_URL));
urlMonitorConfig.setLabel(configuration.getString(CK_CONFIG_LABEL));
urlMonitorConfig.setMethod(configuration.getString(CK_CONFIG_METHOD));
String proxyUri = configuration.getString(CK_CONFIG_HTTP_PROXY);
if (proxyUri != null && !proxyUri.isEmpty()) {
urlMonitorConfig.setHttpProxyUri(URI.create(proxyUri));
}
String requestHeaders = configuration.getString(CK_CONFIG_HEADERS_TO_SEND);
if (StringUtils.isNotEmpty(requestHeaders)) {
urlMonitorConfig.setRequestHeadersToSend(
requestHeaders.split(","));
}
urlMonitorConfig.setUsername(configuration.getString(CK_CONFIG_USER_NAME));
urlMonitorConfig.setPassword(configuration.getString(CK_CONFIG_PASSWORD));
urlMonitorConfig.setExecutionInterval(configuration.getInt(CK_CONFIG_INTERVAL));
urlMonitorConfig.setTimeout(configuration.getInt(CK_CONFIG_TIMEOUT));
urlMonitorConfig.setTimeoutUnit(TimeUnit.valueOf(configuration.getString(CK_CONFIG_TIMEOUT_UNIT)));
urlMonitorConfig.setIntervalUnit(TimeUnit.valueOf(configuration.getString(CK_CONFIG_INTERVAL_UNIT)));
// long timoutInMs = TimeUnit.MILLISECONDS.convert(urlMonitorConfig.getTimeout(), urlMonitorConfig.getTimeoutUnit());
// long intervalInMs = TimeUnit.MILLISECONDS.convert(urlMonitorConfig.getExecutionInterval(), urlMonitorConfig.getIntervalUnit());
//
// if (intervalInMs <= timoutInMs) {
// String message = MessageFormat.format("Timeout {0} {1} should be smaller than interval {2} {3}",
// urlMonitorConfig.getTimeout(),urlMonitorConfig.getTimeoutUnit(),
// urlMonitorConfig.getExecutionInterval(), urlMonitorConfig.getIntervalUnit());
// throw new MisfireException(message);
// }
urlMonitorConfig.setRequestBody(configuration.getString(CK_CONFIG_REQUEST_BODY));
urlMonitorConfig.setLogResponseBody(configuration.getBoolean(CK_CONFIG_LOG_RESPONSE_BODY));
String responseHeaders = configuration.getString(CK_CONFIG_HEADERS_TO_RECORD);
if (StringUtils.isNotEmpty(responseHeaders)) {
urlMonitorConfig.setResponseHeadersToRecord(
responseHeaders.split(","));
}
startMonitoring(urlMonitorConfig);
}
示例11: launch
import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void launch(MessageInput input) throws MisfireException {
serverStatus.awaitRunning(() -> lifecycleStateChange(Lifecycle.RUNNING));
serverEventBus.register(this);
LOG.debug("Launching MongoDB profiler reader.");
final Configuration configuration = input.getConfiguration();
final int port = configuration.getInt(CK_MONGO_PORT);
final MongoClient mongoClient;
final List<MongoCredential> credentialList;
final String db = configuration.getString(CK_MONGO_DB);
if (configuration.getBoolean(CK_MONGO_USE_AUTH)) {
final MongoCredential credentials = MongoCredential.createCredential(
configuration.getString(CK_MONGO_USER),
db,
configuration.getString(CK_MONGO_PW).toCharArray()
);
credentialList = ImmutableList.of(credentials);
} else {
credentialList = ImmutableList.of();
}
final String mongoHost = configuration.getString(CK_MONGO_HOST);
final String[] hosts = mongoHost.split(",");
final List<ServerAddress> replicaHosts = new ArrayList<>(hosts.length);
for (String host : hosts) {
replicaHosts.add(new ServerAddress(host, port));
}
mongoClient = new MongoClient(replicaHosts, credentialList);
// Try the connection.
try {
mongoClient.getDB(db).getStats();
} catch (Exception e) {
throw new MisfireException("Could not verify MongoDB profiler connection.", e);
}
subscriber = new ProfileSubscriber(mongoClient, db, input, localRegistry);
subscriber.start();
}