snmp-mnesia Questions about MIB-Tables

Dietmar Admin Schaefer <>
Fri Dec 10 12:21:24 CET 2004


Hi !

I try to make a snmp "controller application"



I need some advices about the following problems:

My MIB contains a couple of (static) tables as well as  a few scalar 
variables.


I created mnesia tables - one for the scalar variables:




 case mnesia:create_table(fourd_mib_variables, [{snmp, [{key, integer}]},
                 {attributes, record_info(fields, fourd_mib_variables)},
                 {disc_copies, ?HR}]) of
         {atomic, ok}     -> io:format("table fourd_mib_variables could 
be created~n"),
                             ok;
         {aborted,Reason} -> io:format("creation of database 
fourd_mib_variables failed reason.~w~n",[Reason]),
                             Reason
       end,

 an one for every MIB-table:

case mnesia:create_table(criticalHrAProcessesList, [ 
                                                                        
  {attributes, record_info(fields,criticalHrAProcessesList )},
                                                                        
  {disc_copies, ?HR}]) of
        {atomic, ok}     -> io:format("table active_processes could be 
created~n"),
                            ok;
        {aborted,Reason2} -> io:format("creation of database 
criticalHrAProcessesList failed reason.~w~n",[Reason2]),
                                      Reason2
     end,


1. question :   is this a good idea ?


I can initialize the fourd_mib_variables table with no problems but it's 
not clear to me how to initialize the
 criticalHrAProcessesList table.


I tried to ask my agent without initialization and get the following 
error message:


 cmmc_4dp:start().                             starting the application


reading config file 'cmmc.config'
sendPort               = 1234
listenPort             = 1235
sysContact             = "dietmar.schaefer"
mibActive              = 1
location               = "Frankfurt"
mibVersion             = "1.2 (19.10.2004)"
activeSwVersion        = "1.4 (17.10.2004)"
inactiveSwVersion      = "1.3 (15.6.2004)"
maxCriticalProcesses   = 10
maxNonriticalProcesses = 8
maxInternalInterfaces  = 3
maxExternalInterfaces  = 3
maxApproachClients     = 10
maxCenterClients       = 30
sendport = 1234
listenport = 1235
initialisiere CMMC-Datenbank
success writing mnesia
success writing mnesia
CMMC-Datenbank initialisiert !
could not start snmp reason: {already_started,snmp}
ok
()22> Src = 2

asking the agent:

snmpwalk -m +FOURD-1-2-MIB -Ob -Cc  -v1 -c public wks2:1161 .enterprises



Mnesia(): <0.529.0> ({registered_name,snmp_master_agent}) 
val(mnesia_gvar, {criticalHrAProcessesList,{index,snmp}}) -> {badarg,
                                                                                   
[{ets,
                                                                                    
lookup_element,
                                                                                    
[mnesia_gvar,
                                                                                   
{criticalHrAProcessesList,
                                                                                   
{index,
                                                                                    
snmp}},
                                                                                          

                                                                                                                                  
{mnesia_lib,
                                                                                                                                         
val,
                                                                                                                                         
1},
                                                                                                                                     
{mnesia_snmp_hook,
                                                                                                                                         
get_next_index,
                                                                                                                                         
2},
                                                                                                                                     
{rpc,
                                                                                                                                         
local_call,
                                                                                                                                         
3},
                                                                                                                                     
{mnesia,
                                                                                                                                         
do_dirty_rpc,
                                                                                                                                         
5},
                                                                                                                                     
{snmp_generic_mnesia,
                                                                                                                                         
table_next,
                                                                                                                                         
2},
                                                                                                                                     
{snmp_generic,
                                                                                                                                         
handle_table_next,
                                                                                                                                         
6},
                                                                                                                                     
{snmp_generic,
                                                                                                                                         
handle_table_next,
                                                                                                                                         
6},
                                                                                                                                     
{snmpa_agent,
                                                                                                                                         
get_next_values_all_rows,
                                                                                                                                         
6},
                                                                                                                                     
{snmpa_agent,
                                                                                                                                         
get_next_table,
                                                                                                                                         
4}]} {no_exists,
                                                                                                                                                  
{criticalHrAProcessesList,
                                                                                                                                                      
{index,
                                                                                                                                                          
snmp}}}

=ERROR REPORT==== 10-Dec-2004::12:15:23 ===
** User error: Invalid return value 
{'EXIT',{aborted,{badarg,[criticalHrAProcessesList,[]]}}} from 
{snmp_generic,table_func,[{criticalHrAProcessesList,mnesia}]} (get_next)







Can someone point me to the right direction ?


Many thanks in advance



Dietmar



More information about the erlang-questions mailing list