This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Polls the given JMX attribute every minute; transforms the result from tabular data | |
// into a java.util.Map and sets the given brooklyn sensor (aka attribute) accordingly. | |
// The onSuccess is passed the JMX attribute's value. | |
JmxSensorAdapter jmxAdapter = registry.register(new JmxSensorAdapter()); | |
jmxAdapter.withObjectName(myJmxObjectName) | |
.pollAttribute(new JmxAttributePollConfig<Map>(MY_BROOKLYN_SENSOR) | |
.attributeName(myJmxAttributeName) | |
.period(1, TimeUnit.MINUTES) | |
.onSuccess(JmxResponseFunctions.tabularDataToMap())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Polls a given URL, and uses the HTTP response to set the | |
// two Brooklyn entity attributes SERVICE_UP and REQUEST_COUNT | |
def http = sensorRegistry.register( | |
new HttpSensorAdapter("http://$host:$port/management/subsystem/web/connector/http/read-resource", | |
period: 200*TimeUnit.MILLISECONDS). | |
vars("include-runtime":true) ) | |
with(http) { | |
poll(SERVICE_UP) { responseCode==200 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package brooklyn.demo; | |
import static brooklyn.event.basic.DependentConfiguration.valueWhenAttributeReady; | |
import brooklyn.entity.basic.AbstractApplication; | |
import brooklyn.entity.database.mysql.MySqlNode; | |
import brooklyn.entity.proxy.nginx.NginxController; | |
import brooklyn.entity.webapp.ControlledDynamicWebAppCluster; | |
import brooklyn.entity.webapp.DynamicWebAppCluster; | |
import brooklyn.entity.webapp.jboss.JBoss7Server; |
NewerOlder