|
9.1 What are Autonomous Messages?
9.2 Generated Code for Autonomous Messages
9.3 Instrumenting and Sending Autonomous Messages
9.1 What are Autonomous Messages?
Autonomous Messages are unsolicited messages emanating from the TL1 Agent to notify the client or the manager of some event that might be of importance. Autonomous messages are sent from the NE to the appropriate OS without having an explicit input message associated with it.
9.2 Generated Code for Autonomous Messages
When code is generated for a TCS file with Autonomous message defined in it, the corresponding source files will be generated under the <Agent Toolkit Home>/tl1projects/<Your project>/agent/src/com/myCompany/myPackage directory.
For example, when code is generated for tl1sample.tcs file, the stub file REPT-LOS.java for the Autonomous Message "REPT-LOS" gets generated under the above mentioned directory.
The stub file generated for an Autonomous Message has the sendAutonomous() method in it. You can do your own instrumentation in this method and call it from any other stub files when a specified action takes place. The prototype of the method is given below.
public void sendAutonomous(/**User can send any parameters and can instrument it*/)
This method can be called from the application code, which is interested in sending an alarm to the TL1 NE.
The following code snippet shows the sendAutonomous() method from a sample autonomous type source file.
|
public void sendAutonomous(/**User can send any parameters and instrument it*/){ Object[] defValues = null; String[] keys = null; String[] delimiters = null; String lineType = null; boolean[] nameEqValue = null; Vector sessList = mainAgent.tl1Agent.getAllSession(); /** Default implementation for autonomous **/ Vector responseVector = new Vector(); keys = alarmKeys[0]; defValues = defaultValues[0]; delimiters = respDelimiters[0]; nameEqValue =nameEqualsValue[0]; lineType = lineTypes[0]; TL1Line line = null; line = TL1MessageFormatter.createTL1Line(keys,defValues,delimiters,lineType,nameEqValue); responseVector.add(line); TL1AgentResponseInfo autoInfo = new TL1AgentResponseInfo(); autoInfo.setResponseLinesVector(responseVector); autoInfo.setSessionList(sessList); autoInfo.setAlarmCode(com.adventnet.tl1.message.TL1AutonomousMessage.CRITICAL_ALARM); mainAgent.tl1Agent.sendAutonomousMessage(autoInfo); } |
9.3 Instrumenting and Sending Autonomous Messages
You can Instrument the TL1 Agent to generate Autonomous Messages for some specific action. The Instrumentation must be done in the sendAutonomous()in the Autonomous essage stub file. This method must be called from any other response file in which the action is defined.
While calling the sendAutonomous() from the response type stub files, you can pass any parameters and do the instrumentation. Depending on the instrumentation code you add in the response stub file, Autonomous Message gets generated with default or instrumented values on the occurrence of any event.
Following code snippet shows the instrumented sendAutonomous() method from a sample autonomous type source file
|
public void sendAutonomous(String alert) { Object[] defValues = null; String[] keys = null; String[] delimiters = null; String lineType = null; boolean[] nameEqValue = null; Vector sessList = mainAgent.tl1Agent.getAllSession(); /** Default implementation for autonomous **/ Vector responseVector = new Vector(); keys = alarmKeys[0]; defValues = defaultValues[0]; delimiters = respDelimiters[0]; nameEqValue =nameEqualsValue[0]; lineType = lineTypes[0]; TL1Line line = null; /** Instrumentation */ defValues = new Object[1]; defValues[0] = alert; line = TL1MessageFormatter.createTL1Line(keys,defValues,delimiters,lineType,nameEqValue); responseVector.add(line); TL1AgentResponseInfo autoInfo = new TL1AgentResponseInfo(); autoInfo.setResponseLinesVector(responseVector); autoInfo.setSessionList(sessList); autoInfo.setAlarmCode(com.adventnet.tl1.message.TL1AutonomousMessage.CRITICAL_ALARM); mainAgent.tl1Agent.sendAutonomousMessage(autoInfo); } |
An example is available in the <Agent Toolkit Home>/examples/tl1/autonomous directory, which explains how to send a Non-Alarm type autonomous message, containing performance data, to the manager periodically, for every one minute. The following Readme.html file explains the steps involved in sending the autonomous message.
The instrumented files are available in the <Agent Toolkit Home>/examples/tl1/autonomous /src/com/myCompany/myPackage directory by default. Details about running the example are available in the Readme.html file mentioned above.
|