You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2016/07/13 13:31:57 UTC

[1/2] brooklyn-docs git commit: Added more policies to policies page

Repository: brooklyn-docs
Updated Branches:
  refs/heads/master 218ec136e -> 53f96949e


Added more policies to policies page


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/d0da6389
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/d0da6389
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/d0da6389

Branch: refs/heads/master
Commit: d0da6389ab9a932a02dd6c7ec68f36d940f20091
Parents: 218ec13
Author: Duncan Grant <du...@cloudsoftcorp.com>
Authored: Wed Jul 13 09:31:00 2016 +0100
Committer: Duncan Grant <du...@cloudsoftcorp.com>
Committed: Wed Jul 13 14:19:32 2016 +0100

----------------------------------------------------------------------
 guide/java/policies.md | 209 +++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 188 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/d0da6389/guide/java/policies.md
----------------------------------------------------------------------
diff --git a/guide/java/policies.md b/guide/java/policies.md
index 9781d6e..1c79e13 100644
--- a/guide/java/policies.md
+++ b/guide/java/policies.md
@@ -31,42 +31,209 @@ Policies are highly reusable as their inputs, thresholds and targets are customi
 
 ### Management Policies
 
-- AutoScaler Policy
-   
-   Increases or decreases the size of a Resizable entity based on an aggregate sensor value, the current size of the entity, and customized high/low watermarks.
+#### AutoScaler Policy
 
-   An AutoScaler policy can take any sensor as a metric, have its watermarks tuned live, and target any resizable entity - be it an application server managing how many instances it handles, or a tier managing global capacity.
+- org.apache.brooklyn.policy.autoscaling.AutoScalerPolicy
 
-   e.g. if the average request per second across a cluster of Tomcat servers goes over the high watermark, it will resize the cluster to bring the average back to within the watermarks.
-  
-<!---
-TODO - list some
-TODO - describe how they can be customised (briefly mention sensors)
--->
+Increases or decreases the size of a Resizable entity based on an aggregate sensor value, the current size of the entity, and customized high/low watermarks.
+
+An AutoScaler policy can take any sensor as a metric, have its watermarks tuned live, and target any resizable entity - be it an application server managing how many instances it handles, or a tier managing global capacity.
+
+e.g. if the average request per second across a cluster of Tomcat servers goes over the high watermark, it will resize the cluster to bring the average back to within the watermarks.
+
+{% highlight yaml %}
+brooklyn.policies:
+- type: org.apache.brooklyn.policy.autoscaling.AutoScalerPolicy
+  brooklyn.config:
+    metric: webapp.reqs.perSec.perNode
+    metricUpperBound: 3
+    metricLowerBound: 1
+    resizeUpStabilizationDelay: 2s
+    resizeDownStabilizationDelay: 1m
+    maxPoolSize: 3
+
+{% endhighlight %}
+
+#### ServiceRestarter
+
+- org.apache.brooklyn.policy.ha.ServiceRestarter
+
+Attaches to a SoftwareProcess (or anything Startable, emitting ENTITY_FAILED or other configurable sensor), and invokes restart on failure; if there is a subsequent failure within a configurable time interval, or if the restart fails, this gives up and emits {@link #ENTITY_RESTART_FAILED}
+
+{% highlight yaml %}
+brooklyn.policies:
+- type: org.apache.brooklyn.policy.ha.ServiceRestarter
+  brooklyn.config:
+    failOnRecurringFailuresInThisDuration: 5m
+{% endhighlight %}
+
+#### StopAfterDuration Policy
+
+- org.apache.brooklyn.policy.action.StopAfterDurationPolicy
+
+The StopAfterDurationPolicy can be used to limit the lifetime of an entity.  After a configure time period expires the entity will be stopped.
+
+#### CreateUser Policy
+
+- org.apache.brooklyn.policy.jclouds.os.CreateUserPolicy
+
+The CreateUserPolicy Attaches to an Entity and monitors for the addition of a location to that entity, the policy then adds a new user to the VM with a randomly generated password, with the SSH connection details set on the entity as the createuser.vm.user.credentials sensor.
+
+#### AdvertiseWinRMLogin Policy
+
+- org.apache.brooklyn.location.winrm.WinRmMachineLocation
+
+This is similar to the CreateUserPolicy.  It will monitor the addition of WinRmMachineLocation to an entity and then create a sensor advertising the administrative user's credentials.
+
+#### SshMachineFailureDetector
+
+- org.apache.brooklyn.policy.ha.SshMachineFailureDetector
+
+The SshMachineFailureDetector is an HA policy for monitoring an SshMachine, emitting an event if the connection is lost/restored.
+
+#### ConnectionFailureDetector
+
+- org.apache.brooklyn.policy.ha.ConnectionFailureDetector
+
+The ConnectionFailureDetector is an HA policy for monitoring an http connection, emitting an event if the connection is lost/restored.
+
+#### ServiceReplacer
+
+- org.apache.brooklyn.policy.ha.ServiceReplacer
+
+The ServiceReplacer attaches to a DynamicCluster and replaces a failed member in response to HASensors.ENTITY_FAILED or other sensor.  The [introduction to policies](../) shows a worked example of the ServiceReplacer policy in user.
+
+#### FollowTheSun Policy
+
+- org.apache.brooklyn.policy.followthesun.FollowTheSunPolicy
+
+The FollowTheSunPolicy is for moving work around to follow the demand.  The work can be any Movable entity.  This currently available in yaml blueprints.
 
+#### ConditionalSuspend Policy
+
+- org.apache.brooklyn.policy.ha.ConditionalSuspendPolicy
+
+The ConditionalSuspendPolicy will suspend and resume a target policy based on configured suspend and resume sensors.
+
+#### LoadBalancing Policy
+
+- org.apache.brooklyn.policy.loadbalancing.LoadBalancingPolicy
+
+The LoadBalancingPolicy is attached to a pool of "containers", each of which can host one or more migratable "items".  The policy monitors the workrates of the items and effects migrations in an attempt to ensure that the containers are all sufficiently utilized without any of them being overloaded.
 
 ###  Enrichers
 
-*	Delta
+#### Transformer
 
-	Converts absolute sensor values into a delta.
-	
+- org.apache.brooklyn.enricher.stock.Transformer
+
+Transforms attributes of an entity.
+
+{% highlight yaml %}
+brooklyn.enrichers:
+- type: org.apache.brooklyn.enricher.stock.Transformer
+  brooklyn.config:
+    enricher.sourceSensor: $brooklyn:sensor("urls.tcp.string")
+    enricher.targetSensor: $brooklyn:sensor("urls.tcp.withBrackets")
+    enricher.targetValue: $brooklyn:formatString("[%s]", $brooklyn:attributeWhenReady("urls.tcp.string"))
+{% endhighlight %}
+
+#### Propagator
+
+- org.apache.brooklyn.enricher.stock.Propagator
+
+Use propagator to duplicate one sensor as another, giving the supplied sensor mapping.
+The other use of Propagator is where you specify a producer (using $brooklyn:entity(...) as below)
+from which to take sensors; in that mode you can specify `propagate` as a list of sensors whose names are unchanged,
+instead of (or in addition to) this map
+
+{% highlight yaml %}
+brooklyn.enrichers:
+- type: org.apache.brooklyn.enricher.stock.Propagator
+  brooklyn.config:
+    producer: $brooklyn:entity("cluster")
+- type: org.apache.brooklyn.enricher.stock.Propagator
+  brooklyn.config:
+    sensorMapping:
+      $brooklyn:sensor("url"): $brooklyn:sensor("org.apache.brooklyn.core.entity.Attributes", "main.uri")
+{% endhighlight %}
+
+####	Custom Aggregating
+
+- org.apache.brooklyn.enricher.stock.Aggregator
+
+Aggregates multiple sensor values (usually across a tier, esp. a cluster) and performs a supplied aggregation method to them to return an aggregate figure, e.g. sum, mean, median, etc.
+
+{% highlight yaml %}
+brooklyn.enrichers:
+- type: org.apache.brooklyn.enricher.stock.Aggregator
+  brooklyn.config:
+    enricher.sourceSensor: $brooklyn:sensor("webapp.reqs.perSec.windowed")
+    enricher.targetSensor: $brooklyn:sensor("webapp.reqs.perSec.perNode")
+    enricher.aggregating.fromMembers: true
+    transformation: average
+{% endhighlight %}
 
-*	Time-weighted Delta
+#### Joiner
 
-	Converts absolute sensor values into a delta/second.
+- org.apache.brooklyn.enricher.stock.Joiner
+
+Joins a sensor whose output is a list into a single item joined by a separator.
+
+{% highlight yaml %}
+brooklyn.enrichers:
+- type: org.apache.brooklyn.enricher.stock.Joiner
+  brooklyn.config:
+    enricher.sourceSensor: $brooklyn:sensor("urls.tcp.list")
+    enricher.targetSensor: $brooklyn:sensor("urls.tcp.string")
+    uniqueTag: urls.quoted.string
+{% endhighlight %}
+
+####	Delta Enricher
+
+- org.apache.brooklyn.policy.enricher.Delta Enricher
+
+Converts absolute sensor values into a delta.
+
+####	Time-weighted Delta
+
+- org.apache.brooklyn.enricher.stock.YamlTimeWeightedDeltaEnricher
+
+Converts absolute sensor values into a delta/second.
 	
-*	Rolling Mean
+{% highlight yaml %}
+brooklyn.enrichers:
+- type: org.apache.brooklyn.enricher.stock.YamlTimeWeightedDeltaEnricher
+  brooklyn.config:
+    enricher.sourceSensor: reqs.count
+    enricher.targetSensor: reqs.per_sec
+    enricher.delta.period: 1s
+{% endhighlight %}
 
-	Converts the last *N* sensor values into a mean.
+####	Rolling Mean
+
+- org.apache.brooklyn.policy.enricher.RollingMeanEnricher
+
+Converts the last *N* sensor values into a mean.
 	
-*	Rolling Time-window Mean
+####	Rolling Time-window Mean
+
+- org.apache.brooklyn.policy.enricher.RollingTimeWindowMeanEnricher
+
+Converts the last *N* seconds of sensor values into a weighted mean.
+
+#### Http Latency Detector
+
+- org.apache.brooklyn.policy.enricher.RollingTimeWindowMeanEnricher.HttpLatencyDetector
+
+An Enricher which computes latency in accessing a URL.
 
-	Converts the last *N* seconds of sensor values into a weighted mean.
+#### Combiner
 
-*	Custom Aggregating
+- org.apache.brooklyn.enricher.stock.Combiner
 
-	Aggregates multiple sensor values (usually across a tier, esp. a cluster) and performs a supplied aggregation method to them to return an aggregate figure, e.g. sum, mean, median, etc. 
+Can be used to combine the values of sensors.  This enricher should be instantiated using Enrichers.buider.combineing(..).
+This enricher is only available in Java blueprints and cannot be used in YAML.
 
 
 Next: Writing a Policy


[2/2] brooklyn-docs git commit: This closes #90

Posted by al...@apache.org.
This closes #90


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/53f96949
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/53f96949
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/53f96949

Branch: refs/heads/master
Commit: 53f96949e8f44241cfffe53eab8eb356b5d4a40a
Parents: 218ec13 d0da638
Author: Aled Sage <al...@gmail.com>
Authored: Wed Jul 13 14:31:42 2016 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Wed Jul 13 14:31:42 2016 +0100

----------------------------------------------------------------------
 guide/java/policies.md | 209 +++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 188 insertions(+), 21 deletions(-)
----------------------------------------------------------------------