@Override protected void connectSensors() { connectServiceUpIsRunning(); if (((JavaSoftwareProcessDriver)getDriver()).isJmxEnabled()) { jmxFeed = JmxFeed.builder() .entity(this) .period(500, TimeUnit.MILLISECONDS) .pollAttribute(new JmxAttributePollConfig<Long>(OUTSTANDING_REQUESTS) .objectName(ZOOKEEPER_MBEAN) .attributeName("OutstandingRequests") .onFailureOrException(Functions.constant(-1l))) .pollAttribute(new JmxAttributePollConfig<Long>(PACKETS_RECEIVED) .objectName(ZOOKEEPER_MBEAN) .attributeName("PacketsReceived") .onFailureOrException(Functions.constant(-1l))) .pollAttribute(new JmxAttributePollConfig<Long>(PACKETS_SENT) .objectName(ZOOKEEPER_MBEAN) .attributeName("PacketsSent") .onFailureOrException(Functions.constant(-1l))) .build(); } }
@Override protected void connectSensors() { sensors().set(BROKER_URL, String.format("tcp://%s:%d", getAttribute(HOSTNAME), getAttribute(OPEN_WIRE_PORT))); String brokerMbeanName = "org.apache.activemq:type=Broker,brokerName=" + getBrokerName(); jmxFeed = JmxFeed.builder() .entity(this) .period(500, TimeUnit.MILLISECONDS) .pollAttribute(new JmxAttributePollConfig<Boolean>(SERVICE_UP) .objectName(brokerMbeanName) .attributeName("BrokerName") .onSuccess(Functions.forPredicate(Predicates.notNull())) .onFailureOrException(Functions.constant(false)) .suppressDuplicates(true)) .build(); }
@Override public JmxFeed call() throws Exception { JmxHelper helper = new JmxHelper(entity); JmxFeed feed = JmxFeed.builder() .entity(entity) .period(period) .helper(helper) .pollAttribute(new JmxAttributePollConfig<T>(sensor) .objectName(objectName) .attributeName(attribute) .suppressDuplicates(Boolean.TRUE.equals(suppressDuplicates)) .onFailureOrException(Functions.<T>constant((T) defaultValue))) .build(); entity.addFeed(feed); return feed; } })
.attributeName("requestCount") .enabled(retrieveUsageMetrics) .onFailureOrException(EntityFunctions.attribute(this, REQUEST_COUNT))) .pollAttribute(new JmxAttributePollConfig<Integer>(TOTAL_PROCESSING_TIME) .objectName(requestProcessorMbeanName)
.objectName(requestProcessorMbeanName) .attributeName("requestCount") .onFailureOrException(EntityFunctions.attribute(this, REQUEST_COUNT)) .enabled(retrieveUsageMetrics)) .pollAttribute(new JmxAttributePollConfig<Integer>(TOTAL_PROCESSING_TIME)
.objectName(statsMbeanName) .attributeName("requests") .onFailureOrException(EntityFunctions.attribute(this, REQUEST_COUNT))) .pollAttribute(new JmxAttributePollConfig<Integer>(RESPONSES_4XX_COUNT) .objectName(statsMbeanName)