OID import. Multiple lists with subtrees. Import failed: 'Too many values to unpack'

Hello,

I wrote an SNMP check and wanted to import my OIDs like this:

check_info["satepg"] = {
        'check_function':       check_satepg,
        'inventory_function':   inventory_satepg,
        'service_description':  'Sat-EPG',
        'has_perfdata':         False,
        'snmp_scan_function':   lambda oid: "bap1xxx" in oid(".1.3.6.1.2.1.1.1.0"),
        'snmp_info': 
	(
	        # Block 1
            ".1.3.6.1.4.1.23416.1.3.2.2.1",
            [ # Subtrees:
            "5.1.1.1079.28012", # name;
            "6.1.1.1079.28012", # error_state;
            "8.1.1.1079.28012"  # error_msg
            ],

            # Block 2
            ".1.3.6.1.4.1.23416.1.3.2.2.1",
            [
            # Subtrees:
            "5.1.1.1079.28013", #name;
            "6.1.1.1079.28013", #error_state;
            "8.1.1.1079.28013"  #error_msg;
            ],
        )

}

When I import Block 1 everything works fine. But when I add Block 2 I get the following error from the debugger:

[snmp] ERROR: too many values to unpack

The documentation told me: “If there are several OIDs, the tuples must be packed in a list”
Does this mean that only the subtrees can be in a list?

Can someone help me to ‘pack’ my OIDs the right way? Or is it just not possible to import multiple lists with subtrees.
Thank you!

You need to pack the tuples in a list like this:

'snmp_info': [ ( # Block 1
        ".1.3.6.1.4.1.23416.1.3.2.2.1",
        [ # Subtrees:
        "5.1.1.1079.28012", # name;
        "6.1.1.1079.28012", # error_state;
        "8.1.1.1079.28012"  # error_msg
        ] ),
        (
        # Block 2
        ".1.3.6.1.4.1.23416.1.3.2.2.1",
        [
        # Subtrees:
        "5.1.1.1079.28013", #name;
        "6.1.1.1079.28013", #error_state;
        "8.1.1.1079.28013"  #error_msg;
        ] ) ]
1 Like