コード例 #1
0
  @Test
  public void testFreeDiskSpaceSensor()
      throws InvalidMonitorContextException, MeasurementNotAvailableException, SigarException {
    MonitorContextBuilder builder = DefaultMonitorContext.builder();
    builder.addContext("fs_root", "/");
    builder.addContext("unit", "mb");
    sensor.setMonitorContext(builder.build());

    System.out.println(sensor.getMeasurement().getValue());
  }
コード例 #2
0
  @Test
  public void testWrongUnit()
      throws MeasurementNotAvailableException, InvalidMonitorContextException {
    MonitorContextBuilder builder = DefaultMonitorContext.builder();
    builder.addContext("unit", "foobar");
    sensor.setMonitorContext(builder.build());

    System.out.println(sensor.getMeasurement().getValue());
  }