Red Hat Bugzilla – Bug 751248
Example script: drift repair
Last modified: 2015-02-01 18:27:08 EST
The following are the steps to test the required CLI script. The needed script itself is mentioned in step 4) below:
1) Create a bundle containing an EAP instance
2) Provision that bundle to a platform
3) Setup drift to monitor that EAP instance
*4) Create a CLI script which redeploys the bundle from step 1, returning the EAP instance to its original state
5) Setup an alert to trigger when drift is detected, and have the script from step 4 be fired when the alert triggers
6) Update the EAP instance, thus triggering drift, and watch as the script reprovisions the EAP instance.
1) Create an EAP 5.1.1 bundle using a script I wrote, which has been checked into master at etc/scripts/create-jbossas-bundle.sh. The script is run as follows:
where jboss-eap-5.1.1.zip is the EAP 5.1.1 dist zipfile. This outputs a bundle distribution zipfile named jboss-eap-5.1.1-bundle.zip.
2) Use the bundle create wizard in the GUI to create a bundle from jboss-eap-5.1.1-bundle.zip. Create a compat group containing one or more platforms. Create a bundle destination containing the platforms group with a deploy dir of "/tmp/jboss-eap-5.1.". Deploy the bundle to this bundle destination. For each platform:
a) uncomment the admin=admin line in /tmp/jboss-eap-5.1.1/server/production/conf/props/jmx-console-users.properties.
b) start the EAP server: /tmp/jboss-eap-5.1.1/bin/run.sh -b 127.0.0.51 -c production
c) wait for the EAP server to fully start, then run "discovery -f" at that platform's agent prompt to discover the new EAP server
d) from the GUI, import the newly discovered EAP server resource
3) for each of the EAP server resources, create a drift definition based off the base files template (this def will monitor the bin, common, and lib dirs for drift)
4) Setup an alert on the EAP server resource that triggers when drift is detected. Add a notification of type 'CLI script' and upload the attached fix-bundle-deployment.js script.
5) Manually modify some file under the bin directory of one of the EAP servers (e.g. add the line "######## BLAH ########" to bin/classpath.sh). Select the drift definition for the corresponding EAP server resource and click the Detect Now button. Wait for the drift definition to report it is Out of Compliance (should only take a minute or so). Wait for the alert defined in step 4 to fire. Watch as the script reprovisions the EAP instance.
Created attachment 534456 [details]
RHQ-server script that redeploys a bundle
Note, for step 4, before you upload fix-bundle-deployment.js, you will need to edit the following two lines in that file and set them to the destination ID and bundle version ID corresponding to the destination and bundle version you created in step 2:
var destinationId = 10002;
var bundleVersionId = 10002;
changing priority to low ... sample script ... no impact on runtime
It doesn't impact the run time, but I've asked Lukas to test it out and make it available under /downloads from the JON server, so that people who want it can grab it.
The change is in master.
The script is downloadable from the server and the Administration/Downloads page was updated to contain it (more scripts are automatically picked up if placed in the same location).
I also slightly updated the script to contain more guiding documentation.
Author: Lukas Krejci <firstname.lastname@example.org>
Date: Thu Dec 1 14:50:06 2011 +0100
[BZ 751248] - Make the sample CLI alert scripts downloadable from the server's /download/cli-alert-scripts location and from the Downloads section of the GUI.
release_jon3.x contains only the script and makes it accessible for download. The UI changes were left out from the release. The location of the script is only to be mentioned in the documentation.
Author: Lukas Krejci <email@example.com>
Date: Fri Dec 2 17:01:58 2011 +0100
[BZ 751248] - in JON 3.0.0 we are going to make the script downloadable but
will provide no UI for accessing it. The script can be downloaded from
Verified on 3.1.1.CR1. Verified that scenario from comment 1 is working with following script: http(s)://<JON_DOMAIN>:<JON_PORT>/downloads/cli-alert-scripts/fix-bundle-deployment.js
Also verified that deployBundle function from rhq-remoting-cli-4.4.0.JON311CR1/samples/bundles.js is working.
*** Bug 803841 has been marked as a duplicate of this bug. ***
Bulk closing of old issues that are in VERIFIED state.