Increase the limit of the varbinds for the traps processed by the Trap Adapter
search cancel

Increase the limit of the varbinds for the traps processed by the Trap Adapter

book

Article ID: 332235

calendar_today

Updated On:

Products

VMware Smart Assurance Network Observability

Issue/Introduction

You have traps with up to 28 or 30 varbinds but the TRAP OI processes only up to 20 varbinds. 
You would like to customize the appropriate ASL script to populate the additional event attributes.

This article provides detailed instructions on how to extend the trap_mgr_parse.asl script to handle a higher number of varbinds, such as up to 30 (which will cover the requested 28 varbinds).

Environment

All Supported Smarts releases

Cause

By default, the VMware Smart Assurance Trap Adapter, through the trap_mgr_parse.asl script, is configured to process and expose a maximum of 20 varbinds (V1 through V20) from incoming SNMP traps to subsequent ASL scripts.

Customers often encounter traps that contain more than 20 varbinds (e.g., up to 28, 30, or more). When such traps are received, any varbinds beyond the 20th will not be parsed or made available as Vxx or OIDxx variables, preventing other ASL scripts from populating event attributes based on these additional varbinds.

if (defined(Varbinds[18])) {
    persistentAdapter->setVariable("V19", Varbinds[18]) ? IGNORE;
    persistentAdapter->setVariable("OID19", Oids[18]) ? IGNORE;
}

if (defined(Varbinds[19])) {
    persistentAdapter->setVariable("V20", Varbinds[19]) ? IGNORE;
    persistentAdapter->setVariable("OID20", Oids[19]) ? IGNORE;
}

Resolution

Important Considerations Before Customizing

  • Backup: Always back up the original trap_mgr_parse.asl file before making any modifications. This allows you to revert changes if any issues arise.
  • Location: The trap_mgr_parse.asl file is typically located at:
    • $BASEDIR/smarts/local/rules/trap_mgr_parse.asl (for custom rules)
    • $BASEDIR/smarts/rules/trap_mgr_parse.asl (for default rules, though customization is preferred in local/rules)
      • or on new version of the product
    • $BASEDIR/smarts/rules/icoi-trapd/trap_mgr_parse.asl (for default rules, though customization is preferred in local/rules)
    • $BASEDIR/smarts/local/rules/icoi-trapd/trap_mgr_parse.asl (for custom rules)
    • Always modify the file in local/rules if it exists. If not, copy the default file to the /local/rules first and then modify the copy. This ensures your changes are not overwritten during upgrades.
  • ASL Syntax: Ensure strict adherence to ASL syntax. Even minor errors can prevent the ASL script from loading or functioning correctly.
  • Impact of Upgrades: Customizations in local/rules are generally preserved. However, if the base trap_mgr_parse.asl in $BASEDIR/smarts/rules is significantly updated in a future product version, you may need to re-apply or re-evaluate your customizations.
  • 0-Indexing: Remember that ASL arrays (like Varbinds and Oids) are 0-indexed. This means Varbinds[0] is the first varbind, Varbinds[19] is the 20th varbind, and Varbinds[20] is the 21st varbind.

To allow the Trap Adapter to process more than 20 varbinds, you need to manually edit the trap_mgr_parse.asl file to:

  1. Declare additional Vxx and OIDxx variables.
  2. Add conditional logic to assign values from the incoming trap's varbinds (Varbinds[] and Oids[] arrays) to these newly declared variables.

Step-by-Step Customization

Let's assume you want to extend varbind processing up to 30 varbinds.

1. Locate and Open trap_mgr_parse.asl:
Navigate to the appropriate directory (preferably in the /local/rules/) and open trap_mgr_parse.asl in a text editor (e.g., vi, nano).

2. Add Variable Declarations (Vxx and OIDxx):
Scroll down to the section where persistentAdapter->setVariable calls declare the V and OID variables. This section typically looks like this (search for "V20"):

persistentAdapter->setVariable("V18", "") ? IGNORE;
persistentAdapter->setVariable("OID18", "") ? IGNORE;
persistentAdapter->setVariable("V19", "") ? IGNORE;
persistentAdapter->setVariable("OID19", "") ? IGNORE;
persistentAdapter->setVariable("V20", "") ? IGNORE;
persistentAdapter->setVariable("OID20", "") ? IGNORE;

Below the existing V20 and OID20 declarations, add lines for V21 through V30 and OID21 through OID30:

// --- START: Custom Varbind Declarations (21-30) ---
persistentAdapter->setVariable("V21", "") ? IGNORE;
persistentAdapter->setVariable("OID21", "") ? IGNORE;
persistentAdapter->setVariable("V22", "") ? IGNORE;
persistentAdapter->setVariable("OID22", "") ? IGNORE;
persistentAdapter->setVariable("V23", "") ? IGNORE;
persistentAdapter->setVariable("OID23", "") ? IGNORE;
persistentAdapter->setVariable("V24", "") ? IGNORE;
persistentAdapter->setVariable("OID24", "") ? IGNORE;
persistentAdapter->setVariable("V25", "") ? IGNORE;
persistentAdapter->setVariable("OID25", "") ? IGNORE;
persistentAdapter->setVariable("V26", "") ? IGNORE;
persistentAdapter->setVariable("OID26", "") ? IGNORE;
persistentAdapter->setVariable("V27", "") ? IGNORE;
persistentAdapter->setVariable("OID27", "") ? IGNORE;
persistentAdapter->setVariable("V28", "") ? IGNORE;
persistentAdapter->setVariable("OID28", "") ? IGNORE;
persistentAdapter->setVariable("V29", "") ? IGNORE;
persistentAdapter->setVariable("OID29", "") ? IGNORE;
persistentAdapter->setVariable("V30", "") ? IGNORE;
persistentAdapter->setVariable("OID30", "") ? IGNORE;
// --- END: Custom Varbind Declarations (21-30) ---

