Class Sensor

java.lang.Object
org.metricshub.ipmi.client.Sensor

public final class Sensor extends Object
A sensor of the BMC, with its SDR record and its reading. A threshold sensor (a temperature, a voltage, a fan speed) has a reading() converted with the formula of its record and status() against its thresholds; a discrete sensor (a presence, a power supply state) has its asserted states(). A sensor whose reading the BMC did not give says why in problem().
  • Method Details

    • name

      public String name()
      Returns the name of the sensor, from the ID string of its record.
      Returns:
      the name
    • number

      public int number()
      Returns the sensor number, unique for the owner of the sensor.
      Returns:
      the sensor number, 0 to 255
    • type

      public SensorType type()
      Returns what the sensor measures or monitors.
      Returns:
      the sensor type
    • entity

      public EntityId entity()
      Returns the entity the sensor monitors.
      Returns:
      the entity
    • entityInstance

      public int entityInstance()
      Returns the instance of the entity the sensor monitors: 1 for the first processor, 2 for the second one.
      Returns:
      the entity instance, 0 to 255
    • unit

      public SensorUnit unit()
      Returns the unit of the reading and of the thresholds.
      Returns:
      the base unit
    • reading

      public OptionalDouble reading()
      Returns the reading of a threshold sensor, in its unit(), converted with the formula and the linearization of its record.
      Returns:
      the reading, or empty when the sensor has none: a discrete sensor, an unavailable reading (problem()), or a record without analog reading
    • rawReading

      public OptionalInt rawReading()
      Returns the reading byte as the BMC sent it, before any conversion.
      Returns:
      the raw reading, 0 to 255, or empty when the reading is unavailable (problem())
    • status

      public SensorStatus status()
      Returns the status of the sensor: for a threshold sensor, the worst threshold the reading is at or beyond; for a discrete sensor, SensorStatus.OK when it answers.
      Returns:
      the status, SensorStatus.UNAVAILABLE when the reading is unavailable (problem())
    • states

      public List<String> states()
      Returns the asserted states of a discrete sensor, in the wording of ipmiutil ("Present", "Device Absent", "Power Supply Failure detected"...; of ipmitool for the few states ipmiutil does not name), each once. The states of a threshold sensor are the thresholds its reading is at or beyond. For an OEM event/reading type, the single state is the hexadecimal state bytes.
      Returns:
      the states, empty when none is asserted, when the reading is unavailable, or when the library does not describe the asserted states (rawStates() still lists them)
    • rawStates

      public List<ReadingType> rawStates()
      Returns the asserted states of the sensor as the protocol core decodes them.
      Returns:
      the states, empty when none is asserted or when the reading is unavailable
    • lowerNonCritical

      public OptionalDouble lowerNonCritical()
      Returns the lower non-critical threshold, in the unit() of the sensor.
      Returns:
      the threshold, or empty when the sensor does not define it (a threshold of 0 is a threshold)
    • lowerCritical

      public OptionalDouble lowerCritical()
      Returns the lower critical threshold, in the unit() of the sensor.
      Returns:
      the threshold, or empty when the sensor does not define it
    • lowerNonRecoverable

      public OptionalDouble lowerNonRecoverable()
      Returns the lower non-recoverable threshold, in the unit() of the sensor.
      Returns:
      the threshold, or empty when the sensor does not define it
    • upperNonCritical

      public OptionalDouble upperNonCritical()
      Returns the upper non-critical threshold, in the unit() of the sensor.
      Returns:
      the threshold, or empty when the sensor does not define it
    • upperCritical

      public OptionalDouble upperCritical()
      Returns the upper critical threshold, in the unit() of the sensor.
      Returns:
      the threshold, or empty when the sensor does not define it
    • upperNonRecoverable

      public OptionalDouble upperNonRecoverable()
      Returns the upper non-recoverable threshold, in the unit() of the sensor.
      Returns:
      the threshold, or empty when the sensor does not define it
    • problem

      public Optional<String> problem()
      Returns why the sensor has no reading and no states.
      Returns:
      the problem: the BMC refused the reading (with its completion code), the reading is not valid yet, or scanning is disabled; empty when the sensor has a reading
    • record

      public SensorRecord record()
      Returns the SDR record of the sensor, as the protocol core decodes it: a FullSensorRecord for a threshold sensor, a CompactSensorRecord for a discrete one.
      Returns:
      the record
    • readingData

      public Optional<GetSensorReadingResponseData> readingData()
      Returns the reply of the BMC to Get Sensor Reading, as the protocol core decodes it.
      Returns:
      the reply, or empty when the BMC refused the reading
    • toString

      public String toString()
      Overrides:
      toString in class Object