On 16/07/07, Ansa Ahammed wrote:
> Which data type can we use to represent floating-point nubers
> in Snmp .

The SNMP standard does not strictly include support for
non-integer numeric values. If you need to implement a
fractional value, there are three options:

a) Define the object as a fixed-point decimal value,
and use an INTEGER-based syntax (with an
implicit decimal point). For example, sysUpTime
is measured in "centiseconds", thus representing
a floating point value to two decimal places.

b) Use a String-based value to contain a printable version
of the value you wish to represent. The client application
would then need to parse this back into a floating point value.

c) Use the OPAQUE type to wrap the floating point value
in a form that can be transferred using SNMP. The client
library would then unwrap this to recover the original value.
This approach is used for the Net-SNMP syntax Float.
It works seamlessly for Net-SNMP-based applications, but
would typically not be recognised by any other SNMP toolkit.

See the MIB group UCD-SNMP-MIB::laTable for example of all
three of these approaches.


This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
Net-snmp-users mailing list
Please see the following page to unsubscribe or change other options: