On 29 May 2012 12:26, Dave Shield <[email protected]> wrote: > On 29 May 2012 11:32, Holger Klaas <[email protected]> wrote: >> I am trying to implement an SNMP table which can monitor several >> inputs. The table looks like this: >> >> Column1: inputNumber (table index: 1,2,3 ...) >> Column2: inputStatus (disabled, signalLoss, signalPresent) >> Column3: inputFlowId (unsigned32) >> Column4: inputFlowBitrate (integer32) >> >> When the inputStatus is disabled or signalLoss, the columns for >> inputFlowBitrate and inputFlowId don't really make sense. For bitrate >> I could just return 0. But what about the Flow ID (A 32 bit unsiged >> integer where all possible values could be used as flow ID)? I can >> think of 2 solutions: >> 1. return 'no such instance' for those columns >> 2. Just return anything and expect the manager to check inputStatus >> first before processing the remaining columns > > The two most natural approaches would be to either return > noSuchInstance or a special "invalid" value > (typically 0 or -1, or possibly 2^32-1) > > >> How is this handled best? I am not sure if solution 1 is allowed in >> SNMP. I.e. is it allowd to have table rows where some columns are >> present and others not? > > Yes - that's perfectly valid. > (Although it might confuse some client applications). > > >> Are there any other ways how this could be handled? > > I think my inclination would be to return a designated value, > and document this behaviour within the MIB description. > Preferably a value that is unlikely to occur - even if it's > potentially possible. The client application can still check > the value of inputStatus to distinguish between the two cases. > > It's the difference between > > GET status, flowID > if ( status !OK ) > return invalid > use flowID > > and > > GET flowID > if ( flowID == 2^32-1) // or whatever > GET status > if ( status !OK) > return invalid > use flowID > > Though either approach would work fine. > > Dave
Hi Dave, Thank you very much for the quick response. I will go for your inclination and always return a value, as I wouldn't want to confuse any clients with 'NoSuchInstance'. Thanks again, Holger ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
