Child pages
  • How to migrate from AGENT++ 4.2.x (or older) to 4.3.0 (or newer) to be able to use multiple agents in a single process?

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagecpp
titleAGENT++ agent intialisation (+new/-old)
	Snmpx snmp(status, inaddr);
-	mib = new Mib(persistentObjectsPath);
+	mib = new Mib(persistentObjectsPath, path(bootCounterFile));
-	reqList = new RequestList();
+	reqList = new RequestList(mib);
	reqList->set_snmp(&snmp);
	mib->set_request_list(reqList);

    v3MP *v3mp = new v3MP(engineId, snmpEngineBoots, stat);
+   snmp.set_mpv3(v3mp);

-	mib.add(new snmp_community_mib());
+	mib.add(new snmp_community_mib(&mib));

-	mib.add(new agentpp_config_mib());
+	mib.add(new agentpp_config_mib(&mib));

-	mib.add(new notification_log_mib());
+	mib.add(new notification_log_mib(&mib));

+   snmpCommunityEntry* communityEntry = snmpCommunityEntry::get_instance(mib);
+   if (communityEntry) {
    	OctetStr co("public");
-		MibTableRow* row = snmpCommunityEntry::instance->add_row(Oidx::from_string(co, FALSE));
+   	MibTableRow* row = communityEntry->add_row(Oidx::from_string(co, FALSE));
        OctetStr tag("v1v2cPermittedManagers");
-		snmpCommunityEntry::instance->set_row(row, co, co,
+       communityEntry->set_row(row, co, co, reqList->get_v3mp()->get_local_engine_id(),"", tag, 3, 1);
+   }

-	UsmUserTable *uut = new UsmUserTable();
+   v3MP* v3mp = mib.get_request_list()->get_v3mp();
+	UsmUserTable *uut = new UsmUserTable(v3mp);
 	// add non persistent USM statistics
-	mib.add(new UsmStats());
+	mib.add(new UsmStats(v3mp));
 	// add the USM MIB - usm_mib MibGroup is used to
 	// make user added entries persistent
 	mib.add(new usm_mib(uut));
 	// add non persistent SNMPv3 engine object
-	mib.add(new V3SnmpEngine());
-	mib.add(new MPDGroup());
+	mib.add(new V3SnmpEngine(v3mp));
+	mib.add(new MPDGroup(v3mp));

...