brooklyn.event.feed.shell
[Java] Class ShellFeed
java.lang.Object
brooklyn.event.feed.AbstractFeed
brooklyn.event.feed.shell.ShellFeed
public class ShellFeed
extends AbstractFeed
Provides a feed of attribute values, by executing shell commands (on the local machine where
this instance of brooklyn is running). Useful e.g. for paas tools such as Cloud Foundry vmc
which operate against a remote target.
Example usage (e.g. in an entity that extends SoftwareProcessImpl):
private ShellFeed feed;
//@Override
protected void connectSensors() {
super.connectSensors();
feed = ShellFeed.builder()
.entity(this)
.machine(mySshMachineLachine)
.poll(new ShellPollConfig(DISK_USAGE)
.command("df -P | grep /dev")
.failOnNonZeroResultCode(true)
.onSuccess(new Function() {
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();
}
}
- Authors:
- aled
- See Also:
- SshFeed
- FunctionFeed
Methods inherited from class AbstractFeed
|
getEntity, isActivated, isActive, isConnected, postStop, preStart, preStop, resume, start, stop, suspend |
log
public static final Logger log
-
ShellFeed
protected java.lang.Object ShellFeed(ShellFeed.Builder builder)
-
builder
public static ShellFeed.Builder builder()
-
preStart
@Override
protected void preStart()
-
Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.