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, AbstractEntityAdjunct.BasicSubscriptionSupport
BrooklynObject.RelationSupport<T extends BrooklynObject>, BrooklynObject.SubscriptionSupport, BrooklynObject.TagSupport
Configurable.ConfigurationSupport
BrooklynObjectInternal.ConfigurationSupportInternal, BrooklynObjectInternal.RelationSupportInternal<T extends BrooklynObject>, BrooklynObjectInternal.SubscriptionSupportInternal
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
log |
ONLY_IF_SERVICE_UP
HIGHLIGHT_NAME_LAST_ACTION, HIGHLIGHT_NAME_LAST_CONFIRMATION, HIGHLIGHT_NAME_LAST_VIOLATION, HIGHLIGHT_NAME_TRIGGERS
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, isRunning, isSuspended, relations, resume, setEntity, start, stop, suspend
config, configure, getAdjunctType, getConfig, getDisplayName, getExecutionContext, getHighlights, getManagementContext, getUniqueTag, isDestroyed, setDisplayName, setHighlights, subscriptions, tags, toString
addSearchPath, getCatalogItemId, getCatalogItemIdSearchPath, getId, init, rebind, setCatalogItemId, setCatalogItemIdAndSearchPath, setManagementContext, stackCatalogItemId
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getHighlights, getId, getUniqueTag, isDestroyed
getCatalogItemId, getCatalogItemIdSearchPath, getDisplayName, subscriptions, tags
config, getConfig
addSearchPath, setCatalogItemId, setCatalogItemIdAndSearchPath, stackCatalogItemId
public static ShellFeed.Builder builder()