On Wed, 2005-11-09 at 16:52 +0200, Asim Zaka wrote:
> My 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.


> - 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.

>  I 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


-------------------------------------------------------
SF.Net email is sponsored by:
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to