Re: SET
David Artus <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <CADqtbvCSQBKL1zxj8iML49nzd7f2y_znaynKvP041XYxQaLb2Q@mail.gmail.com> |
Thank you. I'll be returning to this problem in a week or two and that will help me. On Thu, Jul 12, 2018 at 12:13 PM, Robert Story <[email protected]> wrote: > On Fri, 1 Jun 2018 14:19:30 +0100 David wrote: > DA> My first goal is just to process setting a simple scalar value, > DA> but eventually I will want to look at row creation so I'd like > DA> to understand the bigger picture. > DA> > DA> The example handler > DA> <http://search.cpan.org/~hardaker/NetSNMP-agent-5.0401/ > agent.pm#Sub-agent_example> > DA> shows > DA> process a SET_ACTION request, but it doesn't indicate what if, > DA> anything I am required to do. > DA> > DA> } elsif ($request_info->getMode() == MODE_SET_ACTION) { > DA> # ... (or use the value) > DA> $value = $request->getValue(); > DA> } > DA> > DA> First, processing relating to the value. I guess that I do > DA> whatever the value means (eg. adjust a setting in the system > DA> that the MIB represents) and perhaps adjust any cached values > DA> in my agent. I'm not clear whether I also need to call > DA> request->setValue() or whether a subsequent GET just picks up > DA> the new state. > > No need to call request->setValue since you can't change the value > returned in the request and your internal value should have just > been set. > > DA> Then the other aspect is to return something to my caller. > DA> Studying the C code examples it looks like maybe all I need to > DA> do is call request->setError() if there's a problem, and > DA> possibly setDelegated() if there is deferred work. Seem like I > DA> then see the remaining SET stages occur until we reach Commit. > > Yep. This simple example doesn't cover all of set processing. There > is a state diagram here: > > http://www.net-snmp.org/tutorial/tutorial-5/toolkit/ > mib_module/set-actions.jpg > > And a more complete description of the various states here: > > http://net-snmp.sourceforge.net/wiki/index.php/Agent_ > Modes#Set_processing > > > Robert > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Net-snmp-users mailing list [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users