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();
Debugging JavaScript Actions
You can debug JavaScript files from the Sentinel Control Center with the help of the JavaScript
debugger. The JavaScript Debugger is a local debugger that executes scripts with respect to the
machine on which the Sentinel Control Center is running. The JavaScript Debugger instantiates a
debug session from the Data Access Service (DAS) machine.
A JavaScript Correlation Action can only be debugged after it is associated with a fired Correlation
Rule. Therefore, a prerequisite to debugging is to create a correlation rule that is guaranteed to fire,
then associate the JavaScript Correlation Action with that rule.
The debugger has the following controls:
Table 16-2
382 Sentinel 6.1 User Guide
Debugger Controls
Run
Run the script until the next breakpoint is encountered.
Step Into
Step into a function, one line at a time.
Pause
Pause the running script.
Stop
Stop the script.
Step Over
Step over a function to the next line in the script.
Step Out
Step out of the function to the next line in the script.