[erlang-questions] SNMP app questions: ?StorageType_volatile, Mnesia storage in general

Martin Bjorklund mbj@REDACTED
Fri Mar 16 08:58:57 CET 2007


Scott Lystig Fritchie <fritchie@REDACTED> wrote:
> Hi, I've been playing quite a bit with the OTP SNMP app.  It's quite a
> nifty pice of work.  But I'm still (uncomfortably) a blind man patting
> the elephant, trying to discover its shape.  So perhaps my questions
> are silly, my apologies in advance.
> 
> 1. I've been using Unbrowse 1.5(*) to test my SNMP v3 agent
>    application.
> 
>     a. Create a group with Unbrowse
>     b. Stop the SNMP agent application
>     c. Start the SNMP agent application
> 
> ... but after the restart, my new group is gone.  If I capture the
> packet SNMP SET datagram, I see that my client is requesting
> StorageType...
> 
> Hm, I don't really grok how to decode these things ... I have an
> annotated "wireshark" output below (see the "SLF" marks) ... it looks
> like the Unbrowse client is *not* sending anything for the
> "vacmAccessStorageType" attribute.
> 
> But diving into the guts of snmpa_vacm.erl, when the agent restarts,
> it reads the contents of {db_dir}/snmpa_vacm.db, finds the entry for
> my new group, but then ignores it because it's a volatile type,
> ?'StorageType_volatile'.
> 
> Is this a feature?  Perhaps the Unbrowse app is silly/broken for not
> specifying a value for "vacmAccessStorageType", but this behavior
> really is confusing.  It doesn't appear to be configurable, so I may
> have to hack code to change it.

The agent is supposed to use the DEFVAL in the MIB if the manager
doesn't set the value.  The DEFVAL in this case is 'nonVolatile', so
it should be kept by the agent.

Looking at the code in snmp_view_based_acm_mib.erl, it turns out that
the function mk_row/1 contains the bug:

mk_row(Cols) -> 
    ch_row(Cols, {noinit, "", "", "", ?'StorageType_volatile', noinit}).
                                      ^^^^^^^^^^^^^^^^^^^^^^^

should be ?'StorageType_nonVolatile'


> 2. Why does the SNMP app use local dets storage so frequently (with no
>    config option to use Mnesia?  And why does the snmpa_vacm table use
>    ets:tab2file() instead of Mnesia or event dets?

The simple answer is that this app was written before Mnesia.  It
should really be modified so that it is simple(r) to use any other db
module, not just mnesia.  When I have used it in Real Products, I have
always modified the code to fit into whatever db we have had.  I
haven't done this generic b/c it would require a larger rewrite.


/martin



More information about the erlang-questions mailing list