3. Add Conditional Assignment Logic:
Scroll further down to the section where the if (defined(Varbinds[N])) blocks assign the varbind values. This section typically looks like this (search for "if (defined(Varbinds[19]))"):

if (defined(Varbinds[18])) {
    persistentAdapter->setVariable("V19", Varbinds[18]) ? IGNORE;
    persistentAdapter->setVariable("OID19", Oids[18]) ? IGNORE;
}
if (defined(Varbinds[19])) {
    persistentAdapter->setVariable("V20", Varbinds[19]) ? IGNORE;
    persistentAdapter->setVariable("OID20", Oids[19]) ? IGNORE;
}

Below the existing if (defined(Varbinds[19])) block, add similar blocks for Varbinds[20] through Varbinds[29] (which correspond to V21 through V30):

// --- START: Custom Varbind Assignments (21-30) ---
if (defined(Varbinds[20])) {
    persistentAdapter->setVariable("V21", Varbinds[20]) ? IGNORE;
    persistentAdapter->setVariable("OID21", Oids[20]) ? IGNORE;
}

if (defined(Varbinds[21])) {
    persistentAdapter->setVariable("V22", Varbinds[21]) ? IGNORE;
    persistentAdapter->setVariable("OID22", Oids[21]) ? IGNORE;
}

if (defined(Varbinds[22])) {
    persistentAdapter->setVariable("V23", Varbinds[22]) ? IGNORE;
    persistentAdapter->setVariable("OID23", Oids[22]) ? IGNORE;
}

if (defined(Varbinds[23])) {
    persistentAdapter->setVariable("V24", Varbinds[23]) ? IGNORE;
    persistentAdapter->setVariable("OID24", Oids[23]) ? IGNORE;
}

if (defined(Varbinds[24])) {
    persistentAdapter->setVariable("V25", Varbinds[24]) ? IGNORE;
    persistentAdapter->setVariable("OID25", Oids[24]) ? IGNORE;
}

if (defined(Varbinds[25])) {
    persistentAdapter->setVariable("V26", Varbinds[25]) ? IGNORE;
    persistentAdapter->setVariable("OID26", Oids[25]) ? IGNORE;
}

if (defined(Varbinds[26])) {
    persistentAdapter->setVariable("V27", Varbinds[26]) ? IGNORE;
    persistentAdapter->setVariable("OID27", Oids[26]) ? IGNORE;
}

if (defined(Varbinds[27])) {
    persistentAdapter->setVariable("V28", Varbinds[27]) ? IGNORE;
    persistentAdapter->setVariable("OID28", Oids[27]) ? IGNORE;
}

if (defined(Varbinds[28])) {
    persistentAdapter->setVariable("V29", Varbinds[28]) ? IGNORE;
    persistentAdapter->setVariable("OID29", Oids[28]) ? IGNORE;
}

if (defined(Varbinds[29])) {
    persistentAdapter->setVariable("V30", Varbinds[29]) ? IGNORE;
    persistentAdapter->setVariable("OID30", Oids[29]) ? IGNORE;
}
// --- END: Custom Varbind Assignments (21-30) ---

4. Save the trap_mgr_parse.asl file.

Applying the Changes

For the changes to take effect, the Trap Adapter service needs to be restarted.

Restart the Trap Adapter Service

    • Log in to the Smart Assurance server.
    • Navigate to the Trap Adapter's domain directory (e.g., $BASEDIR/smarts/bin).
    • Run: sm_service stop <TrapAdapter_Domain_Name> & sm_service start <TrapAdapter_Domain_Name>
    • Example: sm_service stop INCHARGE-SA_TRAP & sm_service start INCHARGE-SA_TRAP

Verification

  1. Send a Test Trap: Generate and send a test SNMP trap to the Trap Adapter that contains more than 20 varbinds (e.g., 25 or 28 varbinds).
  2. Check Event Attributes:
    • Open the Smart Assurance Console (e.g., Service Assurance Manager or OI Console).
    • Locate the event generated by your test trap.
    • Inspect the event's attributes. You should now see V21, V22, up to V28 (or V30) populated with the correct values from your test trap.
  3. Check Trap Adapter Logs: Review the Trap Adapter's log file (<Domain_Name>.log) for any ASL syntax errors after the reload/restart.

 

Additional Information

Troubleshooting

  • ASL Errors: If the Trap Adapter fails to start or reload, check its log file for ASL syntax errors. The log will usually indicate the line number where the error occurred.
  • Varbinds Not Appearing:
    • Double-check your ASL modifications for typos or incorrect indexing.
    • Ensure the test trap you are sending actually contains the expected number of varbinds. Use a tool like snmptrapd in debug mode or Wireshark to verify the incoming trap's content.
    • Confirm the Trap Adapter service was successfully restarted or reloaded.