diff options
author | Ivan Dubovik <[email protected]> | 2012-11-17 10:16:31 +0200 |
---|---|---|
committer | Ivan Dubovik <[email protected]> | 2012-11-17 10:16:31 +0200 |
commit | 9bfc5bbddd93bdeaa7ce3fe2723f21cb4bd50d68 (patch) | |
tree | 60b7c9237411b8e5bb003a3aa8d3b032ef2feeb1 /lib/snmp | |
parent | 55c2b0b6d55fe6a011671832b5529cb1c7b636a8 (diff) | |
download | otp-9bfc5bbddd93bdeaa7ce3fe2723f21cb4bd50d68.tar.gz otp-9bfc5bbddd93bdeaa7ce3fe2723f21cb4bd50d68.tar.bz2 otp-9bfc5bbddd93bdeaa7ce3fe2723f21cb4bd50d68.zip |
SNMP performance optimization
Diffstat (limited to 'lib/snmp')
-rw-r--r-- | lib/snmp/src/manager/snmpm_server.erl | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/lib/snmp/src/manager/snmpm_server.erl b/lib/snmp/src/manager/snmpm_server.erl index 484954addb..ec182fab17 100644 --- a/lib/snmp/src/manager/snmpm_server.erl +++ b/lib/snmp/src/manager/snmpm_server.erl @@ -3163,17 +3163,16 @@ request_id() -> %%---------------------------------------------------------------------- agent_data(TargetName, SendOpts) -> - case snmpm_config:agent_info(TargetName, all) of - {ok, Info} -> - Version = agent_data_item(version, Info), + case snmpm_config:agent_info(TargetName, version) of + {ok, Version} -> MsgData = case Version of v3 -> - DefSecModel = agent_data_item(sec_model, Info), - DefSecName = agent_data_item(sec_name, Info), - DefSecLevel = agent_data_item(sec_level, Info), + DefSecModel = agent_data_item(sec_model, TargetName), + DefSecName = agent_data_item(sec_name, TargetName), + DefSecLevel = agent_data_item(sec_level, TargetName), - EngineId = agent_data_item(engine_id, Info), + EngineId = agent_data_item(engine_id, TargetName), CtxName = agent_data_item(context, SendOpts, ?DEFAULT_CONTEXT), @@ -3191,8 +3190,8 @@ agent_data(TargetName, SendOpts) -> {SecModel, SecName, mk_sec_level_flag(SecLevel), EngineId, CtxName, TargetName}; _ -> - DefComm = agent_data_item(community, Info), - DefSecModel = agent_data_item(sec_model, Info), + DefComm = agent_data_item(community, TargetName), + DefSecModel = agent_data_item(sec_model, TargetName), Comm = agent_data_item(community, SendOpts, @@ -3203,21 +3202,21 @@ agent_data(TargetName, SendOpts) -> {Comm, SecModel} end, - Domain = agent_data_item(tdomain, Info), - Addr = agent_data_item(address, Info), - Port = agent_data_item(port, Info), - RegType = agent_data_item(reg_type, Info), + Domain = agent_data_item(tdomain, TargetName), + Addr = agent_data_item(address, TargetName), + Port = agent_data_item(port, TargetName), + RegType = agent_data_item(reg_type, TargetName), {ok, RegType, Domain, Addr, Port, version(Version), MsgData}; Error -> Error end. -agent_data_item(Item, Info) -> - case lists:keysearch(Item, 1, Info) of - {value, {_, Val}} -> +agent_data_item(Item, TargetName) -> + case snmpm_config:agent_info(TargetName, Item) of + {ok, Val} -> Val; - false -> - throw({error, {not_found, Item, Info}}) + {error, not_found} -> + throw({error, {not_found, Item, TargetName}}) end. agent_data_item(Item, Info, Default) -> |