Getting Data In

Dynamic SNMP OID - Convert ASCII number to Text Value


Let me start by admitting there are likely a half dozen better ways to ingest the data but I don't have access to change that, thus I must learn how to manipulate what I have.

Goal: Take a dynamic set of ASCII numbers delimited by a "." and convert that to letters or punctuation and remove the delimiter.

Issue: I can isolate the sequence but have yet to find a method to convert the decimal number to ASCII character. My best lead thus far is find a way to convert the number to base16 and then use the SPLUNK function for URL decode.


If you are familiar with the MIB from JUNOS for jnxJSNatSrcNumSessions you are aware of the OID value is part standard and part dynamic based on the POOL NAME and IP structure. Structured as such "<#i>.<#x>.<#y>.<#z>.".

Fictionalized Data from _raw

SNMPv2-SMI::enterprises."2636." = "100"
SNMPv2-SMI::enterprises."2636." = "95"
SNMPv2-SMI::enterprises."2636." = "1250"
SNMPv2-SMI::enterprises."2636." = "1000"

What I want is to be able to pull a table like the following:
Pool-num, Pool-name, Pool-ip, Sessions
1, xyz,, 100
1, xyz,, 95
2, ab-c,, 1250
2, ab-c,, 1000

Any suggestions on how to take the isolated portion of the OID and convert each to a HEX value and then run URL decode? or is there a simpler way to accomplish what I want?

0 Karma

Ultra Champion
| makeresults
| eval _raw="SNMPv2-SMI::enterprises \"2636.\" = \"100\"
    SNMPv2-SMI::enterprises.\"2636.\" = \"95\"
    SNMPv2-SMI::enterprises.\"2636.\" = \"1250\"
    SNMPv2-SMI::enterprises.\"2636.\" = \"1000\""
| makemv delim="
" _raw
| stats count by _raw
| rex "\"2636\.3\.39\.1\.7\.1\.1\.4\.1\.6\.(?<Pool_num>\d+)\.(?<Pool_name>[\d\.]+)\.(?<Pool_ip>\d+\.\d+\.\d+\.\d)(?:\"\s=\s\")(?<Sessions>\d+)\""
| eval Pool_name=split(Pool_name,".")
| mvexpand Pool_name
| eval decode_pool=printf("%c",Pool_name)
| stats list(decode_pool) as Pool_name by _raw Pool_ip Pool_num Sessions
| eval Pool_name=mvjoin(Pool_name,"")
| table Pool_num Pool_ip Pool_name Sessions
| sort Pool_num Pool_ip

Convert ASCII code to strings is useful using printf("%c")

but I don't know the opposite.

0 Karma
Get Updates on the Splunk Community!

Routing Data to Different Splunk Indexes in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. The OpenTelemetry project is the second largest ...

Getting Started with AIOps: Event Correlation Basics and Alert Storm Detection in ...

Getting Started with AIOps:Event Correlation Basics and Alert Storm Detection in Splunk IT Service ...

Register to Attend BSides SPL 2022 - It's all Happening October 18!

Join like-minded individuals for technical sessions on everything Splunk!  This is a community-led and run ...