[erlang-questions] SNMP Development Toolkit

Artem Teslenko ates@REDACTED
Tue Mar 3 08:34:27 CET 2015


Hello,

Try this:

-module(snmp_test).

-compile(export_all).

start() ->
     snmpm:start(),
     snmpm:register_user(?MODULE, snmpm_user_default, undefined).

t() ->
     Opts = [
         {engine_id, "test"},
         {community, "public"},
         {version, v2},
         {address, {127,0,0,1}}
     ],
     ok = snmpm:register_agent(?MODULE, "test123", Opts),
     Reply = snmpm:sync_get(?MODULE, "test123", [[1,3,6,1,2,1,1,1,0]]),
     ok = snmpm:unregister_agent(?MODULE, "test123"),
     Reply.

$ erlc snmp_test.erl
$ erl
Erlang/OTP 17 [erts-6.3] [source] [64-bit] [smp:8:8] [async-threads:10] 
[hipe] [kernel-poll:false]

Eshell V6.3  (abort with ^G)
1> snmp_test:start().
ok
2> snmp_test:t().
{ok,{noError,0,
              [{varbind,[1,3,6,1,2,1,1,1,0],
                        'OCTET STRING',
                        "Linux ates-desktop 3.13.0-46-generic #76-Ubuntu 
SMP Thu Feb 26 18:52:13 UTC 2015 x86_64",
                        1}]},
     4993}
3> snmp_test:t().
{ok,{noError,0,
              [{varbind,[1,3,6,1,2,1,1,1,0],
                        'OCTET STRING',
                        "Linux ates-desktop 3.13.0-46-generic #76-Ubuntu 
SMP Thu Feb 26 18:52:13 UTC 2015 x86_64",
                        1}]},
     4999}


On 03/03/2015 01:00 AM, Frederic Bonfanti wrote:
> Hi,
>
> I have been playing around with snmp but this giving me a hard time...
>
> here is the error I get:
>
>     > snmp_ex2_simple_standard_test:start({192,168,1,1}).
>     snmpm:snmpm:mk_target_name(snmpUDPDomain, {{192,168,1,1},161},
>     [{community, "public"}]) -> "192.168.1.1:161-v1".
>
>     Command  1 (get-next [1,1]): error
>        {command_failed,not_found}
>     ...
>
>
> SNMP works fine from both Mac OS X / snmpget and remote agent 
> perspectives... Only erlang SNMP toolkit refuses to operate properly.
>
> Any hint appreciated
>
> +F
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150303/f93e5c7d/attachment.htm>


More information about the erlang-questions mailing list