Discussion:
[PIC] Sending floating point values on SNMP.
Harold Hallikainen
2018-07-03 00:49:45 UTC
Permalink
From
https://stackoverflow.com/questions/2142265/what-is-a-good-way-to-show-a-floating-point-number-via-snmp
, it appears you can send fixed point non-integer values as INT32 with a
scaling factor to position the decimal point. I THINK the conversion from
the INT32 (say, divide by 1,000) to the fixed point non-integer is
specified in the MIB using TEXTUAL-CONVENTION and DISPLAY-HINT. Does
anyone have a sample MIB that does this?

Thanks!

Harold
--
FCC Rules Updated Daily at http://www.hallikainen.com
Not sent from an iPhone.
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Forrest Christian (List Account)
2018-07-03 04:34:42 UTC
Permalink
Happen to be working on writing a new MIB which does this right now.

The textual-convention is:

FixedDiv10 ::= TEXTUAL-CONVENTION

DISPLAY-HINT "d-1"

STATUS current

DESCRIPTION "Fixed Integer value with one decimal digit"

SYNTAX Integer32


Then you use it just like:


gnssAltitude OBJECT-TYPE

SYNTAX FixedDiv10

MAX-ACCESS read-only

STATUS current

DESCRIPTION "The altitude being reported by the gnss receiver"

::= { gnssReceiverEntry 5 }


I'm planning on adding a note to the description indicating that the raw
value needs to be divided by 10 if this isn't done automatically by the
customer's SNMP tools.


Note that the phrase "FixedDiv10" could be anything you want. I am still
considering whether or not this is the right phrase, since FixedDiv10 isn't
exactly right. FixedExp-1 isn't very clear to non-math types, etc.


I've seen implementations where they set a TEXTUAL-CONVENTION for each type
of data, i.e. TenthsOfVolts, which might make more sense.


-forrest

On Mon, Jul 2, 2018 at 6:49 PM, Harold Hallikainen <
Post by Harold Hallikainen
From
https://stackoverflow.com/questions/2142265/what-is-a-
good-way-to-show-a-floating-point-number-via-snmp
, it appears you can send fixed point non-integer values as INT32 with a
scaling factor to position the decimal point. I THINK the conversion from
the INT32 (say, divide by 1,000) to the fixed point non-integer is
specified in the MIB using TEXTUAL-CONVENTION and DISPLAY-HINT. Does
anyone have a sample MIB that does this?
Thanks!
Harold
--
FCC Rules Updated Daily at http://www.hallikainen.com
Not sent from an iPhone.
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
--
*Forrest Christian* *CEO**, PacketFlux Technologies, Inc.*
Tel: 406-449-3345 | Address: 3577 Countryside Road, Helena, MT 59602
***@imach.com | http://www.packetflux.com
<http://www.linkedin.com/in/fwchristian> <http://facebook.com/packetflux>
<http://twitter.com/@packetflux>
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Harold Hallikainen
2018-07-03 04:57:55 UTC
Permalink
THANKS! I'll give it a try.

Harold
Post by Forrest Christian (List Account)
Happen to be working on writing a new MIB which does this right now.
FixedDiv10 ::= TEXTUAL-CONVENTION
DISPLAY-HINT "d-1"
STATUS current
DESCRIPTION "Fixed Integer value with one decimal digit"
SYNTAX Integer32
gnssAltitude OBJECT-TYPE
SYNTAX FixedDiv10
MAX-ACCESS read-only
STATUS current
DESCRIPTION "The altitude being reported by the gnss receiver"
::= { gnssReceiverEntry 5 }
I'm planning on adding a note to the description indicating that the raw
value needs to be divided by 10 if this isn't done automatically by the
customer's SNMP tools.
Note that the phrase "FixedDiv10" could be anything you want. I am still
considering whether or not this is the right phrase, since FixedDiv10 isn't
exactly right. FixedExp-1 isn't very clear to non-math types, etc.
I've seen implementations where they set a TEXTUAL-CONVENTION for each type
of data, i.e. TenthsOfVolts, which might make more sense.
-forrest
On Mon, Jul 2, 2018 at 6:49 PM, Harold Hallikainen <
Post by Harold Hallikainen
From
https://stackoverflow.com/questions/2142265/what-is-a-
good-way-to-show-a-floating-point-number-via-snmp
, it appears you can send fixed point non-integer values as INT32 with a
scaling factor to position the decimal point. I THINK the conversion from
the INT32 (say, divide by 1,000) to the fixed point non-integer is
specified in the MIB using TEXTUAL-CONVENTION and DISPLAY-HINT. Does
anyone have a sample MIB that does this?
Thanks!
Harold
--
FCC Rules Updated Daily at http://www.hallikainen.com
Not sent from an iPhone.
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
--
*Forrest Christian* *CEO**, PacketFlux Technologies, Inc.*
Tel: 406-449-3345 | Address: 3577 Countryside Road, Helena, MT 59602
<http://www.linkedin.com/in/fwchristian> <http://facebook.com/packetflux>
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
--
FCC Rules Updated Daily at http://www.hallikainen.com
Not sent from an iPhone.
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Harold Hallikainen
2018-07-06 20:03:44 UTC
Permalink
THANKS for the info! This works great!

Harold
Post by Forrest Christian (List Account)
Happen to be working on writing a new MIB which does this right now.
FixedDiv10 ::= TEXTUAL-CONVENTION
DISPLAY-HINT "d-1"
STATUS current
DESCRIPTION "Fixed Integer value with one decimal digit"
SYNTAX Integer32
gnssAltitude OBJECT-TYPE
SYNTAX FixedDiv10
MAX-ACCESS read-only
STATUS current
DESCRIPTION "The altitude being reported by the gnss receiver"
::= { gnssReceiverEntry 5 }
I'm planning on adding a note to the description indicating that the raw
value needs to be divided by 10 if this isn't done automatically by the
customer's SNMP tools.
Note that the phrase "FixedDiv10" could be anything you want. I am still
considering whether or not this is the right phrase, since FixedDiv10 isn't
exactly right. FixedExp-1 isn't very clear to non-math types, etc.
I've seen implementations where they set a TEXTUAL-CONVENTION for each type
of data, i.e. TenthsOfVolts, which might make more sense.
-forrest
On Mon, Jul 2, 2018 at 6:49 PM, Harold Hallikainen <
Post by Harold Hallikainen
From
https://stackoverflow.com/questions/2142265/what-is-a-
good-way-to-show-a-floating-point-number-via-snmp
, it appears you can send fixed point non-integer values as INT32 with a
scaling factor to position the decimal point. I THINK the conversion from
the INT32 (say, divide by 1,000) to the fixed point non-integer is
specified in the MIB using TEXTUAL-CONVENTION and DISPLAY-HINT. Does
anyone have a sample MIB that does this?
Thanks!
Harold
--
FCC Rules Updated Daily at http://www.hallikainen.com
Not sent from an iPhone.
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
--
*Forrest Christian* *CEO**, PacketFlux Technologies, Inc.*
Tel: 406-449-3345 | Address: 3577 Countryside Road, Helena, MT 59602
<http://www.linkedin.com/in/fwchristian> <http://facebook.com/packetflux>
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
--
FCC Rules Updated Daily at http://www.hallikainen.com
Not sent from an iPhone.
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Loading...