Parsing SNMP Values

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ejlorson
Posts: 27
Joined: Thu Jul 27, 2017 6:55 am

Parsing SNMP Values

Post by ejlorson »

Brand new user evaluating Nagios XI. Running on CentOS 7 in AWS and testing monitoring appliances in our physical data center.

I have a physical appliances that puts several values in a single OID return and you cannot poll for the values individually.

The return results are in the following format:
VALUE1 Value1Name / VALUE2 Value2Name/ VALUE3 Value3Name

VALUE1 = integer
VALUE2 = Integer
VALUE3 = percent

How can I parse these values out of the return value in Nagios XI?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Parsing SNMP Values

Post by tgriep »

If you are using the check_snmp plugin, there is an option to separate the output on Multiple OID requests.
-D, --output-delimiter=STRING
Separates output on multiple OID requests
Try that and see if this is what you are looking for.
Be sure to check out our Knowledgebase for helpful articles and solutions!
ejlorson
Posts: 27
Joined: Thu Jul 27, 2017 6:55 am

Re: Parsing SNMP Values

Post by ejlorson »

Thanks. Unfortunately I tried that and it was not granular enough - I would still have to use Regex parse values out afterwards. It may work in some of my simpler cases, but the one I am working on now is a bit hairier.

I have figured out the Regex to apply to the query results that will pull the values out that I need. My question now evolves to: In Nagios how can I apply my Regex to the SNMP return values such that they can be used for alerting and historical metrics?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Parsing SNMP Values

Post by tgriep »

Can you post the command you are using and what the output of it running?
Be sure to check out our Knowledgebase for helpful articles and solutions!
ejlorson
Posts: 27
Joined: Thu Jul 27, 2017 6:55 am

Re: Parsing SNMP Values

Post by ejlorson »

The return I am getting is:
SNMP OK - "idle_time:7688310600 /system_time:38042110 / user_time:129321130/total avg cpu load:1.27% per 30s" |

I want to parse out the three NAME:VALUE pairs separated by the '/'.
(?<=\/)(.*?)(?=\/) pulls out system_time and user_time
(?<=")(.*?)(?=\/) pulls out only idle_time

Initially I was just trying to grab the values, but I think it would be better to pull the full NAME:VALUE pairs, which seems like a better solution, but a more complicated regex.

BUT....in thinking this through - is there a way to tell Nagios how to identify the NAME:VALUE pairs in polling results so it will automatically parse them out? That seems like a simpler solution.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Parsing SNMP Values

Post by dwhitfield »

What is the command you are running? Can you PM me your Profile? You can download it by going to Admin > System Config > System Profile and click the ***Download Profile*** button towards the top. If for whatever reason you *cannot* download the profile, please put the output of View System Info (5.3.4+, Show Profile if older) in the thread (that will at least get us some info). This will give us access to many of the logs we would otherwise ask for individually. If security is a concern, you can unzip the profile take out what you like, and then zip it up again. We may end up needing something you remove, but we can ask for that specifically.

After you PM the profile, please update this thread. Updating this thread is the only way for it to show back up on our dashboard.
ejlorson
Posts: 27
Joined: Thu Jul 27, 2017 6:55 am

Re: Parsing SNMP Values

Post by ejlorson »

I resolved this myself. I needed a wrapper to put the metrics in nagios format. You can lock this thread.
kyang

Re: Parsing SNMP Values

Post by kyang »

Glad you were able to solve this! We will be closing this topic as resolved!

If you have more questions, feel free to create another thread!

Thank you for using the Nagios Support Forum!
Locked