public class ShellFeed extends AbstractFeed
private ShellFeed feed;
//@Override
protected void connectSensors() {
super.connectSensors();
feed = ShellFeed.builder()
.entity(this)
.machine(mySshMachineLachine)
.poll(new ShellPollConfig<Long>(DISK_USAGE)
.command("df -P | grep /dev")
.failOnNonZeroResultCode(true)
.onSuccess(new Function<SshPollValue, Long>() {
public Long apply(SshPollValue input) {
String[] parts = input.getStdout().split("[ \\t]+");
return Long.parseLong(parts[2]);
}}))
.build();
}
{@literal @}Override
protected void disconnectSensors() {
super.disconnectSensors();
if (feed != null) feed.stop();
}
Modifier and Type | Class and Description |
---|---|
static class |
ShellFeed.Builder |
AbstractEntityAdjunct.AdjunctTagSupport
BrooklynObject.TagSupport
Configurable.ConfigurationSupport
BrooklynObjectInternal.ConfigurationSupportInternal
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
log |
ONLY_IF_SERVICE_UP
Constructor and Description |
---|
ShellFeed()
For rebind; do not call directly; use builder
|
Modifier and Type | Method and Description |
---|---|
static ShellFeed.Builder |
builder() |
destroy, getEntity, getRebindSupport, isActivated, isActive, isRunning, isSuspended, resume, setEntity, start, stop, suspend
config, configure, getAllConfig, getConfig, getConfigMap, getDisplayName, getName, getUniqueTag, isDestroyed, setConfig, setDisplayName, setName, tags, toString
getCatalogItemId, getId, getManagementContext, getTagSupport, init, rebind, setCatalogItemId, setManagementContext
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getId, getName, getUniqueTag, isDestroyed
getCatalogItemId, getDisplayName, getTagSupport, tags
config, setConfig
setCatalogItemId
public static ShellFeed.Builder builder()