trehn / hnmp

High-level Python SNMP library
ISC License
49 stars 16 forks source link

Wide table correlation #18

Closed rtu-dataframe closed 2 years ago

rtu-dataframe commented 3 years ago

Hi, thanks for the library...very useful!

Anyway, i'm trying to do a sort of "wide table correlation" of a Cisco 3750 switch with two columns (port_description and port_duplex) that are under the same base OID (1.3.6.1), this is what i'm doing:

a = snmp_client.table("1.3.6.1", columns={"2.1.31.1.1.1.18":"port_desc", "2.1.10.7.2.1.19": "duplex"}, fetch_all_columns=False)

I'm expecting to access a.rows[i] and get the port description and duplex values...but i have something like that:

OrderedDict([(2, 'SAN-DEV ETH1'), ('_row_id', '1.31.1.1.1.18.21')])

Maybe i'm missing something?

trehn commented 2 years ago

You can't merge data from two different tables like that. Fetch both tables separately and merge the data in your code.