diff options
author | Erlang/OTP <[email protected]> | 2012-01-25 15:21:09 +0100 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2012-01-25 15:21:09 +0100 |
commit | 61fa5c03369e9ae6de2b4ae24438c236df93d7cb (patch) | |
tree | 4968c9941f15d3562a74b8138ec7e8e9d3daadcc /lib/snmp/src/agent/snmpa_supervisor.erl | |
parent | a8af5a6bae97ddd7bfc2bcff2e701fa37f47640c (diff) | |
parent | 8d8d0a6529874345f3bb69349f573a75a73ea373 (diff) | |
download | otp-61fa5c03369e9ae6de2b4ae24438c236df93d7cb.tar.gz otp-61fa5c03369e9ae6de2b4ae24438c236df93d7cb.tar.bz2 otp-61fa5c03369e9ae6de2b4ae24438c236df93d7cb.zip |
Merge branch 'bmk/snmp/snmp4216_integration/r15' into maint-r15
* bmk/snmp/snmp4216_integration/r15:
[snmp] Releasse notes cleanup
[snmp/agent] Incorrect mib server cache gclimit update
[snmp] Updated doc and fixed wrequest create macros
[snmp] Be more verbose in the worker procs
[snmp] Add a more informative return value when the trap sending fails
[snmp] Fixed the mt_trap test-case
[snmp] Maximum number of varbinds in a Get-BULK response
[snmp] Correted the expect bug in the snmp test utility
[snmp] Mostly added some more verbosity stuff
Diffstat (limited to 'lib/snmp/src/agent/snmpa_supervisor.erl')
-rw-r--r-- | lib/snmp/src/agent/snmpa_supervisor.erl | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/lib/snmp/src/agent/snmpa_supervisor.erl b/lib/snmp/src/agent/snmpa_supervisor.erl index 5ef5914e18..7a9c214e0d 100644 --- a/lib/snmp/src/agent/snmpa_supervisor.erl +++ b/lib/snmp/src/agent/snmpa_supervisor.erl @@ -176,8 +176,8 @@ init([AgentType, Opts]) -> "~n AgentType: ~p" "~n Opts: ~p", [AgentType, Opts]), - put(sname, asup), - put(verbosity,get_verbosity(Opts)), + put(sname, asup), + put(verbosity, get_verbosity(Opts)), ?vlog("starting",[]), @@ -203,7 +203,12 @@ init([AgentType, Opts]) -> Vsns = get_opt(versions, Opts, [v1,v2,v3]), ?vdebug("[agent table] store versions: ~p",[Vsns]), ets:insert(snmp_agent_table, {versions, Vsns}), - + + %% -- Max number of VBs in a Get-BULK response -- + GbMaxVBs = get_gb_max_vbs(Opts), + ?vdebug("[agent table] Get-BULK max VBs: ~p", [GbMaxVBs]), + ets:insert(snmp_agent_table, {gb_max_vbs, GbMaxVBs}), + %% -- DB-directory -- DbDir = get_opt(db_dir, Opts), ?vdebug("[agent table] store db_dir: ~n ~p",[DbDir]), @@ -377,7 +382,8 @@ init([AgentType, Opts]) -> {versions, Vsns}, {net_if, NiOpts}, {mib_server, MibsOpts}, - {note_store, NsOpts}| + {note_store, NsOpts}, + {gb_max_vbs, GbMaxVBs} | get_opt(master_agent_options, Opts, [])], AgentSpec = @@ -542,6 +548,32 @@ get_verbosity(Opts) -> get_agent_type(Opts) -> get_opt(agent_type, Opts, master). + +%% We validate this option! This should really be done for all +%% options, but it is beyond the scope of this ticket, OTP-9700. + +get_gb_max_vbs(Opts) -> + Validate = + fun(GbMaxVBs) + when ((is_integer(GbMaxVBs) andalso (GbMaxVBs > 0)) orelse + (GbMaxVBs =:= infinity)) -> + ok; + (_) -> + error + end, + get_option(gb_max_vbs, ?DEFAULT_GB_MAX_VBS, Validate, Opts). + +get_option(Key, Default, Validate, Opts) + when is_list(Opts) andalso is_function(Validate) -> + Value = get_opt(Key, Opts, Default), + case Validate(Value) of + ok -> + Value; + error -> + exit({bad_option, Key, Value}) + end. + + get_opt(Key, Opts) -> snmp_misc:get_option(Key, Opts). |