Bug 602682
Summary: | Alert notification: agent side script execution fails on tokens for alert sender operations | ||||||
---|---|---|---|---|---|---|---|
Product: | [Other] RHQ Project | Reporter: | Sudhir D <sdharane> | ||||
Component: | Alerts | Assignee: | RHQ Project Maintainer <rhq-maint> | ||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | Sudhir D <sdharane> | ||||
Severity: | high | Docs Contact: | |||||
Priority: | urgent | ||||||
Version: | 3.0.0 | CC: | jmarques, mazz | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | 2.4 | Doc Type: | Bug Fix | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2010-08-12 16:49:35 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Bug Depends On: | 613834 | ||||||
Bug Blocks: | 577256, 601949 | ||||||
Attachments: |
|
Description
Sudhir D
2010-06-10 13:23:31 UTC
Sudhir Can you check if this is still a problem using the correct Alert tokens as discussed with Joseph and Heiko I tried with jon-server-2.4.0.GA_QA Build# 42 with tokens in <% alert.name %> format and get the same error, java.lang.IllegalStateException: Malformed environment entry: <% alert.name %> at org.rhq.plugins.jbossas.script.ScriptComponent.createEnvironmentVariableMap(ScriptComponent.java:182) at org.rhq.plugins.jbossas.script.ScriptComponent.setEnvironmentVariables(ScriptComponent.java:148) at org.rhq.plugins.jbossas.script.ScriptComponent.invokeOperation(ScriptComponent.java:97) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:525) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Moving this to ON_DEV This worked for me. I created an alert definition called 'test parameter replacement' which would trigger the "twiddle.sh" script on my RHQ Server resource when it fired. In the operation arguments I put "<% alert.name %>" (without the quotes). This was the result of that operation: 00:10:42,742 ERROR [Twiddle] Command failure org.jboss.console.twiddle.command.NoSuchCommandException: No such command named 'test parameter replacement' at org.jboss.console.twiddle.Twiddle.createCommand(Twiddle.java:162) at org.jboss.console.twiddle.Twiddle.main(Twiddle.java:294) twiddle.sh commands: jsr77 Print out JSR77 related information xmbean Print out mbean metadata as an xmbean descriptor info Get the metadata for an MBean get Get the values of one or more MBean attributes invoke Invoke an operation on an MBean create Create an MBean setattrs Set the values of one or more MBean attributes unregister Unregister one or more MBeans query Query the server for a list of matching MBeans set Set the value of one MBean attribute serverinfo Get information about the MBean server Even though the twiddle command failed, the operation results show that the parameter replacement succeeded. The output said: No such command named 'test parameter replacement' As opposed to: No such command named '<% alert.name %>' ----- I'm going to need exact reproduction steps for how you're making this fail. I tried again with the latest build# 43. Below are the steps I'm performing. 1. Browse though the JBoss AS Server and select RHQ server under it. 2. Click on Alert tab and click New Definition. 3. I'm creating alert for JVM free memory and so I name is as, "JVM free memory alert" 4. Select the condition for JVM Free Memory value changed, so that the alert get triggered often for testing. 5. Click Edit under Alert Notification. 6. Click Add New and select Resource Operations. 7. Select Resource Selection Mode to Relative Resource and click Save. 8. Select Search from as JBoss AS Server 9. Select Then filter by as Script and type in the Name field as twiddle.sh 10. Select Operation Name as Execute Script 11. Click Save. 12. Browse through the twiddle.sh (JBoss AS Server -> RHQ Server -> Resources -> Scripts -> twiddle.sh) 13. Click on Inventory tab and then click on Connection sub tab. 14. Against Environment variables value, enter <% alert.name %> and click OK. Now, in the operation history under status, when I click on Failure, I see the mentioned exception. However, after step 10 if I passed the <% alert.name %> to the command line argument and don't do step 12,13 and 14, then it works. I guess this is the right thing to do. I wasn't able to do this in build# 42 as I was blocked by bug 607548. Marking this bug as verified. Needs retesting with the script plugin once 613834 is implemented Created attachment 431542 [details]
test-script.sh
attaching test-script.sh that you can use when needing a test script to be triggered. It can be used to test passing in env vars, arguments and changing exit codes as needed. Read the comments at the top of the attached script for more info on how to use it.
When testing with a Script plugin resource, test that the alert sender will: 1) pass in NO arguments (leave arguments unset) 1) pass in NO arguments (set argument to an empty string - uncheck the unset button) 2) pass in ONE argument 3) pass in MORE THAN ONE argument I have verified this on jon-server-2.4.0.GA_QA.zip build# 62 for all the 4 conditions mentiond in #7. Marking this bug as verified. Mass-closure of verified bugs against JON. |