Bug 736762

Summary: silent failure on CLI scripted alert with error
Product: [Other] RHQ Project Reporter: Mike Foley <mfoley>
Component: AlertsAssignee: Lukas Krejci <lkrejci>
Status: CLOSED WORKSFORME QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.1CC: hrupp
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-09-14 09:49:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 715380    
Attachments:
Description Flags
CLIAlert script
none
server log none

Description Mike Foley 2011-09-08 15:58:45 UTC
Created attachment 522152 [details]
CLIAlert script

Description of problem:  silent failure on CLI scripted alert with error 



Steps to Reproduce:
1.  http://metlos.wordpress.com/2011/03/08/scripted-alert-notifications-in-rhq/
2.  (see attachment) 
3.
  
Actual results:
1) errors in server log, attached
2) silent failure, no information on the alert history notification tab that the notification had an error in it
 
Expected results:
some information on the alert history notification tab that the notification had an error in it


Additional info:  
the CLI script (attached) has an error in it, as follows:

java.lang.Runtime.getRuntime().exec('/somewhere/on/the/server/restart-database.sh')

Comment 1 Mike Foley 2011-09-08 16:02:38 UTC
Created attachment 522153 [details]
server log

Comment 2 Lukas Krejci 2011-09-14 09:49:41 UTC
I could not reproduce this. The system seems to behave as expected to me.

For reference, here's what I did:

1) Created a Repository "test"
2) Went to a platform, created alert on the change of "Free Memory" metric, created a CLI Script notification and uploaded the script to the test repo.
3) Saved the alert definition
4) waited for an alert to fire
5) Double clicked on the entry in the alert history

Here's what the notification subtab of the history entry shows:

Sender: CLI Script
Status: x
Message: Ran script bz-736762.js in version rhqadmin:1.0 from repo test as user rhqadmin.

javax.script.ScriptException:sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "MeasumentDefinitionManager" is not defined. (#19) in
at line number 19 in script bz-736762.js (rhqadmin:1.0) in repo test at line number 19