@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; } })
.period(3000, TimeUnit.MILLISECONDS) .pollAttribute(new JmxAttributePollConfig<Boolean>(SERVICE_PROCESS_IS_RUNNING)
JmxFeed.Builder builder = JmxFeed.builder() .entity(entity) .period(jmxPollPeriod); if (isEntityMxBeanStatsEnabled(entity)) {
jmxFeed = JmxFeed.builder() .entity(this) .period(500, TimeUnit.MILLISECONDS) .pollAttribute(new JmxAttributePollConfig<Long>(FETCH_REQUEST_COUNT) .objectName(SOCKET_SERVER_STATS_MBEAN)
.period(500, TimeUnit.MILLISECONDS) .pollAttribute(new JmxAttributePollConfig<Boolean>(SERVICE_UP) .objectName(serverMbeanName)
jmxFeed = JmxFeed.builder() .entity(this) .period(500, TimeUnit.MILLISECONDS) .pollAttribute(new JmxAttributePollConfig<Boolean>(SERVICE_UP)
@Override protected void connectSensors() { super.connectSensors(); String serverInfoMBeanName = "org.apache.qpid:type=ServerInformation,name=ServerInformation"; jmxFeed = JmxFeed.builder() .entity(this) .period(500, TimeUnit.MILLISECONDS) .pollAttribute(new JmxAttributePollConfig<Boolean>(SERVICE_UP) .objectName(serverInfoMBeanName) .attributeName("ProductVersion") .onSuccess(new Function<Object,Boolean>() { private boolean hasWarnedOfVersionMismatch; @Override public Boolean apply(Object input) { if (input == null) return false; if (!hasWarnedOfVersionMismatch && !getConfig(QpidBroker.SUGGESTED_VERSION).equals(input)) { log.warn("Qpid version mismatch: ProductVersion is {}, requested version is {}", input, getConfig(QpidBroker.SUGGESTED_VERSION)); hasWarnedOfVersionMismatch = true; } return true; }}) .onException(Functions.constant(false)) .suppressDuplicates(true)) .build(); }
@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(); } }
public Builder period(Duration duration) { return period(duration.toMilliseconds(), TimeUnit.MILLISECONDS); } public Builder period(long millis) {
public Builder period(long millis) { return period(millis, TimeUnit.MILLISECONDS); } public Builder period(long val, TimeUnit units) {