|
|
|
[
Permlink
| « Hide
]
Joseph Marques - 16/Apr/08 06:48 AM
i think what's happening is that the alert template tries to create an alert definition for the resource in question, but the resource has not yet had it's measurement schedules created (from the measurement definitions for the given resource type), so the alert condition cache tries to look up the schedule to insert it's id as the key for one of the internal measurement-based maps -- boom -- javax.persistence.NoResultException: No entity found for query
svn650 - alert template creation as a result of newly imported resources MUST occur after measurement schedules are created, otherwise things go boom;
soo...move the creation code to the MeasurementServerServiceImpl which is called from the agent after a tree of resources is committed to persist the new schedules; pay extra attention to ONLY create alert defintiions for resources that are new... in other words, if resources already have schedules they must have been committed earlier, and thus would already have gotten the definition from the template applied to them; Re-opening, just to making this issue stand-out for tracking purposes.
Heiko, please retest the fix only applied templates to platforms and servers (and maybe platforms services?) it needs to be applied to all resource types.
rev662 - move alert template creation into recursive call so that ALL new resources get definitions created on them (according to their type's templates) during commit-time;
remove unused query from domain and service layer, which was replaced by using the updateCount available in the recursive call; RC11 (JON RC7) This seems to work.
Created templates three deep Platform(Windows), JBAS Server, Datasource w/o applying to existing resources - worked Updated to apply then to existing resources - worked Uninventoried platform Agent shutdown, start, discovery -f Re-imported platform from a-d portlet - worked, templates applied at all three levels Looks like this is still an issue for Resources that are added manually, whose Resource types have one or more alert templates defined. When I attempt to manually add a JBossAS Resource after creating a JBossAS alert template, I get the error "Failed to add resource with type [JBossAS Server] and parent resource id [500050]. -> org.rhq.core.util.exception.WrappedRemotingException:java.lang.NullPointerException -> org.rhq.core.util.exception.WrappedRemotingException:null". However, when I go to the Dashboard, I can see the JBossAS Resource was indeed added to inventory, but with status NEW, rather than COMMITTED. When I import the Resource, the alert template does get applied to it (i.e. it has a corresponding alert defined).
Here's the lines from the log from when I did the manual add: 2008-05-22 12:24:23,788 DEBUG [org.rhq.enterprise.communications.command.server.CommandProcessor] {CommandProcessor.executing}Executing command [Command: type=[remotepojo]; cmd-in-response=[false]; config=[{rhq.security-token=1211411328407-1752998092-8502584036593054604, rhq.send-throttle=true}]; params=[{targetInterfaceName=org.rhq.core.clientapi.server.discovery.DiscoveryServerService, invocation=NameBasedInvocation[addResource]}]] 2008-05-22 12:24:23,804 DEBUG [org.rhq.enterprise.server.discovery.DiscoveryBossBean] 2008-05-22 12:24:23,804 DEBUG [org.rhq.enterprise.server.discovery.DiscoveryBossBean] getExistingResource processing for [Resource[id=0, type=JBossAS Server, key=C:\opt\jboss-4.2.2.GA\server\default, name=MAINFRAME JBossAS 4.2.2.GA default (1099), version=4.2.2.GA]] 2008-05-22 12:24:23,804 DEBUG [org.rhq.enterprise.server.discovery.DiscoveryBossBean] id=0: Agent reported resource with id of 0. 2008-05-22 12:24:23,804 DEBUG [org.rhq.enterprise.server.discovery.DiscoveryBossBean] id=0: Checking if a resource exists with the specified business key. 2008-05-22 12:24:23,804 DEBUG [org.rhq.enterprise.server.discovery.DiscoveryBossBean] id=0: Unable to find the agent-reported resource by id and business key. 2008-05-22 12:24:23,804 DEBUG [org.rhq.enterprise.server.discovery.DiscoveryBossBean] id=0: Resource's id was already zero, nothing to do for the merge. 2008-05-22 12:24:24,069 ERROR [org.rhq.enterprise.server.alert.engine.AlertConditionCache] Error inserting alert condition 'org.rhq.core.domain.alert.AlertCondition[ id=500053, category=Measurement Threshold, measurementDefinition=[MeasurementDefinition,id=500456,name=jboss.system:type=ServerInfo:ActiveThreadCount], name=Active Thread Count, comparator='>', threshold=5.0, option=null, org.rhq.core.domain.alert.AlertDefinition[ id=100012, name=foobar, conditionExpression=ALL, priority=!!! - High, resourceId=500396 ] ]': javax.persistence.NoResultException: No entity found for query 2008-05-22 12:24:24,069 DEBUG [org.rhq.enterprise.server.alert.AlertDefinitionManagerBean] createAlertDefinition: AlertConditionCacheStats[ created=0, updated=0, deleted=0, matched=0, age=15ms ] 2008-05-22 12:24:24,147 DEBUG [org.rhq.enterprise.communications.command.server.CommandProcessor] {CommandProcessor.executed}Executed command - response is [Command Response: isSuccessful=[true]; command=[null]; results=[org.rhq.core.domain.discovery.MergeResourceResponse@139a3b6]; exception=[>> exception was null <<]] 2008-05-22 12:24:24,147 DEBUG [org.rhq.helpers.rtfilter.filter.RtFilter] Request to [/jboss-remoting-servlet-invoker/ServerInvokerServlet] took 390 ms 2008-05-22 12:24:24,163 DEBUG [org.rhq.enterprise.communications.command.server.CommandProcessor] {CommandProcessor.executing}Executing command [Command: type=[remotepojo]; cmd-in-response=[false]; config=[{rhq.security-token=1211411328407-1752998092-8502584036593054604, rhq.send-throttle=true}]; params=[{targetInterfaceName=org.rhq.core.clientapi.server.discovery.DiscoveryServerService, invocation=NameBasedInvocation[getInventoryStatus]}]] 2008-05-22 12:24:24,179 DEBUG [org.rhq.enterprise.communications.command.server.CommandProcessor] {CommandProcessor.executed}Executed command - response is [Command Response: isSuccessful=[false]; command=[null]; results=[null]; exception=[java.lang.reflect.InvocationTargetException:null -> org.rhq.core.util.exception.WrappedRemotingException:java.lang.NullPointerException -> org.rhq.core.util.exception.WrappedRemotingException:null]] 2008-05-22 12:24:24,194 DEBUG [org.rhq.helpers.rtfilter.filter.RtFilter] Request to [/jboss-remoting-servlet-invoker/ServerInvokerServlet] took 31 ms 2008-05-22 12:24:24,288 DEBUG [org.rhq.enterprise.communications.command.client.ClientRemotePojoFactory] {ClientRemotePojoFactory.execution-failure}Failed to execute remote POJO method [manuallyAddResource]. Cause: org.rhq.core.clientapi.agent.PluginContainerException:Failed to add resource with type [JBossAS Server] and parent resource id [500050]. -> org.rhq.core.util.exception.WrappedRemotingException:java.lang.NullPointerException -> org.rhq.core.util.exception.WrappedRemotingException:null r970
Fixed manual add at least to the level of AD import. There is an outstanding issue in that neither AD import or manual add will apply alert templates if the resource type has no metrics defined. This is due to the fact that alert template application is tied to measurement schedule creation. This is a bit odd and we should probably break this up. There is an inherent lack of ability to distinguish a New vs Committed resource, the logic today relies on whether measurement schedules exist for the resource in question. Either we clean this up or we protect against multiply applying the same alert template to a resource. this is ready for testing, as of the last commit made by Jay S.
OK, suggested test that covers the myriad of stuff above:
1) Install, if necessary some JON supported version of JBoss 2) Start JON server 3) Start JON agent 4) If necessary import your platform 5) Create one or more alert templates for both JBAS Server and JBAS-Server->Datasource - This gives you two levels in the hierarchy as the JBAS server parent will have a Datasource child. - If you check the option to apply to current resources you can see these applied to your JON JBAS server and the RHQ Datasource child Test auto-discovery: 6) Start up your JBoss server (I used 4.0.4) 7) Discovery - f on the JON agent to detect the new server 8) Import it from the AD portlet (in the GUI Dashboard) 9) Check to see if the Alert Templates generated Alert Definitions for your new JBAS Server and its Datasource. Test manual add: 10) Shut down the JBoss server 11) Uninventory the JBOss server from the GUI (browse resources) 12) Verify its gone from the agent inventory (the Inventory command) 13) exit the agent 14) start the agent again - 13,14 just force a discovery . In this case we're trying to *avoid* auto-discovering the JBoss server 15) wait a minute after startup to let discovery complete 16) start the JBOss server 17) Manually add the JBoss server to inventory 17 a) Go to Platform->Inventory 17 b) select manual add JBAS server 17 c) set the required path, deploy path, and *expand* advanced properties and set ProductType to AS. 17 d) click OK 18) Assuming the manual add worked, check to ensure the alert definitions were generated. Followed Jay's procedures, everything worked against qa-6020 build.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||