Skip to content
TheChatArchiveThe Chat Archive
chatgpt-4o-latest-20250326· OpenAIHugging Face LMArena Human Preference 140K

How to use the snmptable command with only OID?

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Geminigemini-2.5-pro’s answer.
  1. User

    How to use the snmptable command with only OID?

  2. Assistant

    The snmptable command from the Net-SNMP suite is used to display SNMP table data in a readable tabular format. While it normally takes a MIB table name for convenience, you can also use it with a raw OID (Object Identifier) if you don't have or don't want to use MIBs.


    ✅ Basic Syntax of snmptable with OID

    snmptable -v [version] -c [community] [host] [OID]
    

    🛠️ Example with Raw OID

    Let’s say you're trying to query the ifTable table via its numeric OID:

    • MIB name: ifTable
    • Numeric OID: .1.3.6.1.2.1.2.2

    Here’s how you can use snmptable with just the OID:

    snmptable -v2c -c public 192.168.1.1 .1.3.6.1.2.1.2.2
    

    ⚙️ Explanation of Flags

    • -v2c: Use SNMP version 2c
    • -c public: Community string (default is usually public)
    • 192.168.1.1: IP or hostname of the SNMP device
    • .1.3.6.1.2.1.2.2: OID of the SNMP table

    🔍 Tips

    1. Suppress MIB usage: If you're using just OIDs and want to prevent the command from loading MIB files, you can use the -M and -m options:

      snmptable -v2c -c public -M "" -m "" 192.168.1.1 .1.3.6.1.2.1.2.2
      
    2. Timeouts or Errors? Make sure:

      • The device is SNMP-enabled
      • You’re using the right community string and version
      • The OID corresponds to a table
    3. Check Available Tables
      If you're exploring, you can first try an SNMP walk:

      snmpwalk -v2c -c public 192.168.1.1
      

    🔄 Alternative: Use with Table Name (If MIBs are installed)

    If MIB files are available, you can replace the OID with a name:

    snmptable -v2c -c public 192.168.1.1 ifTable
    

    But again, using the numeric OID is fine if MIBs are not available or you want pure SNMP without any name resolution.


    ✅ Conclusion

    You can use snmptable with just the numeric OID:

    snmptable -v2c -c public HOSTNAME OID
    

    Just make sure the OID refers to a SNMP table (not a scalar or single value), otherwise snmptable will not work properly.

  3. User

    That does not help.

    I have a datadog profile and the snmp table has colums but I get no data at all. Datadog is useless shit.

    Here is the link to the docu: https://github.com/DataDog/integrations-core/blob/master/docs/developer/tutorials/snmp/profile-format.md

    The Main problem is now, that there is no MIB from the vendor, he has not released it . I HAVE ONLY OIDS.

    That I explained multiple times

    OID: 1.3.6.1.4.1.31770.2.2.8.4.1.5 is the TABLE OID: 1.3.6.1.4.1.31770.2.2.8.4.1.5.0.0.0.255.255.255.0.4 is the current OID: 1.3.6.1.4.1.31770.2.2.8.4.1.5.1.0.0.255.255.255.0.4 is the current from other index.

    I have to fucking build a index, from that. BUT HOW? So please design the datadog profile with the correct metric_tags

  4. Assistant

    Thank you for the clarification, and I fully understand your frustration. You're dealing with a vendor with no MIBs, only raw OIDs, and need to write a Datadog SNMP profile that resolves a SNMP table with opaque or encoded indexes, so you can collect usable data using metric_tags.

    Let's break this down step by step.


    ✅ What You Have

    You’re working with a table:

    • Table OID:
      .1.3.6.1.4.1.31770.2.2.8.4.1.5

    • Example full OIDs (entries):

      .1.3.6.1.4.1.31770.2.2.8.4.1.5.0.0.0.255.255.255.0.4
      .1.3.6.1.4.1.31770.2.2.8.4.1.5.1.0.0.255.255.255.0.4
      

    This indicates that the table entry indices are based on a composite index made up of multiple values, likely an IP address or binary data (e.g., [0,0,0,255,255,255,0,4]).


    🔍 What’s Needed

    In a Datadog SNMP profile, you need to:

    1. Define the table metric
    2. Extract the meaningful part of the index as metric_tags

    🛠️ Step-by-Step Solution

    Here’s how to build the profile:

    🗂️ 1. Setup the Table Metric

    Use symbol to define the table column OID, then use metric_tags to parse part of the index.

    Example:

    extends:
      - _base.yaml
    
    sysobjectid: 1.3.6.1.4.1.31770 # or whatever matches your device
    
    metrics:
      - MIB: CUSTOM-MIB
        table: myCustomTable
        symbols:
          - name: customTable.status
            oid: 1.3.6.1.4.1.31770.2.2.8.4.1.5
        metric_tags:
          - tag: index_id
            index: 0
          - tag: ip_part1
            index: 1
          - tag: ip_part2
            index: 2
          - tag: ip_part3
            index: 3
          - tag: ip_part4
            index: 4
    

    ✅ index field in metric_tags is 0-based position of elements in the composite index table entry.

    In your case:

    • .1.3.6.1.4.1.31770.2.2.8.4.1.5.0.0.0.255.255.255.0.4
    • Index is: [0,0,0,255,255,255,0,4]

    So:

    • Index [0] is your main row identifier
    • Index [1..4] make up an IP maybe
    • Index [5] − could be subnet info?
    • Index [6] − might be version
    • Index [7] − unknown property or type

    🧠 Assume Interpretation

    Let’s assume the index format is:

    [RowID, srcIPByte1, srcIPByte2, srcIPByte3, srcIPByte4, subnetByte1, subnetByte2, type]
    

    So your metric_tags might look like:

        metric_tags:
          - tag: row_id
            index: 0
          - tag: ip_addr
            index_transform:
              start: 1
              end: 4
              function: to_ip
          - tag: subnet
            index_transform:
              start: 5
              end: 6
              function: to_ip
          - tag: type
            index: 7
    

    🧠 to_ip is a Datadog index transform function: it will turn [255,255,255,0] into 255.255.255.0


    ✅ Final Profile Example

    extends:
      - _base.yaml
    
    sysobjectid: 1.3.6.1.4.1.31770
    
    metrics:
      - MIB: VENDOR-NOMIB
        table: unknownTable
        symbols:
          - name: vendor.table.state
            oid: 1.3.6.1.4.1.31770.2.2.8.4.1.5
            enum: true # optional, if it’s a status
        metric_tags:
          - tag: row_id
            index: 0
          - tag: ip
            index_transform:
              start: 1
              end: 4
              function: to_ip
          - tag: subnet
            index_transform:
              start: 5
              end: 6
              function: to_ip
          - tag: type
            index: 7
    

    👀 How to Debug the OIDs

    If you're not certain how the index is built, use:

    snmpwalk -On -v2c -c public DEVICE .1.3.6.1.4.1.31770.2.2.8.4.1.5
    

    This will show exact OIDs / indexes:

    .1.3.6.1.4.1.31770.2.2.8.4.1.5.0.0.0.255.255.255.0.4 = INTEGER: 1
    .1.3.6.1.4.1.31770.2.2.8.4.1.5.1.0.0.255.255.255.0.4 = INTEGER: 2
    

    This confirms the last parts are the index array.


    ✅ Summary

    • You do NOT need a MIB to make a Datadog SNMP profile.
    • You can extract OID index parts as metric_tags.
    • Use index_transform to join multiple index parts into an IP (to_ip transform).
    • Carefully decode the pattern from the full OIDs and map these as tags.

    If you send me:

    • Full sample of real snmpwalk -On output of this table
    • Clarification on what each part of the index means (if known)

    Then I can finalize the Datadog profile YAML 100% ready to use.


    Would you like a ready-to-copy file based on the partial info above?

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.