By default append the node name to the SNMP Engine ID.

git-svn-id: http://yate.null.ro/svn/yate/trunk@4979 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2012-03-26 13:51:48 +00:00
parent 67d8226f0b
commit a6b2939f57
2 changed files with 10 additions and 4 deletions

View File

@ -10,6 +10,7 @@
;thread priority for SNMP message processing. Defaults to normal.
;thread=normal
[snmp_v2]
; SNMPv2 configuration
@ -35,11 +36,14 @@ rc_community=
; Defaults to 4 (TEXT)
;engine_format=4
; information for generating the snmpEngineID. Must correspond to the format set (i.e. if engine_format=1, engine_info must be a IPv4 address)
; information for generating the snmpEngineID.
; Must correspond to the format set (i.e. if engine_format=1, engine_info must be a IPv4 address)
; If the format is TEXT (4) the default is the node name
; NOTE! IPv6 address must not use the IPv6 short format. Mandatory.
; NOTE! OCTETS format must be a hexified string
engine_info=
[traps]
; SNMP traps configuration
@ -68,6 +72,7 @@ community=
; the specified user will not allowed to interrogate this SNMP agent, it will only be used to send traps to the configured traps receiver
;trap_user=
;[userV3]
; Configure a section for a SNMPv3 user. The name of the user is the name of the section.
; To allow SNMPv3 interrogation, at least one SNMPv3 user must be configured

View File

@ -1542,13 +1542,14 @@ void SnmpAgent::initialize()
if (treeConf.null())
treeConf << Engine::sharedPath() << Engine::pathSeparator() <<
"data" << Engine::pathSeparator() << "snmp_mib.conf";
// in case of reinitialization, first destroy the previously allocated object
// in case of reinitialization, first destroy the previously allocated object
TelEngine::destruct(m_mibTree);
m_mibTree = new AsnMibTree(treeConf);
// get information needed for the computation of the agents' engine id (SNMPv3)
int engineFormat = s_cfg.getIntValue("snmp_v3","engine_format",TEXT);
String engineInfo = s_cfg.getValue("snmp_v3","engine_info","");
const char* defaultInfo = (TEXT == engineFormat) ? Engine::nodeName().c_str() : 0;
String engineInfo = s_cfg.getValue("snmp_v3","engine_info",defaultInfo);
m_engineId = genEngineId(engineFormat,engineInfo);
// read configuration for traps
@ -1571,7 +1572,7 @@ void SnmpAgent::initialize()
continue;
m_users.append(new SnmpUser(sec));
}
// load saved data
s_saveCfg = Engine::configFile("snmp_data");
s_saveCfg.load();