public String getNameWithoutLocation() { return String.format(NAME_FORMAT_WITHOUT_LOCATION, SystemInfoUtils.getInstanceId(), m_component, m_endpoint); }
@Override public boolean isMeridian() { return sysInfoUtils.getPackageName().contains("meridian"); }
public RuntimeInfoImpl() { version = new VersionBean(sysInfoUtils.getDisplayVersion()); }
public UsageStatisticsReportDTO generateReport() { final SystemInfoUtils sysInfoUtils = new SystemInfoUtils(); final UsageStatisticsReportDTO usageStatisticsReport = new UsageStatisticsReportDTO(); // Unique system identifier try { usageStatisticsReport.setSystemId(m_stateManager.getOrGenerateSystemId()); } catch (IOException e) { LOG.warn("An error occurred while retrieving the system id. " + "The usage report will be submitted with a null system id.", e); } // Operating System usageStatisticsReport.setOsName(System.getProperty("os.name")); usageStatisticsReport.setOsArch(System.getProperty("os.arch")); usageStatisticsReport.setOsVersion(System.getProperty("os.version")); // OpenNMS version and flavor usageStatisticsReport.setVersion(sysInfoUtils.getVersion()); usageStatisticsReport.setPackageName(sysInfoUtils.getPackageName()); // Object counts usageStatisticsReport.setNodes(m_nodeDao.countAll()); usageStatisticsReport.setIpInterfaces(m_ipInterfaceDao.countAll()); usageStatisticsReport.setSnmpInterfaces(m_snmpInterfaceDao.countAll()); usageStatisticsReport.setMonitoredServices(m_monitoredServiceDao.countAll()); usageStatisticsReport.setEvents(m_eventDao.countAll()); usageStatisticsReport.setAlarms(m_alarmDao.countAll()); // Node statistics usageStatisticsReport.setNodesBySysOid(m_nodeDao.getNumberOfNodesBySysOid()); return usageStatisticsReport; }
public UsageStatisticsReportDTO generateReport() { final SystemInfoUtils sysInfoUtils = new SystemInfoUtils(); final UsageStatisticsReportDTO usageStatisticsReport = new UsageStatisticsReportDTO(); // Unique system identifier try { usageStatisticsReport.setSystemId(m_stateManager.getOrGenerateSystemId()); } catch (IOException e) { LOG.warn("An error occurred while retrieving the system id. " + "The usage report will be submitted with a null system id.", e); } // Operating System usageStatisticsReport.setOsName(System.getProperty("os.name")); usageStatisticsReport.setOsArch(System.getProperty("os.arch")); usageStatisticsReport.setOsVersion(System.getProperty("os.version")); // OpenNMS version and flavor usageStatisticsReport.setVersion(sysInfoUtils.getVersion()); usageStatisticsReport.setPackageName(sysInfoUtils.getPackageName()); // Object counts usageStatisticsReport.setNodes(m_nodeDao.countAll()); usageStatisticsReport.setIpInterfaces(m_ipInterfaceDao.countAll()); usageStatisticsReport.setSnmpInterfaces(m_snmpInterfaceDao.countAll()); usageStatisticsReport.setMonitoredServices(m_monitoredServiceDao.countAll()); usageStatisticsReport.setEvents(m_eventDao.countAll()); usageStatisticsReport.setAlarms(m_alarmDao.countAll()); // Node statistics usageStatisticsReport.setNodesBySysOid(m_nodeDao.getNumberOfNodesBySysOid()); return usageStatisticsReport; }
public String getNameWithoutLocation() { return String.format(NAME_FORMAT_WITHOUT_LOCATION, SystemInfoUtils.getInstanceId(), m_component, m_endpoint); }
public String getNameWithLocation(String location) { return String.format(NAME_FORMAT_WITH_LOCATION, SystemInfoUtils.getInstanceId(), location, m_component, m_endpoint); }
public String getNameWithLocation(String location) { return String.format(NAME_FORMAT_WITH_LOCATION, SystemInfoUtils.getInstanceId(), location, m_component, m_endpoint); }
@Override public Properties getProperties() { final Properties kafkaConfig = new Properties(); kafkaConfig.put("group.id", SystemInfoUtils.getInstanceId()); // Find all of the system properties that start with provided prefix (kafkaSysPropPrefix) // and add them to the config. // See https://kafka.apache.org/0100/documentation.html#newconsumerconfigs for the list of supported properties for (Map.Entry<Object, Object> entry : System.getProperties().entrySet()) { final Object keyAsObject = entry.getKey(); if (keyAsObject == null || !(keyAsObject instanceof String)) { continue; } final String key = (String) keyAsObject; if (key.length() > kafkaSysPropPrefix.length() && key.startsWith(kafkaSysPropPrefix)) { final String kafkaConfigKey = key.substring(kafkaSysPropPrefix.length()); kafkaConfig.put(kafkaConfigKey, entry.getValue()); } } return kafkaConfig; } }
private String getRpcRequestQueueName(String moduleId, String location) { String queueName = String.format("%s-%s-%s", SystemInfoUtils.getInstanceId(), moduleId, location); if (!Strings.isNullOrEmpty(sqsConfig.getQueuePrefix())) { queueName = String.format("%s-%s", sqsConfig.getQueuePrefix(), queueName); } return queueName; }
@Override public void afterPropertiesSet() throws Exception { // Set the defaults kafkaConfig.clear(); kafkaConfig.put("group.id", SystemInfoUtils.getInstanceId()); kafkaConfig.put("enable.auto.commit", "true"); kafkaConfig.put("key.deserializer", StringDeserializer.class.getCanonicalName()); kafkaConfig.put("value.deserializer", ByteArrayDeserializer.class.getCanonicalName()); kafkaConfig.put("auto.commit.interval.ms", "1000"); // Find all of the system properties that start with 'org.opennms.core.ipc.sink.kafka.' // and add them to the config. See https://kafka.apache.org/0100/documentation.html#newconsumerconfigs // for the list of supported properties for (Entry<Object, Object> entry : System.getProperties().entrySet()) { final Object keyAsObject = entry.getKey(); if (keyAsObject == null || !(keyAsObject instanceof String)) { continue; } final String key = (String)keyAsObject; if (key.length() > KafkaSinkConstants.KAFKA_CONFIG_SYS_PROP_PREFIX.length() && key.startsWith(KafkaSinkConstants.KAFKA_CONFIG_SYS_PROP_PREFIX)) { final String kafkaConfigKey = key.substring(KafkaSinkConstants.KAFKA_CONFIG_SYS_PROP_PREFIX.length()); kafkaConfig.put(kafkaConfigKey, entry.getValue()); } } LOG.info("KafkaMessageConsumerManager: consuming from Kafka using: {}", kafkaConfig); } }
public void start() { // Set the defaults kafkaConfig.clear(); kafkaConfig.put("group.id", SystemInfoUtils.getInstanceId()); kafkaConfig.put("enable.auto.commit", "false"); kafkaConfig.put("auto.offset.reset", "latest"); kafkaConfig.put("key.deserializer", ByteArrayDeserializer.class.getCanonicalName()); kafkaConfig.put("value.deserializer", ByteArrayDeserializer.class.getCanonicalName()); // Find all of the system properties that start with // 'org.opennms.core.ipc.sink.kafka.' // and add them to the config. See // https://kafka.apache.org/0100/documentation.html#newconsumerconfigs // for the list of supported properties for (Entry<Object, Object> entry : System.getProperties().entrySet()) { final Object keyAsObject = entry.getKey(); if (keyAsObject == null || !(keyAsObject instanceof String)) { continue; } final String key = (String) keyAsObject; if (key.length() > KafkaSinkConstants.KAFKA_CONFIG_SYS_PROP_PREFIX.length() && key.startsWith(KafkaSinkConstants.KAFKA_CONFIG_SYS_PROP_PREFIX)) { final String kafkaConfigKey = key.substring(KafkaSinkConstants.KAFKA_CONFIG_SYS_PROP_PREFIX.length()); kafkaConfig.put(kafkaConfigKey, entry.getValue()); } } consumerRunner = new KafkaOffsetConsumerRunner(); reporter = JmxReporter.forRegistry(kafkaOffsetMetrics).inDomain("org.opennms.core.ipc.sink.kafka").build(); reporter.start(); executor.execute(consumerRunner); }
protected String getSinkQueueName(String moduleId) { final String prefix = !Strings.isNullOrEmpty(sqsConfig.getQueuePrefix()) ? sqsConfig.getQueuePrefix() + "-" : ""; final String suffix = sqsConfig.getSinkQueueConfig().isFifoEnabled() ? ".fifo" : ""; return String.format("%s%s-%s-%s%s", prefix, SystemInfoUtils.getInstanceId(), "Sink", moduleId, suffix); }
kafkaConfig.put(ConsumerConfig.GROUP_ID_CONFIG, SystemInfoUtils.getInstanceId()); kafkaConfig.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "true"); kafkaConfig.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getCanonicalName());
kafkaConfig.put(ConsumerConfig.GROUP_ID_CONFIG, SystemInfoUtils.getInstanceId()); kafkaConfig.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "true"); kafkaConfig.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getCanonicalName());
Struct struct = (Struct) schema.read(key); String group = struct.getString(KafkaOffsetConstants.GROUP); if ( !group.equals(SystemInfoUtils.getInstanceId())) { continue;
Struct struct = (Struct) schema.read(key); String group = struct.getString(KafkaOffsetConstants.GROUP); if ( !group.equals(SystemInfoUtils.getInstanceId())) { continue;
Struct struct = (Struct) schema.read(key); String group = struct.getString(KafkaOffsetConstants.GROUP); if ( !group.equals(SystemInfoUtils.getInstanceId())) { continue;