[erlang-questions] SNMP Notify Target

Dick Oyen <>
Thu Jul 26 22:12:14 CEST 2012

Unfortunately there were no responses to my original question, but I have been
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?

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


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

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/20120726/aab0aad3/attachment.html>

More information about the erlang-questions mailing list