modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
| 9 +
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/EmbeddedManagedDeploymentComponent.java
| 28 ++--
modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
| 30 +++++
modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/EmbeddedWarDiscoveryComponent.java
| 4
modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
| 60 +++++++---
5 files changed, 96 insertions(+), 35 deletions(-)
New commits:
commit 72d6aa5c440900dacaf8f97914ea2e17dea07112
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Nov 29 17:54:29 2011 -0500
Add drift templates to EAR/WAR/Embedded War types for AS-4 plugin
- To support this, add new Path trait (via Ian) for embedded war resources
diff --git
a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/EmbeddedManagedDeploymentComponent.java
b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/EmbeddedManagedDeploymentComponent.java
index 2ed3159..ea8d467 100644
---
a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/EmbeddedManagedDeploymentComponent.java
+++
b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/EmbeddedManagedDeploymentComponent.java
@@ -33,28 +33,28 @@ import org.rhq.core.pluginapi.measurement.MeasurementFacet;
/**
* @author Ian Springer
*/
-public class EmbeddedManagedDeploymentComponent extends
AbstractManagedDeploymentComponent
- implements MeasurementFacet
-{
+public class EmbeddedManagedDeploymentComponent extends
AbstractManagedDeploymentComponent implements MeasurementFacet {
private static final String CUSTOM_PARENT_TRAIT = "custom.parent";
+ private static final String CUSTOM_PATH_TRAIT = "custom.path";
// ------------ MeasurementFacet Implementation ------------
- public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest>
requests)
- throws Exception
- {
- Set<MeasurementScheduleRequest> remainingRequests = new HashSet();
- for (MeasurementScheduleRequest request : requests)
- {
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest>
requests) throws Exception {
+ Set<MeasurementScheduleRequest> remainingRequests = new
HashSet<MeasurementScheduleRequest>();
+ for (MeasurementScheduleRequest request : requests) {
String metricName = request.getName();
- if (metricName.equals(CUSTOM_PARENT_TRAIT))
- {
+ if (metricName.equals(CUSTOM_PARENT_TRAIT)) {
String parentDeploymentName =
getManagedDeployment().getParent().getName();
MeasurementDataTrait trait = new MeasurementDataTrait(request,
parentDeploymentName);
report.addData(trait);
- }
- else
- {
+
+ } else if (metricName.equals(CUSTOM_PATH_TRAIT)) {
+ boolean exploded = this.deploymentFile.isDirectory();
+ if (exploded) {
+ MeasurementDataTrait trait = new MeasurementDataTrait(request,
this.deploymentFile.getPath());
+ report.addData(trait);
+ }
+ } else {
remainingRequests.add(request);
}
}
diff --git a/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
index 32aca99..470b0f6 100644
--- a/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
@@ -2313,6 +2313,15 @@
&deploymentContentConfigProps;
</content>
+ <drift-definition
+ name="Template-Files"
+ description="Monitor files comprising the enterprise application
archive (EAR). Use filters for more fine-grained monitoring. Or, create definitions only
on the embedded WAR resources themselves.">
+ <basedir>
+ <value-context>measurementTrait</value-context>
+ <value-name>custom.path</value-name>
+ </basedir>
+ </drift-definition>
+
</service>
<service name="Web Application (WAR)"
@@ -2364,6 +2373,15 @@
&deploymentContentConfigProps;
</content>
+ <drift-definition
+ name="Template-Files"
+ description="Monitor files comprising the web application archive
(WAR). Use filters for more fine-grained monitoring.">
+ <basedir>
+ <value-context>measurementTrait</value-context>
+ <value-name>custom.path</value-name>
+ </basedir>
+ </drift-definition>
+
<service name="Web Application Context"
class="WebApplicationContextComponent"
discovery="WebApplicationContextDiscoveryComponent"
@@ -2426,9 +2444,21 @@
<metric property="custom.parent" displayName="Parent"
dataType="trait" displayType="summary"
description="the name of this WAR's parent
deployment"/>
+ <metric property="custom.path" displayName="Path"
+ dataType="trait" displayType="summary"
+ description="the absolute path of this WAR directory (not
supported for WAR's embedded in non-exploded EARs)"/>
&webApplicationMetrics;
+ <drift-definition
+ name="Template-Files"
+ description="Monitor files comprising the embedded web application
archive (WAR). Use filters for more fine-grained monitoring.">
+ <basedir>
+ <value-context>measurementTrait</value-context>
+ <value-name>custom.path</value-name>
+ </basedir>
+ </drift-definition>
+
<service name="Embedded Web Application Context"
class="WebApplicationContextComponent"
discovery="WebApplicationContextDiscoveryComponent"
commit 0ad22b15a3f6d5b700bfec506db74f6a20633f21
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Nov 29 17:53:32 2011 -0500
Add drift templates to EAR/WAR/Embedded War types for AS-4 plugin
diff --git a/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
index db4b8e5..b5d4bd1 100644
--- a/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
@@ -259,8 +259,9 @@
</configuration>
</content>
- <drift-definition name="Template-Base Files"
- description="Monitor base application server files for
drift. It defines monitoring for some standard sub-directories of the HOME directory.
Note, it is not recommeded to monitor all files for an application server. There are many
files, and many temp files.">
+ <drift-definition
+ name="Template-Base Files"
+ description="Monitor base application server files for drift. It defines
monitoring for some standard sub-directories of the HOME directory. Note, it is not
recommeded to monitor all files for an application server. There are many files, and many
temp files.">
<basedir>
<value-context>pluginConfiguration</value-context>
<value-name>jbossHomeDir</value-name>
@@ -2267,6 +2268,15 @@
</configuration>
</content>
+ <drift-definition
+ name="Template-Files"
+ description="Monitor files comprising the enterprise application
archive (EAR). Use filters for more fine-grained monitoring. Or, create definitions only
on the embedded WAR resources themselves.">
+ <basedir>
+ <value-context>pluginConfiguration</value-context>
+ <value-name>filename</value-name>
+ </basedir>
+ </drift-definition>
+
<service name="Embedded Web Application (WAR)"
class="org.rhq.plugins.jbossas.WarComponent"
discovery="org.rhq.plugins.jbossas.EmbeddedWarDiscoveryComponent"
@@ -2384,6 +2394,15 @@
<metric property="Vhost.name" displayName="Vhost"
dataType="trait"
description="Virtual hosts this app runs on"/>
+ <drift-definition
+ name="Template-Files"
+ description="Monitor files comprising the embedded web application
archive (WAR). Use filters for more fine-grained monitoring.">
+ <basedir>
+ <value-context>pluginConfiguration</value-context>
+ <value-name>filename</value-name>
+ </basedir>
+ </drift-definition>
+
</service>
</service>
@@ -2460,55 +2479,55 @@
dataType="calltime" defaultOn="false"
units="milliseconds" destinationType="URL"
description="the minimum, maximum, and average response times for
HTTP requests serviced by this webapp"/>
- <metric property="Servlet.MinResponseTime"
displayName="Min. Servlet Resp. Time"
+ <metric property="Servlet.MinResponseTime" displayName="Min.
Servlet Resp. Time"
units="milliseconds"
description="Minimum response time of a servlet"/>
- <metric property="Servlet.AvgResponseTime"
displayName="Avg. Servlet Resp. Time"
+ <metric property="Servlet.AvgResponseTime" displayName="Avg.
Servlet Resp. Time"
units="milliseconds"
description="Average response time of a servlet"/>
- <metric property="Servlet.MaxResponseTime"
displayName="Max. Servlet Resp. Time"
+ <metric property="Servlet.MaxResponseTime" displayName="Max.
Servlet Resp. Time"
units="milliseconds"
description="Maximum response time of a servlet"/>
- <metric property="Servlet.TotalTime" displayName="Total
processing time"
+ <metric property="Servlet.TotalTime" displayName="Total
processing time"
units="milliseconds"
description="Total processing time of the webapp"
measurementType="trendsup"/>
- <metric property="Servlet.NumRequests"
displayName="Requests served"
+ <metric property="Servlet.NumRequests" displayName="Requests
served"
units="none" description="Number of requests served by
servlets"
measurementType="trendsup"
displayType="summary"/>
- <metric property="Servlet.NumErrors" displayName="Errors
while processing"
+ <metric property="Servlet.NumErrors" displayName="Errors while
processing"
units="none" description="Number of errors while
processing"
measurementType="trendsup"
displayType="summary"/>
- <metric property="Session.activeSessions"
displayName="Currently Active Sessions"
+ <metric property="Session.activeSessions"
displayName="Currently Active Sessions"
units="none" description="Number active sessions for
the webapp right now" />
- <metric property="Session.maxActive" displayName="Maximum
number of Active Sessions"
+ <metric property="Session.maxActive" displayName="Maximum
number of Active Sessions"
units="none" description="Maximum number of active
sessions for the webapp" />
- <metric property="Session.sessionCounter"
displayName="Sessions created"
+ <metric property="Session.sessionCounter"
displayName="Sessions created"
units="none" description="Number of sessions created
for the webapp"
measurementType="trendsup" />
- <metric property="Session.expiredSessions"
displayName="Expired Sessions"
+ <metric property="Session.expiredSessions"
displayName="Expired Sessions"
units="none" description="Number of expired sessions
for the webapp"
measurementType="trendsup" />
- <metric property="Session.rejectedSessions"
displayName="Rejected Sessions"
+ <metric property="Session.rejectedSessions"
displayName="Rejected Sessions"
units="none" description="Number of sessions rejected
for the webapp"
measurementType="trendsup" />
- <metric property="Session.sessionAverageAliveTime"
displayName="Session Average alive time"
+ <metric property="Session.sessionAverageAliveTime"
displayName="Session Average alive time"
units="seconds" description="Average alive time of a
Sessions" />
- <metric property="Session.sessionMaxAliveTime"
displayName="Max Session alive time"
+ <metric property="Session.sessionMaxAliveTime"
displayName="Max Session alive time"
units="seconds" description="Maximum alive time of a
Sessions" />
- <metric property="Vhost.name" displayName="Vhost"
dataType="trait"
+ <metric property="Vhost.name" displayName="Vhost"
dataType="trait"
description="Virtual hosts this app runs on"/>
<content name="file" displayName="WAR File"
category="deployable" isCreationType="true">
@@ -2524,6 +2543,15 @@
</configuration>
</content>
+ <drift-definition
+ name="Template-Files"
+ description="Monitor files comprising the web application archive
(WAR). Use filters for more fine-grained monitoring.">
+ <basedir>
+ <value-context>pluginConfiguration</value-context>
+ <value-name>filename</value-name>
+ </basedir>
+ </drift-definition>
+
</service>
<service name="EJB3 Entity Tree Cache"
commit 8c6dcd3817195f9a0f0d9855b3f7b648bd1ada5d
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Nov 29 17:50:22 2011 -0500
Fix issue in AS-4 plugin such that for embedded WAR resources the
"filename" plugin config prop and the "Path" trait are set to an
actual
path (do not use the resource name when constructing the value)
diff --git
a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/EmbeddedWarDiscoveryComponent.java
b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/EmbeddedWarDiscoveryComponent.java
index 18a6b38..9ad2fbd 100644
---
a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/EmbeddedWarDiscoveryComponent.java
+++
b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/EmbeddedWarDiscoveryComponent.java
@@ -65,7 +65,7 @@ public class EmbeddedWarDiscoveryComponent extends
MBeanResourceDiscoveryCompone
// Once we've finished making sure the plugin configurations have the data we
need:
// 1) First the stuff generic to all WARs...
- JBossASServerComponent grandparentJBossASComponent =
parentEarComponent.getParentResourceComponent();
+ JBossASServerComponent<?> grandparentJBossASComponent =
parentEarComponent.getParentResourceComponent();
resourceDetails =
WarDiscoveryHelper.initPluginConfigurations(grandparentJBossASComponent, resourceDetails,
parentEarComponent);
@@ -74,7 +74,7 @@ public class EmbeddedWarDiscoveryComponent extends
MBeanResourceDiscoveryCompone
for (DiscoveredResourceDetails resource : resourceDetails) {
Configuration pluginConfiguration = resource.getPluginConfiguration();
pluginConfiguration.put(new PropertySimple(WarComponent.FILE_NAME,
parentEarFullFileName
- + resource.getResourceName()));
+ + pluginConfiguration.getSimpleValue(WarComponent.NAME_CONFIG_PROP,
"")));
}
return resourceDetails;
commit 8939b50bf8bee6f4b0037885026abdcd2f79946a
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Nov 29 12:18:17 2011 -0500
[Bug 758261 - A bad drift definition can prevent agent startup]
Add more aggressive catching (Throwable) because it's better to skip
detection for a problematic definition than it is to prevent agent
startup.
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
index c713297..2790f13 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
@@ -152,9 +152,11 @@ public class DriftManager extends AgentService implements
DriftAgentService, Dri
try {
syncWithServer(r, d);
schedulesQueue.addSchedule(new DriftDetectionSchedule(r.getId(), d));
- } catch (IOException e) {
+
+ } catch (Throwable t) {
+ // catch throwable, don't prevent agent startup just due to a bad
definition
log.error("Failed to sync with server for " +
toString(r.getId(), d) + ". Drift detection will not be "
- + "scheduled.", e);
+ + "scheduled.", t);
}
}
@@ -691,7 +693,8 @@ public class DriftManager extends AgentService implements
DriftAgentService, Dri
// find out the type of base location that is specified by the drift def
DriftDefinition.BaseDirectory baseDir = driftDefinition.getBasedir();
if (baseDir == null) {
- throw new IllegalArgumentException("Missing basedir in drift
definition");
+ throw new IllegalArgumentException("Base directory is null for drift
definition ["
+ + driftDefinition.getName() + "]");
}
// based on the type of base location, determine the root base directory