|
What is the difference between SNMPv1 TRAP and SNMPv2 NOTIFICATION
Do I need to specifically disable the automatic sending of a trap when a trap variable value is set?
How big can the notification log table be? The default size is 10.
How do I specify what port the Agent listens on for Sets/Gets?
1. What is the difference between SNMPv1 Trap and SNMPv2 Notification?
This table gives the difference between the SNMPv1 and SNMPv2 traps.
| Trap | Notification |
|---|---|
|
1. Contains agent address. |
1. Does not contain agent address. |
|
2. It has information about specific trap and generic trap value. |
2. It has Trap OID in the second varbind. |
|
3. It does not have error index and status. |
3. It has error index and status. |
|
4. Does not support confirmed trap. |
4. Supports Confirmed Notification (INFORM). |
2. How can I test a trap successfully generated from agent to manger with the existing AGENT-SAMPLE-MIB? Do I need to write some codes to call the trap method to make agent to generate trap?
If you configured the agent as SNMPv2c/v1 then you can see a configuration file v2managertable.txt in AdventNet/CAgent/projects/<project name>/agent/bin/conf directory. By default, it will have one entry with manager IP address as 127.0.0.1, manager port number as 8003, and community as "public".
If you configured the agent as SNMPv3 then you can see v3managertable.txt in AdventNet/C-Agent/<project name>/agent/bin/conf directory.
In the Trap Browser, give community as "public" and port number as "8003", say "Add", then Start. Now if you do set operation on agentNetstat, or agentLocation, or agentAvailMemory, or agentPing, the agent will generate a trap and you can receive it in TrapBrowser.
For more information, please refer to Sending Traps, Notifications and Informs section of Building SNMP Agents section.
3. Is there a way to indicate to the trap function which instance of the variable should be included in the trap in case of tables?
Yes, you can indicate the trap function which instance of the variable should be included in the trap for tables. By default, when the c agent generates a trap for a data change in a table, it always uses the data in the first row even if the data belongs to second row or third row, etc.
Please refer to the topic Sending Traps Based on the Instance of a Table for Standalone SNMP Agents and Sending Traps, Notifications and Informs for Multi-Protocol Agent.
4. It seems that anybody can add/delete entries in the v1v2TrapForwardingTable. Is this the standard way followed in industry?
Through remote configuration (from manager), we can add/delete entries in the Trap Forwarding Table. By default, the macro TRAPFORWARDING_REMOTE_IFC will be declared in the AdventNet/C-Agent/projects/project(n)/agent/system/include/ config.h file.
If you don't want to add or delete entry from the remote (from manager), please comment the macro TRAPFORWARDING_REMOTE_IFC in the specified file. Now compile the code and start the agent. From now onward, addition or deletion of entry for the v1v2TrapForwardingTable from the manager is not possible. Here AdventNet Agent Toolkit C Edition provides an option to enable or disable this feature according to the macro declaration in config.h file.
5. Can I add a user message and send it along the trap?
In general, you can send user message by using some scalar or table instance implemented by the agent. For example, for AGENT-SAMPLE-MIB in the agentsampleMIBtraps.c file, the function CreatescalarNotificationsNotification() is used to send a notification for the scalar Notification object. In this function, you can modify the sent value.
For example,
|
notificationAttribute notifAttrbs[3] = { { "AGENT-SAMPLE-MIB:AdiskTable", "adiskName", 0 }, { "AGENT-SAMPLE-MIB:AaplicationUserTable", "aaplicationUserName",0 }, { "AGENT-SAMPLE-MIB:AdiskTable", "adiskUsed", 0 } };
can be replaced to
notificationAttribute notifAttrbs[3] = { { "AGENT-SAMPLE-MIB:AdiskTable", "adiskName", 0 }, { "AGENT-SAMPLE-MIB:AaplicationUserTable", "aaplicationUserName", 0 }, { "ANOTHER-REGISTERED-MODULE:SOME-Table", "COLUMN", 0 } }; |
Here,
ANOTHER-REGISTERED-MODULE is some another module also implemented by the agent.
For example, RFC1213-MIB, COLUMN is the column present in the SOME-TABLE table present in the MIB and implemented by the agent.
6. Is it compulsory to add an object to a notification?
No, it is not compulsory to add an object to a notification type.
7. How do I test notifications?
By default, the option Generate Trap On Set in the Generate Options of the Settings Menu is enabled. If this is selected and code is generated, it will cause a trap to be sent when a set operation is done on the scalar objects defined in a trap /notification type.
Refer to traps and notifications sections for details.
8. How do I use Notification Group and Object-Group?
Notification Group construct is used in SNMPV2 Mib Modules to define a set of related events (notifications). This will help in grouping events.
9. Do I need to specifically disable the automatic sending of a trap when a trap variable value is set?
Yes, you will have to uncheck the Generate Trap on Set option in the Settings --> Code Generation --> General. By default, the above option will be enabled and hence the Agent will send out traps on doing a set request for the trap defined variables.
10. When the Agent is started, does it automatically send a cold or warm start trap? If so, can this feature be turned off? How does it know whether or not a warm or cold start will be required?
Yes, whenever the AdventNet generated Agent is started, it will send out a generic cold start trap. With the existing version of the product, Agent Toolkit C Edition 6.0.0, you can disable this start up traps by commenting the SNMP_STARTUP_TRAP macro present in the config.h file in the <AdventNet>\C-Agent\projects\<project name>\agent\source\system\include directory.
11. How big can the notification log table be? The default size is 10.
The Maximum number of entries that a notification log table can hold is 2147483647, the Integer32 Range. But as all these entries will be stored in memory, it is recommended to store a minimum number of entries and the agent API will take care of storing the details of the latest traps sent out.
12. How do I specify what port the Agent listens on for Sets/Gets?
The Agent Port that you are specifying in the Settings --> SNMP -> General option is the port where the agent will start listening for the request and from where the responses will be sent out. The Trap Port Number parameter in Settings -> SNMP -> Trap -> General option is the one to specify the port from where the Agent sends out the traps\notifications.
13. I'll be using some MIB trap variables such as 'severity' to create my traps, but I do not want these to be exposed necessarily to third-party managers, as they will be transient values; how do I prevent this?
If you want to restrict only certain values for specific Manger Entries, then you would have to make use of the DofilteringforSNMPTraps() method available in the inform.c file in <AdventNet>\C-Agent\agent\stubs directory.
14. In the Sending Traps and Informs section, http://www.webnms.com/cagent/help/snmp/c_snmp_traps.html, it describes how to add data into the trap. Is the entire trap data contained in the extraVarBinds Vector?
The Traps sent out for a particular Trap definition will contain all the VarBinds related to the variables contained in that Trap/Notification definition. In addition to this if you wish to add extra VarBinds with them, you can make use of the extraVarbind Vector parameter. For more information on this, please refer to Adding Extra Varbinds to Traps section.
15. How are the traps generated? Is it Sub-agent-->Destination, or Sub-agent-->Master agent-->Destination? Can we configure the traps from Native agent /other SNMP stack to be forwarded to Master agent, which can then forward them to the right destinations? This is to have the entire trap configuration in one place.
Traps can be generated either for sub-agent-->destination or through sub-agent-->Master agent-->Destination. To send the trap generated by sub-agent through master agent, we have provided a table called Trap Receiver table which can be used to receive the sub-agent traps in the master agent and finally send them to the destination.
Also, you can send the sub-agent trap directly to the destination by configuring the manager entries in the Trap Forwarding table.
To know more about trap, please refer to the section Sending Traps from sub-agent.
|