Pass-through control
"Hartog, T. (Tim)" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Dear Netsnmp users,
I'm trying to use the option pass-through control in netsnmp to create
some kind of SNMP proxy. For some reason though i can't get it to work.
I have 2 snmpd instances running, 1 on port 11161 (the Proxy) and one on
port 161, the snmp-agent from which i want the information.
the settings in the snmpd.conf for pass-control are:
pass .1.3 /bin/bash /snmptest/snmp_test
All the files have the proper permissions:
root@webserver1:/snmptest# ls -l
total 28
-rw-r--r-- 1 root root 0 2007-05-09 10:57 snmpcmd.log
-rw------- 1 root root 15491 2007-05-09 13:49 snmpdconf.conf
-rw------- 1 root root 200 2007-05-09 11:42 snmpd_forwarder.conf
-rw-r--r-- 1 root root 41 2007-05-09 10:57 snmp.log
-rwxr-xr-x 1 root root 990 2007-05-09 10:57 snmp_test
The snmp_test file contains the following code:
#!/bin/bash
touch /tmp/snmp.log
path="/usr/bin"
oid=$2
n_or_g=$1
community="public"
host_name="udp:localhost:161"
echo $oid $n_or_g >> /tmp/snmp.log
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
echo "The received snmp content: " $result_code
check_succeeded=$?
echo $check_succeeded >>/tmp/snmp.log
if [ "$check_succeeded" != "0" ] ; then
echo "And error occured." ;
exit 3;
fi
new_oid=`echo $result_code | cut -d ' ' -f 1`
type=`echo $result_code | cut -d ' ' -f 3 | cut -d ':' -f 1`
value=`echo $result_code | cut -d ' ' -f 4-`
echo $new_oid $type $value >>/tmp/snmp.log
if [ "$type" == "STRING" ] ;
then value=test;
fi
echo "Nieuwe OID: "$new_oid
echo "Type: "$type
echo "Waarde: "$value
exit 0
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.
Is there anyone who successfully uses the pass-through control option?
Or does anyone have ideas what i'm doing wrong?
thanks in advance
Best regards,
Tim
This e-mail and its contents are subject to the DISCLAIMER at http://www.tno.nl/disclaimer/email.html
-------------------------------------------------------------------------
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