[AGENT++] nonVolatile entries in usmUserTable
Frank Fock
fock at agentpp.com
Fri Dec 3 00:08:45 CET 2004
Hi Dave,
I could not reproduce the problem apart from the fact that
the default AGENT++Win32 master agent does not save
its contents by default when it is stopped.
If you want to add this feature you should change the code
snippet in the ServiceWorker method in agentx_pp_master.cpp
as follows below.
Does the persistent storage work with a USM user created
through SNMP calls? If that's the case, you probably call
the wrong addNewRow method.
Best regards,
Frank
Request* req;
int lastRunStatus = MasterAgentXMibWin32::runStatus;
while (MasterAgentXMibWin32::runStatus) {
if ((mib->service) && (lastRunStatus !=
MasterAgentXMibWin32::runStatus)) {
switch (MasterAgentXMibWin32::runStatus) {
case 1:
mib->trapPoller->pause();
mib->set_service_status(SERVICE_PAUSED);
while (!mib->get_thread_pool()->is_idle()) {
Sleep(10);
}
mib->save_all();
break;
case 2:
mib->trapPoller->pause();
mib->set_service_status(SERVICE_RUNNING);
break;
}
lastRunStatus = MasterAgentXMibWin32::runStatus;
}
if (MasterAgentXMibWin32::runStatus == 2) {
req = reqList->receive(2);
if (req) {
mib->process_request(req);
}
else if ((reqList->size() == 0) &&
(mib->get_thread_pool()->is_idle())) {
mib->cleanup();
}
}
else if (MasterAgentXMibWin32::runStatus == 1) { // paused
Sleep(500);
}
}
Snmp::socket_cleanup();
mib->delete_thread_pool();
mib->save_all();
delete mib;
delete reqList;
delete agentx;
return 0;
Dave White | Networking wrote:
>I'm having problems with non-volatile entries in the usmUserTable. I want
>user entries to be persistent between restarts of the daemon that I'm running
>in a Windows environment. In my code startup, if the usmUserTable is empty
>during initialization, then I create some v3 user entries by calling
>UsmUserTable::addNewRow(). The first thing that I discovered was that I had
>to change the code in v3_mib.cpp which is hard-coded to volatile(2) (line
>#816 in v.3.5.21). I temporarily changed it to nonVolatile(3) for my
>testing. The first time through, my code creates some v3 users. Then I stop
>and restart the daemon. The second time through, usmUserTable is initialized
>with data previously saved to a persistence file. The second time through,
>however, the v3 user which worked correctly before could no longer access MIB
>objects after I restarted. It seems that I have to explicitly call
>addNewRow() at each startup to fully restore the user. This defeats the
>purpose of having a nonVolatile entry in the usmUserTable.
>
>Has anyone had experience with this?
>
>Are there reasons that the code is hard-coded to create volatile entries in
>the usmUserTable?
>
>Will a persistent entry in usmUserTable properly restore everything that is
>necessary to enable a v3 user to read and/or write MIB entries if someone
>were to add a nonVolatile entry into the usmUserTable via SNMP, restart the
>daemon, and attempt to use the v3 user name?
>
>Any help or suggestions are appreciated.
>
>Thanks,
>Dave
>
>_______________________________________________
>AGENTPP mailing list
>AGENTPP at agentpp.org
>http://agentpp.org/mailman/listinfo/agentpp
>
>
>
More information about the AGENTPP
mailing list