Frage

I am writing a MIB and a SNMP agent. I seem to be confused by an apparent conflict between DISPLAY-HINT and UNITS. Is it better for a NMS to have a DISPLAY-HINT, or knowledge of the UNITS?

The background for this question is as follows: One object in the MIB is mPowerVoltage:

FixedDiv10 ::= TEXTUAL-CONVENTION
    DISPLAY-HINT "d-1"
    STATUS       current
    DESCRIPTION  "Fixed point, one decimal"
    SYNTAX       Integer32

mPowerVoltage OBJECT-TYPE
    SYNTAX       FixedDiv10
    UNITS        "V/10"
    MAX-ACCESS   read-only
    STATUS       current
    DESCRIPTION "Power Voltage in desiVolts"
    ::= { mPowerEntry 2 }  -- an entry in a table with integer index

Actual transfer "on the wire" of the value I understand, for instance 10.8 V is transferred as 108 in an Integer32. And this is my motivation to set UNITS as "V/10" and describe the object as Power Voltage in desiVolts. However, when I use snmpget I get:

snmpget  -c public -v 1 -m -MY-MIB 192.168.1.3  mPowerVoltage.1
MY-MIB::mPowerVoltage.1 = INTEGER: 10.8 V/10

which is indeed what I specified, but is clearly wrong.

But I can hardly change the UNITS to "V"? Hence the question, should I remove the DISPLAY-HINT, or should I remove the UNITS?

Baard

War es hilfreich?

Lösung

As I understand it, they're two diferent things, so neither takes precidence.

DISPLAY-HINT tells the caller how to place the decimal point - so in your example it prints out an "on-the-wire" value of 108 as 10.8.

UNITS is just a bit of text that gets appended after the number, exactly as you typed it. In this case you should definitely change the units to "V" because you've told the caller to display the number in V by dividing it by 10.

It does seem a bit inconsistent that one is part of the textual convention, while the other is part of the object definition, however.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top