The Automation feature in Operations Center allows users to define actions that are triggered by activities or condition changes that occur in the network. The feature is explained in Defining and Managing Automation Events in the Operations Center Server Configuration Guide. One of the automation actions is running a script.
For example, the following script instructs Operations Center to audit the actions performed against alarms.
///////////////////////////////////////////////////////////// AuditActions.fs writeln( "Auditing Actions Against Alarms..." ); // Filename that the Actions should be logged too var fpAudActionFile = "../logs/ActionAudit.log"; // Variable to hold the auditing output var str = "" + '\n'; // Build the current date and time var RightNow = new Date(); str += RightNow.getDate() + "‑"; str += RightNow.getDay() + "‑"; str += RightNow.getFullYear() + " "; str += RightNow.getHours() + ":"; str += RightNow.getMinutes() + ":"; str += RightNow.getSeconds(); // Tag the Action to a person str += ' User "' + user + '" ran the command "' + command + '" against alarm:\n'; // Grab the top level alarm information for( var i = 0; i < alarms.length; ++i ) { str += 'Alarm: ' + alarms[i].getID() + ', element: ' + alarms[i].getElement().getDName(); // Grab the actual alarm... if you issued a "Delete" it might be gone already for( p in alarms[i].properties ) { str += '\n\t' + p + " = " + alarms[i][p]; } } // Open the logging file var writer = new java.io.PrintWriter( new java.io.FileOutputStream( fpAudActionFile, true ) ); // Write the string we built to the file writer.println( str ); // Close the file writer.close(); // EOF() AuditActions.fs
To implement this script:
Copy the script file (in the previous example, it is AuditActions.fs) to /OperationsCenter_install_path/database/scripts/util.
Create an action under the Automation Server element that runs a script from the library, and point to util/AuditActions.fs.
Create an automation server item that is hooked at a level (Enterprise, Elements, Adapter, and so on) that is linked to An Alarm operation was performed.
Select the action defined in Step 2 and apply it.
Close, clear, and acknowledge an alarm.
View the /OperationsCenter_install_path/logs directory to locate the ActionAudit.log file.
The variables available during script execution depend on the event that triggered that script. Table 6-1 lists the global variables associated with alarm events.
Table 6-1 Global Variables for Alarm Events
Event |
Variable |
---|---|
Alarm created |
alarm |
Alarm deleted |
list (integer list of IDs) |
Alarm updated |
alarm |
Alarm operation performed |
Alarms |