gpt4 book ai didi

com.sdg.cmdb.service.ZabbixHistoryService.queryFreeDiskSpaceOnSys()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 22:43:31 26 4
gpt4 key购买 nike

本文整理了Java中com.sdg.cmdb.service.ZabbixHistoryService.queryFreeDiskSpaceOnSys()方法的一些代码示例,展示了ZabbixHistoryService.queryFreeDiskSpaceOnSys()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZabbixHistoryService.queryFreeDiskSpaceOnSys()方法的具体详情如下:
包路径:com.sdg.cmdb.service.ZabbixHistoryService
类名称:ZabbixHistoryService
方法名:queryFreeDiskSpaceOnSys

ZabbixHistoryService.queryFreeDiskSpaceOnSys介绍

[英]百分比
[中]百分比

代码示例

代码示例来源:origin: ixrjog/opsCloud

private float acqDiskSysRate(ServerDO serverDO) {
  // diskRate
  try {
    String freeDiskOnSys = zabbixHistoryService.acqResultValue(zabbixHistoryService.queryFreeDiskSpaceOnSys(serverDO, 1));
    float usedDiskOnSys = -1;
    if (freeDiskOnSys != null) {
      usedDiskOnSys = 100 - Float.parseFloat(freeDiskOnSys);
      BigDecimal b = new BigDecimal(usedDiskOnSys);
      usedDiskOnSys = b.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
    }
    return usedDiskOnSys;
  } catch (Exception e) {
    logger.error("计算磁盘使用率错误", e);
    return -1;
  }
}

代码示例来源:origin: ixrjog/opsCloud

@Test
public void test() {
  ServerDO s1 = serverDao.getServerInfoById(752);
  ServerDO outway2 = serverDao.getServerInfoById(108);
  ServerDO serverDO = s1;
  System.err.println(s1);
  long sysDiskRate = 0;
  String freeDiskOnSys = zabbixHistoryService.acqResultValue(zabbixHistoryService.queryFreeDiskSpaceOnSys(serverDO, 1));
  System.err.println("freeDiskOnSys:" + freeDiskOnSys);
  String freeDiskOnData = zabbixHistoryService.acqResultValue(zabbixHistoryService.queryFreeDiskSpaceOnData(serverDO, 1));
  System.err.println("freeDiskOnData:" + freeDiskOnData);
  //sysDiskRate = Long.parseLong(usedDiskSpaceOnSys) * 100 / Long.parseLong(totalDiskSpaceOnSys);
  //String usedDiskSpaceOnData = zabbixHistoryService.acqResultValue(zabbixHistoryService.queryUsedDiskSpaceOnData(serverDO, 1));
  //String totalDiskSpaceOnData = zabbixHistoryService.acqResultValue(zabbixHistoryService.queryTotalDiskSpaceOnData(serverDO, 1));
  //long dataDiskRate = Long.parseLong(usedDiskSpaceOnData) * 100 / Long.parseLong(totalDiskSpaceOnData);
  //System.err.println("sysDiskRate:" + sysDiskRate);
  //System.err.println("dataDiskRate:" + dataDiskRate);
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com