Skip to content
Permalink
Browse files
Merge apache-brooklyn/master as at commit edc13bd
  • Loading branch information
richardcloudsoft committed Feb 25, 2021
2 parents 1e0f1be + edc13bd commit 93fa774142de7a47db69d0e3e0e80b56cd49bf09
Show file tree
Hide file tree
Showing 34 changed files with 422 additions and 254 deletions.
@@ -78,7 +78,7 @@ When composing a YAML blueprint, the VanillaSoftwareProcess is a very useful ent
A VanillaSoftwareProcess will instruct Brooklyn to provision an instance, and run a series of shell
commands to setup, run, monitor and teardown your program. The commands are specified as configuration
on the VanillaSoftwareProcess and there are several available. We will spotlight a few now. To simplify
this blueprint, we have specified ubuntu only installs so that our commands can be tailored to this
this blueprint, we have specified Ubuntu only installs so that our commands can be tailored to this
system (e.g. use apt-get rather than yum).

##### Customize Command
@@ -37,7 +37,7 @@ open a new browser window (usually) at [http://127.0.0.1:8081/](http://127.0.0.1
Click on the tile "Blueprint Composer", then on the double-arrow located on the top right of the screen (to switch to the YAML mode),
paste the copied YAML into the editor and press "Deploy".
There are several other ways to deploy, including `curl` and via the command-line,
and you can configure users, https, persistence, and more,
and you can configure users, HTTPS, persistence, and more,
as described [in the ops guide]({{ site.path.guide }}/ops/).

[![Web Console](web-console-yaml-700.png "YAML via Web Console")](web-console-yaml.png)
@@ -264,7 +264,7 @@ so that the `$message` we passed above gets logged and reported back:
#### Windows Command Sensor

Like the blueprint above, the following example also uses `brooklyn.initializers` to define sensors on the entity,
this time however it is a windows VM and uses `WinRmCommandSensor`.
this time however it is a Windows VM and uses `WinRmCommandSensor`.

- type: org.apache.brooklyn.entity.software.base.VanillaWindowsProcess
brooklyn.config:
@@ -288,7 +288,7 @@ health-check.
See documentation on the [Entity's error status]({{ site.path.guide }}/ops/troubleshooting/overview.html#entitys-error-status)
for how Brooklyn models an entity's health.

In the snippet below, we'll define a new health-check sensor (via http polling), and will automatically add this
In the snippet below, we'll define a new health-check sensor (via HTTP polling), and will automatically add this
to the `service.notUp.indicators`. If that map is non-empty, then the entity's `service.isUp` will be set
automatically to `false`:

@@ -327,10 +327,10 @@ automatically to `false`:
- "no value"

The `HttpRequestSensor` configures the entity to poll every 5 seconds on the given URI,
taking the json result as the sensor value.
taking the JSON result as the sensor value.

The `UpdatingMap` enricher uses that sensor to populate an entry in the `service.notUp.indicators`.
It transforms the `http.healthy` sensor value using the given function: if the http poll returned
It transforms the `http.healthy` sensor value using the given function: if the HTTP poll returned
`true`, then it is mapped to `null` (so is removed from the `service.noUp.indicators`); if the
poll returned `false`, then `"false"` is added to the indicators map; otherwise `"no value"` is
added to the indicators map.
@@ -67,8 +67,8 @@ There are a number of additional configuration keys available for the `HTTPComma
| httpUsername | | user name for the authentication |
| httpPassword | | password for the authentication |
| headers | application/json | It explicitly supports `application/x-www-form-urlencoded` |
| httpPayload | | The body of the http request |
| jsonPath | | A jsonPath expression to extract values from a json object |
| httpPayload | | The body of the HTTP request |
| jsonPath | | A jsonPath expression to extract values from a JSON object |
| jsonPathAndSensors | | A map where keys are jsonPath expressions and values the name of the sensor where to publish extracted values |


@@ -189,7 +189,7 @@ services:

_However, the web-console also shows other misleading (incorrect!) config values for the child
entity. It shows the inherited config value of `exampleConfig` as "childValue" (because the
REST api did not evaluate the DSL in the correct context, when retrieving the value!
REST API did not evaluate the DSL in the correct context, when retrieving the value!
See https://issues.apache.org/jira/browse/BROOKLYN-455._


@@ -296,7 +296,7 @@ Some common config keys that will not re-inherited include:
* `launch.command` (and the ``pre.launch.command` and `post.launch.command`)
* `checkRunning.command`
* `stop.command`
* The similar commands for `VanillaWindowsProcess` powershell.
* The similar commands for `VanillaWindowsProcess` PowerShell.
* The file and template install config keys (e.g. `files.preinstall`, `templates.preinstall`, etc)
An example is shown below. Here, the "logstash-child" is a sub-type of `VanillaSoftwareProcess`,
@@ -55,7 +55,7 @@ To describe each part of this:
and tracked as such. Execution of the effector is intercepted, to track it as a task and show its
execution in the Activity view.
* The `@EffectorParam` annotations give metadata about the effector's parameters. This metadata,
such as the parameter description, is available to those using the client CLI, rest API and
such as the parameter description, is available to those using the client CLI, REST API and
web-console.

Note there is an alternative way of defining effectors - adding them to the entity dynamically,
@@ -174,4 +174,4 @@ The YAML blueprint below shows an example usage of this blueprint:
Note the type name matches the id defined in the `.bom` file.

You can now call the effector by any of the standard means - [web console]({{ site.path.guide }}/ops/gui/),
[REST api]({{ site.path.guide }}/ops/rest.html), or [Client CLI]({{ site.path.guide }}/ops/cli/).
[REST API]({{ site.path.guide }}/ops/rest.html), or [Client CLI]({{ site.path.guide }}/ops/cli/).
@@ -97,8 +97,8 @@ protected void disconnectSensors() {
}
{% endhighlight %}

In this example (a simplified version of ``JBoss7Server``), the url returns metrics in JSON.
We report the entity as up if we get back an http response code of 200, or down if any other response code or exception.
In this example (a simplified version of ``JBoss7Server``), the URL returns metrics in JSON.
We report the entity as up if we get back an HTTP response code of 200, or down if any other response code or exception.
We retrieve the request count from the response body, and convert it to an integer.

Note the first line (``super.connectSensors()``); as one descends into specific convenience subclasses (such as for Java web-apps), the work done by the parent class's overridden methods may be relevant, and will want to be invoked or even added to a resulting list.
@@ -35,7 +35,7 @@ important that the entity's `rebind()` method recreates the feed.

##### HTTP Feed

An `HttpFeed` polls over http(s). An example is shown below:
An `HttpFeed` polls over HTTP(S). An example is shown below:

{% highlight java %}
private HttpFeed feed;
@@ -95,7 +95,7 @@ protected void disconnectSensors() {

##### WinRm CMD Feed

A WinRM feed executes a windows command over winrm periodically. An example is shown below:
A WinRM feed executes a Windows command over WinRM periodically. An example is shown below:

{% highlight java %}
private AbstractCommandFeed feed;
@@ -127,7 +127,7 @@ This type of feed retrieves performance counters from a Windows host, and posts
One must supply a collection of mappings between Windows performance counter names and Brooklyn
attribute sensors.

This feed uses WinRM to invoke the windows utility <tt>typeperf</tt> to query for a specific set
This feed uses WinRM to invoke the Windows utility <tt>typeperf</tt> to query for a specific set
of performance counters, by name. The values are extracted from the response, and published to the
entity's sensors. An example is shown below:

@@ -105,7 +105,7 @@ The SshMachineFailureDetector is an HA policy for monitoring an SshMachine, emit

- 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.
The ConnectionFailureDetector is an HA policy for monitoring an HTTP connection, emitting an event if the connection is lost/restored.


### Primary Election / Failover Policies
@@ -33,8 +33,8 @@ This `TestEffector` example demonstrates the use of the `TestCase` and `TestSens

- `TestCase` entity starts its children sequentially
- asserts that the `webappcluster` entity `service.isUp` sensor is `true` within 10 minutes of the parent `TestCase` entity starting. Blocks start of the next child until it obtains a result (or times out).
- `deploy` effector invoked to deploy war to a `newcontext` with a 5 minute timeout to allow completion of the deploy task.
- asserts `/newcontext` url returns a HTTP status code 200 within 5 minutes of the effector being invoked (Note that this timeout is relative to the preceding test entity as they are being sequentially run as children of a `TestCase` entity).
- `deploy` effector invoked to deploy WAR to a `newcontext` with a 5 minute timeout to allow completion of the deploy task.
- asserts `/newcontext` URL returns a HTTP status code 200 within 5 minutes of the effector being invoked (Note that this timeout is relative to the preceding test entity as they are being sequentially run as children of a `TestCase` entity).

{% highlight yaml %}
{% readj example_yaml/testcases/effector-test-snippet.yaml %}
@@ -11,11 +11,11 @@ parameters available for WinRM.
* host <String>: Host to connect to (required).Default value `null`
* port <Integer>: WinRM port to use when connecting to the remote machine.<br>
If no port is specified then it defaults to a port depending on the `winrm.useHttps` flag.
* winrm.useHttps <Boolean>: The parameter tells the machine sensors whether the winrm port is over https. If the parameter is true then 5986 will be used as a winrm port.<br>
* winrm.useHttps <Boolean>: The parameter tells the machine sensors whether the WinRM port is over HTTPS. If the parameter is true then 5986 will be used as a WinRM port.<br>
Default value: `false`
* retriesOfNetworkFailures <Integer>: The parameter sets the number of retries for connection failures. If you use high value, consider taking care for the machine's network.<br>
Default value: `4`
* winrm.useNtlm <Boolean>: The parameter configures tells the machine sensors whether the winrm port is over https. If the parameter is true then 5986 will be used as a winrm port.<br>
* winrm.useNtlm <Boolean>: The parameter configures tells the machine sensors whether the WinRM port is over HTTPS. If the parameter is true then 5986 will be used as a WinRM port.<br>
Default value: `true`
* winrm.computerName <String>: Windows Computer Name to use for authentication.<br>
Default value: `null`
@@ -34,17 +34,17 @@ and it will be used to instantiate a `org.apache.brooklyn.util.core.internal.win

## WinRM Connectivity Diagnostics

If you are experiencing problems with a windows blueprint against a jclouds location
If you are experiencing problems with a Windows blueprint against a jclouds location
where Apache Brooklyn complains about failing to connect to the IP you should check those things.

1. Apache Brooklyn is using correct username and password
1. Apache Brooklyn can reach the IP of the provisioned machine. WinRM port 5985 or 5986 is also reachable from Apache Brooklyn.
1. Check whether `WinRmMachineLocation#getDefaultUserMetadataString(ConfigurationSupportInternal)` is applied on the VM.
This script should be passed to the cloud and executed in order to configure WinRM according to Apache Brooklyn requirements for authentication.
So far windows startup script are known to be supported on AWS EC2 and VCloud Director.
So far Windows startup script are known to be supported on AWS EC2 and VCloud Director.
If your cloud doesn't use this script then tune WinRM parameters accordingly.
1. Check whether you use winrm over http or over https.
1. If you are using WinRM over http then make sure WinRM service on target VM has `AllowUnencrypted = true`
1. Check whether you use WinRM over HTTP or over HTTPS.
1. If you are using WinRM over HTTP then make sure WinRM service on target VM has `AllowUnencrypted = true`

If the quick list above doesn't help then follow the steps bellow.

@@ -55,12 +55,12 @@ After you determined what is the username and the password you can proceed with
*(Notice that for cloud providers which use Auto Generated password will not be logged.
For these cases use Java Debug to retrieve ot or provision a VM manually with the same parameters when using Apache Brooklyn to provision a jclouds location.)*

The first step is to find what is the winrm service configuration on the target host.
The first step is to find what is the WinRM service configuration on the target host.

1. If you have RDP access or KVM like access to the VM then check the winrm service status with the command bellow.
1. If you have RDP access or KVM like access to the VM then check the WinRM service status with the command bellow.
`winrm get winrm/config/service`
If you are using http you should have AllowUnencrypted to false.
Encryption is supported only over https.
If you are using HTTP you should have AllowUnencrypted to false.
Encryption is supported only over HTTPS.
Sample output:

MaxConcurrentOperations = 4294967295
@@ -103,7 +103,7 @@ Use an Apache Brooklyn BYON blueprint to try easily other connection options.

1. Check IP is reachable from Apache Brooklyn instance
Check whether `telnet 10.0.0.1 5985` makes successfully a socket.
1. If AllowUnencrypted is false and you are using winrm over http then apply `winrm set winrm/config/service @{AllowUnencrypted="true"}`
1. If AllowUnencrypted is false and you are using WinRM over HTTP then apply `winrm set winrm/config/service @{AllowUnencrypted="true"}`
*If jclouds or the cloud provider doesn't support passing `sysprep-specialize-script-cmd` then consider modifying Windows VM Image.*
1. Check your username and password. Notice in Windows passwords are case sensitive.
Here is how it looks log from a wrong password:
@@ -116,8 +116,8 @@ Use an Apache Brooklyn BYON blueprint to try easily other connection options.

1. When having wrong password you may want to try logging on a different domain
This is possible from `brooklyn.winrm.config.winrm.computerName` location config.
1. If you want to configure Windows target host with https then check the article [Configuring WINRM for HTTPS](https://support.microsoft.com/en-us/kb/2019527)
1. If you are still seeing authorization errors then try connecting via winrm with the embedded winrs client.
1. If you want to configure Windows target host with HTTPS then check the article [Configuring WINRM for HTTPS](https://support.microsoft.com/en-us/kb/2019527)
1. If you are still seeing authorization errors then try connecting via WinRM with the embedded winrs client.
First make sure you have the server in trusted hosts.

Then execute a simple command like

0 comments on commit 93fa774

Please sign in to comment.