• VMware之主机数据获取


    前面写了存储器,群集的数据获取,现在还有主机与具体VM机的数据未写出来。现在先写出主机概要数据吧。

    //前面的代码我就不写了。因为大致一样
     for (ManagedEntity managedEntity : esxs) {
    HostSystem hs=(HostSystem) managedEntity;
    
    ////////////
                            HostHardwareInfo hwi=hs.getHardware();
                            HostListSummary hsr=hs.getSummary();
                            HostStorageSystem hd=hs.getHostStorageSystem();
                            HostSnmpSystem hif=hs.getHostSnmpSystem();
                              HostHealthStatusSystem pf=hs.getHealthStatusSystem();
                            
                            //
                            /*主机信息的获取
                            System.out.println("cpu uuid:"+hsr.getHardware().uuid);
                            
                            System.out.println("cpu :"+hsr.getHardware().cpuMhz);
                            
                            System.out.println("overallMemoryUsage:已消耗的内存"+hsr.getQuickStats().overallMemoryUsage);
                            System.out.println("distributedMemoryFairness:"+hsr.getQuickStats().distributedMemoryFairness);
                            System.out.println("overallCpuUsage:"+hsr.getQuickStats().overallCpuUsage);
                            System.out.println("distributedMemoryFairness:"+hsr.getQuickStats().distributedCpuFairness);
                            System.out.println("处理器插槽 :"+hsr.getHardware().numCpuPkgs);
                            System.out.println(    "CPU核心:"+hsr.getHardware().numCpuCores/2);
                            System.out.println("逻辑处理器 :"+hsr.getHardware().numCpuThreads);
                            System.out.println("memorySize :"+hsr.getHardware().memorySize);
                            System.out.println("vendor :"+hsr.getHardware().vendor);
                            System.out.println("cpuModel :"+hsr.getHardware().cpuModel);
                            System.out.println("identifierValue :"+hsr.getHardware().otherIdentifyingInfo[0].identifierType);
                            System.out.println("hsr.getHost().type :"+hsr.getHost().type);
                            System.out.println("hsr.getHost().val:"+hsr.getHost().val);*/
                            
                            long hz=hwi.cpuInfo.hz;
                            long e9 = 1000000000;
    //cpu获取的数值需要转换
    double hzd = new java.math.BigDecimal(((double) hz) / e9).setScale(2, java.math.BigDecimal.ROUND_HALF_UP) .doubleValue(); //主机信息 System.out.println("----"); System.out.println("1 主机信息:"+hs.getName()); System.out.println("2:"+String.valueOf(hzd)+"GHZ"); System.out.println("3:连接人信息:"+hs.getServerConnection().getUsername()); System.out.println("4:"+hs.getServerConnection().getSessionStr()); System.out.println("5:"+hs.getServerConnection().getServiceInstance().getAboutInfo().name); System.out.println("6:"+hs.getServerConnection().getServiceInstance().getAlarmManager()); System.out.println("7:"+hs.getServerConnection().getServiceInstance().getAboutInfo()); System.out.println("8:当前世界"+hs.getServerConnection().getServiceInstance().currentTime().getTime()); System.out.println("9:"+hs.getServerConnection().getServiceInstance().getCustomFieldsManager().getField()); System.out.println("容量 :"+hsr.getHardware().memorySize/1024/1024); System.out.println("11:"+hs.getCustomValue()); System.out.println("12:"+hs.getCapability().maxHostRunningVms); System.out.println("==========="); System.out.println("13:"+hs.getAvailableField()[0].name); System.out.println("15:"+hs.getAvailableField()[0].managedObjectType); System.out.println("16:"+hs.getAvailableField()[0].type); System.out.println("==========="); System.out.println("17:"+hs.getAvailableField()[1].name); System.out.println("18:"+hs.getAvailableField()[1].managedObjectType); System.out.println("19:"+hs.getAvailableField()[1].type); System.out.println("15:"+hs.getCapability()); }
  • 相关阅读:
    将表单序列化类型的数据转化成对象的处理(允许对象中包含对象)
    placeholder的兼容处理(jQuery下)
    滚动条滚动到页面底部继续加载的处理实例
    html/css基础篇——html代码编写过程中的几个警惕点
    多iframe使用tab标签方式添加、删除、切换的处理实例
    iframe的内容增高或缩减时设置其iframe的高度的处理方案
    IE9父容器overflow:auto时,子容器状态更改导致滚动条下出现额外空间的问题探讨
    C语言基本类型之long long int
    VIM使用技巧总结
    Ineedle驱动方式dpdk测试性能
  • 原文地址:https://www.cnblogs.com/jimw/p/4463398.html
Copyright © 2020-2023  润新知