On Wed, 2005-06-15 at 03:49, flyeagers wrote:
> I'm a beginner in SNMP.And I follow the examples of NET-SNMP-5.2.1

If you're just starting out (rather than maintaining existing code),
we'd strongly suggest that you use the new "handler-based" MIB API
mechanism, rather than the old v4 REGISTER_MIB approach.

> I can get string of the target snmpd from remote host and I can
> also send a command to make target snmpd run a  command.
> Now I can use snmpget to get the string,but I can not set the string.

The command

        mib2c -c mib2c.scalar.conf  MY-MIB::cmdstr

should generate a suitable template structure for you,
including basic SET support.

> Once I run snmpset command in remote host, the target snmpd will
> terminate automatically.

That would probably indicate a coding error - possibly following
a NULL pointer without checking it first.

>  Who can tell the error in my codes and tell what does these
> mean such as RESERVE1,RESERVE2,UNDO,COMMIT,FREE,ACTION
> in write method?

Please read the file 'AGENT.txt' (which still covers the old v4
mechanism that you've been working with - but the multi-pass SET
processing is still used in the v5 APIs too).

>  And how can I run a command such as "ls -l" ?

        "run_shell_command"

> Here's the MIB:
> MY-MIB DEFINITIONS ::= 
> BEGIN
> 
> IMPORTS
>   enterprises    FROM RFC1155-SMI
>   OBJECT-TYPE    FROM RFC-1212  
>   DisplayString  FROM RFC1213-MIB;

You're missing the "MODULE-IDENTITY" definition.

Dave



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to