[erlang-questions] SNMP Notify Target

Dick Oyen <>
Fri Jul 27 14:42:46 CEST 2012


The original mail is at http://erlang.org/pipermail/erlang-questions/2012-July/067981.html and is included in this reply.

Thanks for the advice on the {force_load, true} option in agent.config. It got the target address loaded.

I am continuing to investigate why the snmpa:send_notification/6 tries to get the target address from snmpa_target_cache (which contains only {state, invalid}) rather than a table that contains the target address (observer Table Viewer shows that table snmp_local_db1_shadow contains the target address and params).


From: DefacedVR [mailto:]
Sent: Friday, July 27, 2012 6:35 AM
To: 
Cc: Dick Oyen; ; Dick Oyen
Subject: Re: [erlang-questions] SNMP Notify Target



пятница, 27 июля 2012 г., 0:12:14 UTC+4 пользователь Dick Oyen написал:
>Unfortunately there were no responses to my original question, but I have been
 Can you provide link to the previous mail?
using debugger to step through Erlang snmp code to see what is happening.

The snmpa:send_notification/6 (indirectly) calls
snmpa_target_cache:get_targets/1, which returns [].

That seems to be because start:application(snmp) decided not to read
target_addr.conf or target_params.conf; the reason for its decision was that
snmp_target_mib:configure/2 finds that the target params table already exists.
It exists because start:application(snmp) had created, but not populated it.
QUESTION: Can someone tell me if there is some option and where I should use
the option to get the target_addr.conf to be read into the table?
There is option {force_load, true}   from http://www.erlang.org/doc/man/snmp_app.html

Next I experimented with forcing the file to be read into the table by running
the following from my agent erl command window:

    snmp_target_mib:reconfigure("snmp/agent/conf").

The effects of this showed up two tables in the Table Viewer of 'observer':

First, snmpa_target_cache contained a single record shown as a 2-tuple of column values:
{state, valid}

Second, snmp_local_db_shadow contained (among 26 rows) the following 4 rows
shown as 2-tuples of column values below:

{{snmpTargetAddrTable,first},    {undef,"testMIBMyFirstCoolTrap","testMIBMyFirstCoolTrap"}}

{{snmpTargetAddrTable,"testMIBMyFirstCoolTrap"},   {{"testMIBMyFirstCoolTrap",[1,3,6,1,2,1,100,1,1],[127,0,0,1,0,162],5000,3,"tag1","MyCoolTrapParams",3,1,"agent's engine",[],2048},first,first}}

{{snmpTargetParamsTable,first},   {undef,"MyCoolTrapParams","MyCoolTrapParams"}}

{{snmpTargetParamsTable,"MyCoolTrapParams"},   {{"MyCoolTrapParams",1,2,"initial",1,3,1},first,first}}

Wow, that's great, so I called snmpa:send_notification/6 again.

Unfortunately, snmpa_target_cache:get_targets/1 still returns [] because
ets:match(?CACHE, {{'_','$1'},'$2'} is looking at the table that contains only
{state,valid}.

Thus, the information from target_addr.conf and target_params.conf is in some
rows in a table, but not the table that the code seems to be looking at.
QUESTION: Can someone tell me what I am doing wrong?



>I am trying to get an SNMP example to send an SNPM trap, but am not succeeding. Any example would do. I am using the tutorial in

>http://www.trapexit.org/SNMP_Quick_Start because it is easiest for me to understand. The tutorial says to enter:

>

>snmpa:send_notification(snmp_master_agent, testMIBMyFirstCoolTrap, no_receiver, "DrpManager", "", []).

>

>It returns 'ok', but there is no evidence in Wireshark, the agent's Erlang SNMP log, or the SNMP manager that the trap was actually sent.

>

>Using the Erlang debugger, I step through 'snmpa' code and find that the list of notify targets is empty.

>

>Please tell me how snmpa should know the notify targets.

>

>Here is what I have tried:

>

>I tried changing the NotifyName argument from "DrpManager" to "", because "DrpManager" does not appear in anywhere in the conf or mib files and the doc says that empty string should cause it to send to all targets, but my debugger stepping shows that the list is still empty.

>

>I tried changing NotifyName to "MyFirstCoolTrap" because notify.conf contains {"MyFirstCoolTrap", "tag1", trap}, but the list is still empty.

>

>I wonder if the agent is supposed to know about the manager (before the send_notification/6) because of the manager's call to

>snmpm:sync_get("simple_user", "otp agent", [[erlNodeName,1]]), which does appear in the agent's SNMP log.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120727/a42e5b70/attachment.html>


More information about the erlang-questions mailing list