On 28/01/2008, Jordi Moles Blanco <[EMAIL PROTECTED]> wrote: > I would like to do some thing as easy as this:
> in my snmpd.conf > pass .1.2.3.4.5.6.7.8.9.10 /root/myperl.pl > then in this myperl.pl > something as simple as..... > echo "77"; > and finally from the computer that gets all the data... > snmget -v2c -c .... and so on.... You've got three conflicting requirements here. *Either* the snmpd.conf directive can be simple *or* the script can be simple *or* the client-side command can be simple. You might be able to combine two of these, but not all three. Fundamentally, something has to integrate the arbitrary data (in this case, an integer) into the fairly rigidly defined structure of SNMP. The "pass" script is designed for implementing a set of particular MIB objects - a full OID subtree. This means that it has to handle both GET and GETNEXT requests, and return not just the value but also the corresponding OID and type information. Manfred has already explained something of this. But essentially, the "pass" directive sacrifices simplicity in the script, in favour of simplicitly in the client-side. Alternatively, you could use the "exec" or "extend" directives to run the script as it currently stands. The snmpd.conf here would look very similar: extend .1.2.3.4.5.6.7.8.9.10 my77 /root/perl.pl But the output of this script would then be merged into a standardized MIB structure - see NET-SNMP-EXTEND-MIB for details. So the "snmpget" command would need a little more work to determine the exact OID to request. Either approach would work - but neither is quite as simple as you're looking for. You basically need to decide whether it's more important to have a very simple script (and you're prepared to use a more complex request) - in which case go for "extend". Alternatively, if you need the client-side to look as simple as possible, then you're going to have to do a bit more work on the script itself, in order to use the "pass" mechanism properly. Dave ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users