How to get Parent Resource Id and name in a JBoss ON CLI Alert Notification

Solution Verified - Updated -

Issue

  • I am developing script to get alert and resource related information when alert is fired . At present I have setup a availability alert for JBOSS EAP 6 Standalone Server. When the instance goes down it fires a alert and notification is sent as a CLI Script. How can I get parent resource Name and ID in alert CLI script?

Environment

  • Red Hat JBoss Operations Network (ON) 3.1.2
  • Red Hat JBoss ON Command Line Interface (CLI) 3.1.2
  • Customer's CLI Script:
// note, the 'alert' variable is seeded by the alert sender
// Log what we're doing to a file tied to the fired alert id
//
var e = exporter
e.setTarget( 'raw', '/export/appl/website/jon/jon-server-3.1.1.GA/alert-scripts/scripts/logs/alert-manual.log' )
// Dump the alert
//
e.write( alert )
// get a proxy for the alerted-on Resource
//
var alertResource = ProxyFactory.getResource(alert.alertDefinition.resource.id)
// Dump the resource
//
e.write( " " )
e.write( alertResource )
e.write( "YUVRAJ SECTION!" )
var res=ResourceManager.getResource(alert.alertDefinition.resource.id)
e.write( res )
var parentid=res.getParentResource().id
e.write( parentid )
e.write( "YUVRAJ SECTION!" )
e.write( " " )
e.write( "ECHO COMPLETE! 5.7" )

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.