Which error code to choose?

2011-05-17 Thread Giuseppe Modugno
Dear list,

I'm developing an agent extension of Net-SNMP agent for an 
electronic piece of equipment.

I have three kinds of OID variables to implement in the agent.

1. Variables always present and retrievable (read-only or read-
write). These are simple to manage.

2. Variables that are meaningful only if an optional hardware is 
installed in the electronic equipment. In this case, if the optional 
hardware is not present, I can't associate a value for related 
variables. Should I return an error code to GET and SET requests? 
Which error codes? SNMP_ERR_GENERR?
In the first I tried SNMP_ERR_RESOURCEUNAVAILABLE, but I think it is 
for other purposes.

3. Variables that are related to hardware sub-sections in the 
machine. What should I return if this sub-section stop communicating 
with the agent (for a mulfunction)? Which error code to choose?

Thank for your help.

  Giuseppe

--
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


5.3.4.pre2 and 5.4.4.pre2 available for testing

2011-05-17 Thread Dave Shield
I've just realised that although the pre2 tarballs were released
a week or two back, I never send out an announcement of
the fact.  Sorry about that!

Versions 5.3.4.pre2 and 5.4.4.pre2 of the Net-SNMP suite
are now available from the sourceforge download servers.

We're hoping to move to Release Candidate phase fairly
quickly, so please do try these versions out, and let us
know of any problems.

Dave

--
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Extending MIBS and related Agent Functionality

2011-05-17 Thread Robert Story
On Mon, 16 May 2011 22:02:47 +0200 Ernst wrote:
EAK> On 16.05.2011 17:50, Robert Story wrote:
EAK>  >
EAK> RS> Yes, but having a working example of the code mean it would be 
EAK> easier to stuff
EAK> RS> into an extension mib.
EAK> 
EAK> Ahok, so please find patches to hr_swrun.c and HOST-RESOURCES-MIB 
EAK> attached to this mail.

Could you submit them to our patch tracker? I think it's at
http://www.net-snmp.org/patches/. Pacthes in emails tend to get lost.

EAK>  > I think adding a Net-SNMP extension table to the hrSWRun table is the 
EAK> way to
EAK>  > go. We just have to get everyone to agree on the semantics for the 
EAK> object.
EAK> 
EAK> Could you point me to an example? I looked throw the code, some examples 
EAK> and tutorials but some how do not get the link to a clear defintion of 
EAK> "Net-SNMP extension table" and/or its use.

Most of the HOST-RESOURCES mib is an example... An extension table is simply a
table that re-uses the index from another table... There are several tables in
that mib that use hrDeviceIndex.  So on the mib side, what we need is a
Net-SNMP table that uses hrSWRunIndex as the index. On the code size, we need
a way to get at the index for the hrSWRunTable. Hopefully Get_Next_HR_SWRun
and friends work from another source file...

--
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Which error code to choose?

2011-05-17 Thread Robert Story
On Tue, 17 May 2011 09:05:05 +0200 Giuseppe wrote:
GM> 2. Variables that are meaningful only if an optional hardware is 
GM> installed in the electronic equipment. In this case, if the optional 
GM> hardware is not present, I can't associate a value for related 
GM> variables. Should I return an error code to GET and SET requests? 
GM> Which error codes? SNMP_ERR_GENERR?
GM> In the first I tried SNMP_ERR_RESOURCEUNAVAILABLE, but I think it is 
GM> for other purposes.

For scalars, set the varbind to SNMP_NOSUCHOBJECT, eg

  netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);

For table objects, use SNMP_NOSUCHINSTANCE.

Make sure you do not return an error from the function.


GM> 3. Variables that are related to hardware sub-sections in the 
GM> machine. What should I return if this sub-section stop communicating 
GM> with the agent (for a mulfunction)? Which error code to choose?

SNMP_ERR_RESOURCEUNAVAILABLE.

--
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Which error code to choose?

2011-05-17 Thread Giuseppe Modugno
On 17 May 2011 at 11:04, Robert Story wrote:
> On Tue, 17 May 2011 09:05:05 +0200 Giuseppe wrote:
> GM> 2. Variables that are meaningful only if an optional hardware is 
> GM> installed in the electronic equipment. In this case, if the optional 
> GM> hardware is not present, I can't associate a value for related 
> GM> variables. Should I return an error code to GET and SET requests? 
> GM> Which error codes? SNMP_ERR_GENERR?
> GM> In the first I tried SNMP_ERR_RESOURCEUNAVAILABLE, but I think it is 
> GM> for other purposes.
> 
> For scalars, set the varbind to SNMP_NOSUCHOBJECT, eg
> 
>   netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
> 
> For table objects, use SNMP_NOSUCHINSTANCE.
> 
> Make sure you do not return an error from the function.

Now I understand.  The handler should returns always 
SNMP_ERR_NOERROR, but the variable should be marked with an error 
code with netsnmp_set_request_error().

Thank you for point me that.  I have tried returning the error from 
the handler and I had snmpwalk stopped at that OID.  Does 
netsnmp_set_request_error() solve the problem and let snmpwalk to 
cross the entire tree, even in presence of errors for some 
variables?


> GM> 3. Variables that are related to hardware sub-sections in the 
> GM> machine. What should I return if this sub-section stop communicating 
> GM> with the agent (for a mulfunction)? Which error code to choose?
> 
> SNMP_ERR_RESOURCEUNAVAILABLE.

Should I use netsnmp_set_request_error() as above, or should I 
return this error from the handler function?

--
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders