Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to use snmp to query a directory listing. I have added the exec line to snmp.conf ("exec list /bin/ls /pathtodirectory") and restarted the service. When I perform an snmp walk for the exec OID I can see the string returned by the exec, but it is only the first line of the ls output. Is it possible to list the entire directory as one string or return multiple strings?

share|improve this question
add comment

1 Answer 1

Yes. In fact if you check the man page for snmpd.conf you'll discover the extend directive:

extend [MIBOID] NAME PROG ARGS
works in a similar manner to the exec directive, but with a number of improvements. The MIB tables (nsExtendConfigTable etc) are indexed by the NAME token, so are unaffected by the order in which entries are read from the configuration files. There are two result tables - one (nsExtendOutput1Table) containing the exit status, the first line and full output (as a single string) for each extend entry, and the other (nsExtendOutput2Table) containing the complete output as a series of separate lines. If MIBOID is specified, then the configuration and result tables will be rooted at this point in the OID tree, but are otherwise structured in exactly the same way. This means that several separate extend directives can specify the same MIBOID root, without conflicting. The exit status and output is cached for each entry individually, and can be cleared (and the caching behaviour configured) using the nsCacheTable.

share|improve this answer
    
Extend is not defined under Solaris 10. It throws an error in the snmpd log when I try and use it. I thought I remember reading about being able to enable the module or something along those line sbut I cannot find it... –  user18832 Nov 10 '12 at 22:48
    
@user18832 Consider installing a more recent version of net-snmp... –  voretaq7 Nov 10 '12 at 22:54
add comment

Your Answer

 
discard

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.