diff options
author | Erlang/OTP <[email protected]> | 2012-01-24 14:12:16 +0100 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2012-01-24 14:12:16 +0100 |
commit | b55c3d29a3d9efce2ce6548963809fc3b7ab8729 (patch) | |
tree | b27cf0f5797c58df0fc5acc5da37683e341e5199 /lib/snmp/src/agent/snmpa_supervisor.erl | |
parent | 7619b94a2c1098cbd176507b34d291806833a4b7 (diff) | |
parent | e447fc699d91456597cd38c0949dbc3872015e88 (diff) | |
download | otp-b55c3d29a3d9efce2ce6548963809fc3b7ab8729.tar.gz otp-b55c3d29a3d9efce2ce6548963809fc3b7ab8729.tar.bz2 otp-b55c3d29a3d9efce2ce6548963809fc3b7ab8729.zip |
Merge branch 'bmk/snmp/snmp4216_integration/r14' into maint-r14
* bmk/snmp/snmp4216_integration/r14:
[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). |