Re: Pass-through control

"Dave Shield" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On 09/05/07, Hartog, T. (Tim) <[email protected]> wrote:
> I'm trying to use the option pass-through control in netsnmp to create some
> kind of SNMP proxy.

Is there any reason to use the pass-through mechanism, rather than the "proxy"
directive which is intended for exactly this functionality?



> The snmp_test file contains the following code:
>
> #!/bin/bash

> if [ "$n_or_g" == "-g" ]; then
>         result_code=`$path/snmpget -O ne -v 1 -c $community $host_name $oid
> 2>/dev/null`
> else
>         result_code=`$path/snmpgetnext -O ne -v 1 -c $community $host_name
> $oid 2>/dev/null`
> fi

Ugh!  Why oh why do people *insist* on throwing away error messages?
You're a sysadmin - if something goes wrong, surely you want to know about it!
[Sorry - you pressed a button there]

> echo "The received snmp content: " $result_code

Shouldn't that output be directed to the log file?


> check_succeeded=$?
> echo $check_succeeded >>/tmp/snmp.log
> if [ "$check_succeeded" != "0" ] ; then
>         echo "And error occured." ;

and that?



> echo $new_oid $type $value >>/tmp/snmp.log

> echo "Nieuwe OID: "$new_oid
> echo "Type: "$type
> echo "Waarde: "$value

That is not the output format that the "pass" mechanism is expecting.
The extra tokens will confuse the master agent, and prevent this
script working as intended.
   Please re-read the snmpd.conf(5) description, and ensure that
the script output conforms to the format specified there.



> If i executed the snmp_test directly it works fine, but for some reason the
> pass-control function does not work at all. When i use an .1.3. oid on
> snmpget on localhost:11161 it should execute the script and get the data
> from the snmp-instance running on port 161. But for some reason i only get
> the results from the 11161 snmp instance.

Remember that the SNMP agent works on a "more-specific wins" model.
If you've got two registrations covering the same MIB object - one ("pass")
covering the whole of the subtree .1.3, and the other (internal) covering a
smaller portion of it - then the more specific (internal) registration will take
priority.
    I'd suggest that you run your tests with a more focussed target - preferably
one that's only implemented on the 161 agent.

Dave

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.