Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am attempting to extend snmp to return number of a given process

This is the tool, saved at /usr/bin/

ps aux | awk '
BEGIN { c=0 }
/processname$/ { c=c+1 }
END { print $c }'

in my snmpd.conf, I have the following line:

extend . count_proc /usr/bin/

However, I am not able to retrieve the result of this command with this OID. When I run a snmp query for this OID, the result is:

Value: (Snmp No Such object)

If I run traverse the snmp tree, I finally see something, but its strange... "Next OID" is the name of my tool, and not numeric at all.

OID: .
Next OID: /usr/bin/
Value: 1

And finally, I will see the value I am expecting.

OID: .
Value: 13

But this is not the OID I expected to query to find the output. I will also find the output on several other OIDs.

Is this working as intended, or am I missing something important here?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Personally I use extend without OID, like:

extend count_proc /usr/bin/

The OID generated by snmp is simple, the result is:

The OID is :

Explanation : 10 : number of character in "count_proc" 99 : ASCII decimal value of 'c' 111 : ASCII decimal value of 'o' 117 : ASCII decimal value of 'u' 110 : ASCII decimal value of 'n' 116 : ASCII decimal value of 't' 95 : ASCII decimal value of '_' 112 : ASCII decimal value of 'p' 114 : ASCII decimal value of 'r' 111 : ASCII decimal value of 'o' 99 : ASCII decimal value of 'c'

So you can easily retrieve the OID programatically.

share|improve this answer

Probably This link can help you in "extend" naming convention

share|improve this answer
Thanks, but if I understand the NET-SNMP-EXTEND-MIB correctly, the OID given will dynamically assigned, and I have to programatically find it. This scenario seems to be covered in… – Dog eat cat world Jun 11 '14 at 16:09

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.