Hi Asim, If you are using OCTECT String to represent float values, your mib should have this object defined as OCTECT String. Aren't you using same MIB at both Manager and Agent side? You can use displayString also by importing it from RFC1213 in your mib. Any restrictions in using displayStrings?
Amber -----Original Message----- From: Asim Zaka [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 09, 2005 8:22 PM To: Dave Shield; Amber Gupta (WT01 - Voice & Next Generation Networks) Cc: [email protected] Subject: Re: Floating values Hi Amber and Dave, 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 I working on is converting the float value into a string and returning it in the unsigned char* buffer as OCTET String. I would have to change the MIB variable type to OCTET-STRING both at the manager and the agent side, right? thanks for the time and help. Asim. Quoting Dave Shield <[EMAIL PROTECTED]>: > On Wed, 2005-11-09 at 10:56 +0200, Asim Zaka wrote: > > What data type should I use in MIB definition and in the var_ function if I > want > > to return negative decimal values like -1.2? > > There is no standard support for non-integer numeric values in SNMP. > You have three basic choices: > > - for fixed-point values, use an integer value with an implicit > decimal point. For example, TimeTicks would represent 1.2s > using the value 120. > > - the Net-SNMP suite supports the type NET-SNMP-TC::Float (and > Double), as used in UCD-SNMP-MIB::laLoadFloat. > But this will typically only work with Net-SNMP agent and tools. > Very few other SNMP toolkits understand this type. > > - use a printable string - e.g. "-1.2" and parse this at the > receiving end. > > Dave > Regards, Asim Pervez Zaka. ------------------------------------------------------- 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
