Closed ivanbaj closed 5 months ago
Hi @ivanbaj!
For (1), yes you can call .done()
after an async operation fine, and responses will wait. For set operations, understand that the AgentX master will typically send your subagent three PDUs (TestSet, CommitSet, CleanupSet), and your handler function will be called once for each of these PDUs. The MIB change only takes effect after the second PDU (CommitSet). You may want to act only on the CommitSet message (check for mibRequest.operation === AgentXPduType.CommitSet
in your handler)
For (2), this is a bug, as the error status feature had not been implemented for the AgentX subagent. I've fixed this now and published in version 3.11.1 of the npm.
Thank you sooo much!
I have two questions abut this text:
handler (optional) - an optional callback function, which is called before the request to the MIB is made. This could update the MIB value(s) handled by this provider. If not given, the values are simply returned from (or set in) the MIB without any other processing. The callback function takes a MibRequest instance, which has a done() function. This must be called when finished processing the request. To signal an error, give a single error object in the form of {errorStatus: <status>}, where <status> is a value from ErrorStatus e.g. {errorStatus: snmp.ErrorStatus.GeneralError}. The MibRequest also has an oid field with the instance OID being operated on, and an operation field with the request type from snmp.PduType. If the MibRequest is for a SetRequest PDU, then variables setValue and setType contain the value and type received in the SetRequest varbind.
setting the errorStatus did nothing for me. What is the correct call for done() when there is an error?