Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm running snmpwalk on Linux and saving the output to a file using

snmpwalk -v 2c -c  public 192.168.129.122:17225  1.3.6.1.4.1.2.1.1.1 >> SNMPWALK_SS

If the value of one parameter is saved to a file with

SNMPv2-SMI::enterprises.2.1.1.1.82.0 = Gauge32: 0

then the name of this value is 82=82,SNMP_PAL_ACTIVE_SESSION,0,1

I want to save the snmpwalk value for a service at each of a list of times that would be read from a file. My final outcome would be like this:

Mon Feb 25 11:35:02 IST 2013
SNMP_PAL_ACTIVE_SESSION : 10

Is there any tool to achieve this task?

share|improve this question

migrated from stackoverflow.com Feb 25 '13 at 10:24

This question came from our site for professional and enthusiast programmers.

1 Answer 1

I doubt there is a tool already which does this, but you could write it yourself in python or perl pretty easily. I didn't quite understand your question, did you want to count the number of occurances of SNMP_PAL_ACTIVE_SESSION? Or do you need to do something more complicated like add up the values? Expand your example and explain the logic in English.

This is some bash to get you started

#!/bin/bash
snmpwalk -v 2c -c  public 192.168.129.122:17225  1.3.6.1.4.1.2.1.1 > /tmp/snmpwalk.out
COUNT=`grep -c SNMP_PAL_ACTIVE_SESSION /tmp/snmpwalk.out`
date >> ~/snmp.sessions.log
echo "SNMP_PAL_ACTIVE_SESSION : $COUNT" >> ~/snmp.sessions.log
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.