Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Trap arg does not match #3

Open
autumnw opened this issue Apr 27, 2015 · 0 comments
Open

Trap arg does not match #3

autumnw opened this issue Apr 27, 2015 · 0 comments

Comments

@autumnw
Copy link

autumnw commented Apr 27, 2015

Hi there,
I got an issue on trap_arg with CISCO CIMC trap event.
With C220 MIB, I always get the objects from transformed MIBS as the following:
{ObjectName(1.3.6.1.6.3.1.1.4.1): 'snmpTrapOID', ObjectName(1.3.6.1.4.1.9.9.719.1.1.1.1.1): 'cucsFaultIndex', ObjectName(1.3.6.1.4.1.9.9.719.1.1.1.1.16): 'cucsFaultOccur', ObjectName(1.3.6.1.2.1.1.3): 'sysUpTime', ObjectName(1.3.6.1.4.1.9.9.719.1.1.1.1.5): 'cucsFaultAffectedObjectDn', ObjectName(1.3.6.1.4.1.9.9.719.1.1.1.1.20): 'cucsFaultSeverity', ObjectName(1.3.6.1.4.1.9.9.719.1.1.1.1.7): 'cucsFaultProbableCause', ObjectName(1.3.6.1.4.1.9.9.719.1.1.1.1.22): 'cucsFaultType', ObjectName(1.3.6.1.4.1.9.9.719.1.1.1.1.10): 'cucsFaultCreationTime', ObjectName(1.3.6.1.4.1.9.9.719.1.1.1.1.14): 'cucsFaultLastModificationTime', ObjectName(1.3.6.1.4.1.9.9.719.1.1.1.1.4): 'cucsFaultAffectedObjectId', ObjectName(1.3.6.1.4.1.9.9.719.1.1.1.1.9): 'cucsFaultCode', ObjectName(1.3.6.1.4.1.9.9.719.1.1.1.1.11): 'cucsFaultDescription', ObjectName(1.3.6.1.4.1.9.9.719.1.1.1.1.13): 'cucsFaultId'}

But when a event happens, the args(parameters) like the following:
[2015-04-27 11:28:43,773] [DEBUG] [sensu-trapd] trap_arg : 1.3.6.1.4.1.9.9.719.1.1.1.1.9.167772424
[2015-04-27 11:28:43,773] [DEBUG] [sensu-trapd] trap_arg : 1.3.6.1.4.1.9.9.719.1.1.1.1.5.167772424
[2015-04-27 11:28:43,773] [DEBUG] [sensu-trapd] trap_arg : 1.3.6.1.4.1.9.9.719.1.1.1.1.14.167772424
[2015-04-27 11:28:43,773] [DEBUG] [sensu-trapd] trap_arg : 1.3.6.1.4.1.9.9.719.1.1.1.1.7.167772424
[2015-04-27 11:28:43,774] [DEBUG] [sensu-trapd] trap_arg : 1.3.6.1.4.1.9.9.719.1.1.1.1.1.167772424
[2015-04-27 11:28:43,774] [DEBUG] [sensu-trapd] trap_arg : 1.3.6.1.4.1.9.9.719.1.1.1.1.4.167772424
[2015-04-27 11:28:43,774] [DEBUG] [sensu-trapd] trap_arg : 1.3.6.1.2.1.1.3.0
[2015-04-27 11:28:43,774] [DEBUG] [sensu-trapd] trap_arg : 1.3.6.1.4.1.9.9.719.1.1.1.1.16.167772424
[2015-04-27 11:28:43,774] [DEBUG] [sensu-trapd] trap_arg : 1.3.6.1.4.1.9.9.719.1.1.1.1.11.167772424
[2015-04-27 11:28:43,774] [DEBUG] [sensu-trapd] trap_arg : 1.3.6.1.4.1.9.9.719.1.1.1.1.10.167772424
[2015-04-27 11:28:43,775] [DEBUG] [sensu-trapd] trap_arg : 1.3.6.1.4.1.9.9.719.1.1.1.1.20.167772424
[2015-04-27 11:28:43,775] [DEBUG] [sensu-trapd] trap_arg : 1.3.6.1.4.1.9.9.719.1.1.1.1.13.167772424
[2015-04-27 11:28:43,775] [DEBUG] [sensu-trapd] trap_arg : 1.3.6.1.4.1.9.9.719.1.1.1.1.22.167772424

This cause the following code in hander.py fail.

def handles(self, trap):
    if trap.oid == self.trap_type:
        for trap_arg in trap.arguments:
            if str(trap_arg) not in ['1.3.6.1.2.1.1.3.0'] and trap_arg not in self.trap_args.keys():
                return False
        return True
    return False

Looks like the transformed CISCO MIB adds "CucsManagedObjectId(167772424)" in behind of each object.

And here is my traps.json file:

cat traps.json

{
"cisco-event-handler1":
{
"trap":
{
"type":
[
"CISCO-UNIFIED-COMPUTING-NOTIFS-MIB",
"cucsFaultActiveNotif"
],
"args":
{
"sysUpTime":
[
"SNMPv2-MIB",
"sysUpTime"
],
"snmpTrapOID":
[
"SNMPv2-MIB",
"snmpTrapOID"
],
"cucsFaultIndex":
[
"CISCO-UNIFIED-COMPUTING-FAULT-MIB",
"cucsFaultIndex"
],
"cucsFaultAffectedObjectId":
[
"CISCO-UNIFIED-COMPUTING-FAULT-MIB",
"cucsFaultAffectedObjectId"
],
"cucsFaultCreationTime":
[
"CISCO-UNIFIED-COMPUTING-FAULT-MIB",
"cucsFaultCreationTime"
],
"cucsFaultLastModificationTime":
[
"CISCO-UNIFIED-COMPUTING-FAULT-MIB",
"cucsFaultLastModificationTime"
],
"cucsFaultCode":
[
"CISCO-UNIFIED-COMPUTING-FAULT-MIB",
"cucsFaultCode"
],
"cucsFaultType":
[
"CISCO-UNIFIED-COMPUTING-FAULT-MIB",
"cucsFaultType"
],
"cucsFaultProbableCause":
[
"CISCO-UNIFIED-COMPUTING-FAULT-MIB",
"cucsFaultProbableCause"
],
"cucsFaultOccur":
[
"CISCO-UNIFIED-COMPUTING-FAULT-MIB",
"cucsFaultOccur"
],
"cucsFaultId":
[
"CISCO-UNIFIED-COMPUTING-FAULT-MIB",
"cucsFaultId"
],
"cucsFaultDescription":
[
"CISCO-UNIFIED-COMPUTING-FAULT-MIB",
"cucsFaultDescription"
],
"cucsFaultAffectedObjectDn":
[
"CISCO-UNIFIED-COMPUTING-FAULT-MIB",
"cucsFaultAffectedObjectDn"
],
"cucsFaultSeverity":
[
"CISCO-UNIFIED-COMPUTING-FAULT-MIB",
"cucsFaultSeverity"
]
}
},

    "event": 
    {
        "name": "C220_Fault",
        "output": "[{hostname}] :",
        "handlers": 
        [
            "servicenow"
        ],

        "severity": "CRITICAL"
    }
},

This is the code I've got from transformed MIB:
CISCO-UNIFIED-COMPUTING-FAULT-MIB.py:cucsFaultIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 1, 1, 1, 1), CucsManagedObjectId()).setMaxAccess("noaccess")
CISCO-UNIFIED-COMPUTING-FAULT-MIB.py:cucsFaultHolderInstanceId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 1, 2, 1, 1), CucsManagedObjectId()).setMaxAccess("noaccess")
CISCO-UNIFIED-COMPUTING-FAULT-MIB.py:cucsFaultPolicyInstanceId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 1, 3, 1, 1), CucsManagedObjectId()).setMaxAccess("noaccess")
CISCO-UNIFIED-COMPUTING-FAULT-MIB.py:cucsFaultAffectedClassInstanceId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 1, 4, 1, 1), CucsManagedObjectId()).setMaxAccess("noaccess")
CISCO-UNIFIED-COMPUTING-FAULT-MIB.py:cucsFaultLocalTypedHolderInstanceId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 1, 6, 1, 1), CucsManagedObjectId()).setMaxAccess("noaccess")
CISCO-UNIFIED-COMPUTING-FAULT-MIB.py:cucsFaultSuppressPolicyInstanceId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 1, 7, 1, 1), CucsManagedObjectId()).setMaxAccess("noaccess")

So what could the issue be, is there anything wrong in my configuration?

Regards,
Autumn Wang

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant