JavaScript actions take advantage of the functionality and flexibility of the JavaScript language and can be used to execute actions using Sentinel system methods to do things such as:
Start/stop the Collectors
Add/remove from dynamic lists
Get a current event
Get a correlated event
Get a correlation event collection
Get an incident
Execute actions by using Integrators
The code sample below starts or stops a Collector based on the information in the correlated event.
importPackage(java.lang); var CollectorName = "TC_5"; var evt = scriptEnv.getCurrentEvent(); var collNm = evt.getPort(); var outfile = new java.io.PrintWriter(new java.io.FileWriter("/opt/jaya/strtcoll.txt", true)); if(collNm && collNm.equals(CollectorName)) { var collist = ESM.collectorsForName(collNm); if (collist.size() > 0) { var coll = collist.get(0); outfile.println("Stopping " + CollectorName); coll.stop(); Thread.sleep(60000); outfile.println("starting " +CollectorName); coll.start(); } } else { outfile.println("JSTest collector does not exist"); } outfile.close();
For trademark and copyright information, see Legal Notices.