<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Plain Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
p.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing
{mso-style-priority:1;
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.PlainTextChar
{mso-style-name:"Plain Text Char";
mso-style-priority:99;
mso-style-link:"Plain Text";
font-family:"Calibri","sans-serif";}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Unfortunately there were no responses to my original question, but I have been <o:p></o:p></p><p class=MsoNormal>using debugger to step through Erlang snmp code to see what is happening.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The snmpa:send_notification/6 (indirectly) calls <o:p></o:p></p><p class=MsoNormal>snmpa_target_cache:get_targets/1, which returns [].<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>That seems to be because start:application(snmp) decided not to read <o:p></o:p></p><p class=MsoNormal>target_addr.conf or target_params.conf; the reason for its decision was that <o:p></o:p></p><p class=MsoNormal>snmp_target_mib:configure/2 finds that the target params table already exists. <o:p></o:p></p><p class=MsoNormal>It exists because start:application(snmp) had created, but not populated it. <o:p></o:p></p><p class=MsoNormal>QUESTION: Can someone tell me if there is some option and where I should use <o:p></o:p></p><p class=MsoNormal>the option to get the target_addr.conf to be read into the table?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Next I experimented with forcing the file to be read into the table by running <o:p></o:p></p><p class=MsoNormal>the following from my agent erl command window:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> snmp_target_mib:reconfigure("snmp/agent/conf").<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The effects of this showed up two tables in the Table Viewer of 'observer':<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>First, snmpa_target_cache contained a single record shown as a 2-tuple of column values:<o:p></o:p></p><p class=MsoNormal>{state, valid}<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Second, snmp_local_db_shadow contained (among 26 rows) the following 4 rows <o:p></o:p></p><p class=MsoNormal>shown as 2-tuples of column values below:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>{{snmpTargetAddrTable,first}, {undef,"testMIBMyFirstCoolTrap","testMIBMyFirstCoolTrap"}}<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>{{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}}<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>{{snmpTargetParamsTable,first}, {undef,"MyCoolTrapParams","MyCoolTrapParams"}}<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>{{snmpTargetParamsTable,"MyCoolTrapParams"}, {{"MyCoolTrapParams",1,2,"initial",1,3,1},first,first}}<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Wow, that's great, so I called snmpa:send_notification/6 again.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Unfortunately, snmpa_target_cache:get_targets/1 still returns [] because <o:p></o:p></p><p class=MsoNormal>ets:match(?CACHE, {{'_','$1'},'$2'} is looking at the table that contains only <o:p></o:p></p><p class=MsoNormal>{state,valid}.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thus, the information from target_addr.conf and target_params.conf is in some <o:p></o:p></p><p class=MsoNormal>rows in a table, but not the table that the code seems to be looking at. <o:p></o:p></p><p class=MsoNormal>QUESTION: Can someone tell me what I am doing wrong?<o:p></o:p></p><p class=MsoNoSpacing><o:p> </o:p></p><p class=MsoNoSpacing>>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 <o:p></o:p></p><p class=MsoNoSpacing>><a href="http://www.trapexit.org/SNMP_Quick_Start">http://www.trapexit.org/SNMP_Quick_Start</a> because it is easiest for me to understand. The tutorial says to enter:<o:p></o:p></p><p class=MsoNoSpacing>><o:p> </o:p></p><p class=MsoNoSpacing>>snmpa:send_notification(snmp_master_agent, testMIBMyFirstCoolTrap, no_receiver, "DrpManager", "", []).<o:p></o:p></p><p class=MsoNoSpacing>><o:p> </o:p></p><p class=MsoNoSpacing>>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.<o:p></o:p></p><p class=MsoNoSpacing>><o:p> </o:p></p><p class=MsoNoSpacing>>Using the Erlang debugger, I step through 'snmpa' code and find that the list of notify targets is empty.<o:p></o:p></p><p class=MsoNoSpacing>><o:p> </o:p></p><p class=MsoNoSpacing>>Please tell me how snmpa should know the notify targets.<o:p></o:p></p><p class=MsoNoSpacing>><o:p> </o:p></p><p class=MsoNoSpacing>>Here is what I have tried:<o:p></o:p></p><p class=MsoNoSpacing>><o:p> </o:p></p><p class=MsoNoSpacing>>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.<o:p></o:p></p><p class=MsoNoSpacing>><o:p> </o:p></p><p class=MsoNoSpacing>>I tried changing NotifyName to "MyFirstCoolTrap" because notify.conf contains {"MyFirstCoolTrap", "tag1", trap}, but the list is still empty.<o:p></o:p></p><p class=MsoNoSpacing>><o:p> </o:p></p><p class=MsoNoSpacing>>I wonder if the agent is supposed to know about the manager (before the send_notification/6) because of the manager's call to<o:p></o:p></p><p class=MsoNoSpacing>>snmpm:sync_get("simple_user", "otp agent", [[erlNodeName,1]]), which does appear in the agent's SNMP log.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>