HI
I tried many years ago to add floating point as a base type to
the SNMP protocol. However, this was not successful.
If you really need a floating point type, then best choice
is to use a displayable string representation (which
uses OCTET STRING for the base type). I would suggest that
you define a textual convention that describes the values
for the pointing float including plus and negative infinity,
and "not a number".
With this approach, you should be able to retrieve (and modify)
floating point numbers from/to SNMP agents. However, existing
management apps will not know that the values are floating
point and treat the values as strings. But you can still create
custom management apps that understanding the values, and
you should also be able to export/import the values into other
programs (such as spread sheet apps like Excel), and
manipulate the values.
Regards,
/david t. perkins
Post by Dave ShieldPost by Asim ZakaMy snmp agent uses net-snmp's read function var_xyz and returns temperature
readings to the remote snmp manager. The values can be from a range of -200 to
+ 300 depending on the sensors being used. a typical value could be "-1.2"
degree celcius.
What degree of accuracy does your sensor work to?
If this only needs one decimal place, then you could use a (signed)
INTEGER value, running from -2000 to +3000
Your typical value would then be reported as -12
Two decimal places could be handled using a range -20000 to +30000
(with your typical value being reported as -120). This could
be used for anything up to six decimal places, within the 32-bit
limits of SNMP integers.
The MIB syntax is capable of representing this quite happily.
But you would need to choose the level of accuracy to work with
in advance, and stick to it.
Post by Asim Zaka- What I working on is converting the float value into a string and
returning it in the unsigned char* buffer as OCTET String.
That would certainly work, yes.
Post by Asim ZakaI would have to change the MIB variable type to OCTET-STRING both
at the manager and the agent side, right?
Correct.
The two sides must work with the same MIB definitions.
Otherwise they're going to get hopelessly confused!
Dave
-------------------------------------------------------
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Net-snmp-coders mailing list
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders