Switch not created by discovery, SNMP: Connection failed.

Hi,

 

A new switch is not created by discovery. The warning is that it cannot connect to the switch, the credential check sais ok.

When you look at the commlog you can see it does connect and gets values, but what goes really wrong?

 

The warning is:

<< Progress message, Severity: Warning>>
SNMP: Connection failed.

 

I'll attach the commlog.

I run 10.10 cup2.651 with cp13.03.15

 

Gr,

Ronald

  • Hello Ronald, 

     

    It seems that the problem is that the SNMP is failing becuase the infomration been returned is not valid

     

    <log start="19:54:25" severity="debug">Unexpected SNMP_AGENT Exception:
    Traceback (most recent call last):
    File "SNMP_Connection_Utils", line 1056, in mainFunction
    File "SNMP_Connection_Utils", line 715, in doSnmp
    File "SNMP_Connection_Utils", line 838, in getSNByPublicMib
    ValueError: invalid literal for int() with base 10:
    </log>

     

    It may be better to open a support case to check into this

  • Ronald;

     

    The error is at the end of the communication log:

     

    <EXEC start="19:54:25" duration="15">
    <CMD>[CDATA&colon; 1.3.6.1.2.1.47.1.1.1.1.1,1.3.6.1.2.1.47.1.1.1.1.2,string,1.3.6.1.2.1.47.1.1.1.1.2,string,1.3.6.1.2.1.47.1.1.1.1.3,string,1.3.6.1.2.1.47.1.1.1.1.4,string,1.3.6.1.2.1.47.1.1.1.1.5,string,1.3.6.1.2.1.47.1.1.1.1.6,string,1.3.6.1.2.1.47.1.1.1.1.7,string,1.3.6.1.2.1.47.1.1.1.1.8,string,1.3.6.1.2.1.47.1.1.1.1.9,string,1.3.6.1.2.1.47.1.1.1.1.10,string,1.3.6.1.2.1.47.1.1.1.1.11,string,1.3.6.1.2.1.47.1.1.1.1.12,string,1.3.6.1.2.1.47.1.1.1.1.13,string,1.3.6.1.2.1.47.1.1.1.1.14,string,1.3.6.1.2.1.47.1.1.1.1.15,string,1.3.6.1.2.1.47.1.1.1.1.16,string]</CMD>
    <RESULT>[CDATA&colon; ROWS_1_COLS_17|_|1|_|EMPTY_VALUE|_|Cisco 5500 Series Wireless LAN Controller|_|EMPTY_VALUE|_|0|_|EMPTY_VALUE|_|-1|_|Chassis|_|V03|_|EMPTY_VALUE|_|7.3.101.0|_|FCW1652L02M|_|EMPTY_VALUE|_|AIR-CT5508-K9|_|EMPTY_VALUE|_|EMPTY_VALUE|_|EMPTY_VALUE]</RESULT>
    </EXEC>
    <DISCONNECT start="19:54:25" duration="0" CMD="client_disconnect" RESULT="" IS_NULL="Y" type="snmp" credentialsId="21935_1_CMS" />
    <log start="19:54:25" severity="debug">Unexpected SNMP_AGENT Exception:
    Traceback (most recent call last):
    File "SNMP_Connection_Utils", line 1056, in mainFunction
    File "SNMP_Connection_Utils", line 715, in doSnmp
    File "SNMP_Connection_Utils", line 838, in getSNByPublicMib
    ValueError: invalid literal for int() with base 10:
    </log>

     

    The problem is with a value of 'int', which isn't a valid integer...  If you examine the code, SNMP_Connection_Utils.py, like 838, it gives you what it is looking for:

     

    def getSNByPublicMib(client):
    entTable = SNMP_Networking_Utils.getEntPhysicalTable(client)
    if entTable:
    for row in entTable:
    # INTEGER {other(1), unknown(2), chassis(3), backplane(4), container(5), powerSupply(6), fan(7), sensor(8),
    # module(9), port(10), stack(11), cpu(12)}
    if int(row.entPhysicalClassess) == 3: #only get type of chassis
    return row.entPhysicalSerialNum
    return None

     

    So, entPhysicalClasses is expected to be an integer, but it returns 0 (see bold above).  Since 0 is not an integer, we fail.  The vendor should report a 1 if it is unknown... so, you could contact Cisco to see if an IOS upgrade fixes it, or you could submit a support case because our code should check first to see if it is an integer before running the int() on the value.  This would make our code better.

     

    Best Regards;


    Keith Paschal

    HP UCMDB Support

  • Thanks for your reply.

    According to wikipedia a zero is also an integer btw, but i will create a case for this to change the discovery.

     

    Gr,

    Ronald

  • Ha ha ha!  I may have miscounted the columns... it could be the 'EMPTY VALUE' that it is trying to convert to an integer.  At any rate it is *not* expected, and this is causing the problem.  A check should be put into the code that will check to ensure we aren't doing any casting of variables into types that they cannot be cast to...

  • Verified Answer

    Hi Ronald,

     

    A temporary solution, you could try to add the following red lines to SNMP_Connection_Utils.py

     

    def getSNByPublicMib(client):
        entTable = SNMP_Networking_Utils.getEntPhysicalTable(client)
        if entTable:
            for row in entTable:
                #  INTEGER {other(1), unknown(2), chassis(3), backplane(4), container(5), powerSupply(6), fan(7), sensor(8),
                #  module(9), port(10), stack(11), cpu(12)}
                if  row.entPhysicalClassess.strip():
                    if int(row.entPhysicalClassess) == 3: #only get type of chassis
                        return row.entPhysicalSerialNum
        return None

     

    Or you could catch the ValueError exception. It is another temporary solution.

     

    def getSNByPublicMib(client):
        entTable = SNMP_Networking_Utils.getEntPhysicalTable(client)
        if entTable:
            for row in entTable:
                #  INTEGER {other(1), unknown(2), chassis(3), backplane(4), container(5), powerSupply(6), fan(7), sensor(8),
                #  module(9), port(10), stack(11), cpu(12)}
                try:               

                    if int(row.entPhysicalClassess) == 3: #only get type of chassis
                        return row.entPhysicalSerialNum

                except ValueError:

                   return None

        return None

     

     

    Regards,

    Ivy

     

  • Hi Ivy,

     

    Thanks! That was very helpful.

    I added the line from the first example and now discovery runs ok and the switch ci is created.

     

    Gr,

    Ronald

  • Hi Ivy,

     

    Thanks! That was very helpful.

    I added the line from the first example and now discovery runs ok and the switch ci is created.

     

    Gr,

    Ronald