码迷,mamicode.com
首页 > Windows程序 > 详细

HPE Gen9 使用 RESTful API 管理服务器

时间:2018-03-21 15:05:45      阅读:618      评论:0      收藏:0      [点我收藏+]

标签:REST API HPE GEN9

HPE 在Gen9服务器的iLO中加入了 RESTful API ,可以用来批量修改服务器设置。
HPE官方提供的 HPE RESTful Interface Tool (以下简称tool) http://www.hpe.com/info/resttool

演示使用的服务器为 HPE BL660c Gen9 (E5 V4 CPU)
有数百台服务器需要更改如下BIOS设置
System Configuration→BIOS/Platform Configuration(RBSU)→Power Management Options→Power Profile→Maximum Performance
System Configuration→BIOS/Platform Configuration(RBSU)→Power Management Options→Advanced Power Management Options→ Collaborative Power Control→ disabled
官方提供的tool登录慢效率低 iLO的REST API支持使用curl发送数据
查询当前BIOS设置
登录的用户需要 Administer User Accounts权限
返回的数据为JSON格式 可以用python -m json.tool处理
curl -s --insecure -u [username]:[password] -L https://[iLO IP]/rest/v1/Systems/1/Bios|python -m json.tool


{
    "AcpiRootBridgePxm": "Enabled", 
    "AcpiSlit": "Enabled", 
    "AdjSecPrefetch": "Enabled", 
    "AdminEmail": "", 
    "AdminName": "", 
    "AdminOtherInfo": "", 
    "AdminPassword": null, 
    "AdminPhone": "", 
    "AdvancedMemProtection": "AdvancedEcc", 
    "AsrStatus": "Disabled", 
    "AsrTimeoutMinutes": "10", 
    "AssetTagProtection": "Locked", 
    "AttributeRegistry": "HpBiosAttributeRegistryI38.1.1.52", 
    "AutoPowerOn": "AlwaysPowerOn", 
    "BootMode": "Uefi", 
    "BootOrderPolicy": "RetryIndefinitely", 
    "ChannelInterleaving": "Enabled", 
    "CollabPowerControl": "Enabled", 
    "ConsistentDevNaming": "LomsOnly", 
    "CustomPostMessage": "", 
    "DaylightSavingsTime": "Disabled", 
    "DcuIpPrefetcher": "Enabled", 
    "DcuStreamPrefetcher": "Enabled", 
    "Description": "This is the Platform/BIOS Configuration (RBSU) Current Settings", 
    "Dhcpv4": "Enabled", 
    "DynamicPowerResponse": "Fast", 
    "EmbSasEnable": "Enabled", 
    "EmbSata1Enable": "Enabled", 
    "EmbSata2Enable": "Enabled", 
    "EmbVideoConnection": "Auto", 
    "EmbeddedDiagnostics": "Enabled", 
    "EmbeddedDiagsMode": "Auto", 
    "EmbeddedSata": "Ahci", 
    "EmbeddedSerialPort": "Com2Irq3", 
    "EmbeddedUefiShell": "Enabled", 
    "EmbeddedUserPartition": "Disabled", 
    "EmsConsole": "Com1Irq4", 
    "EnergyPerfBias": "MaxPerf", 
    "EraseUserDefaults": "No", 
    "ExtendedAmbientTemp": "Disabled", 
    "ExtendedMemTest": "Disabled", 
    "F11BootMenu": "Enabled", 
    "FCScanPolicy": "CardConfig", 
    "FanFailPolicy": "Shutdown", 
    "FanInstallReq": "EnableMessaging", 
    "FlexLom1Enable": "Enabled", 
    "FlexLom2Enable": "Enabled", 
    "HwPrefetcher": "Enabled", 
    "IntelDmiLinkFreq": "Auto", 
    "IntelNicDmaChannels": "Enabled", 
    "IntelPerfMonitoring": "Disabled", 
    "IntelProcVtd": "Enabled", 
    "IntelQpiFreq": "Auto", 
    "IntelQpiPowerManagement": "Disabled", 
    "IntelligentProvisioning": "Enabled", 
    "InternalSDCardSlot": "Enabled", 
    "IoNonPostedPrefetching": "Enabled", 
    "Ipv4Address": "0.0.0.0", 
    "Ipv4Gateway": "0.0.0.0", 
    "Ipv4PrimaryDNS": "0.0.0.0", 
    "Ipv4SecondaryDNS": "0.0.0.0", 
    "Ipv4SubnetMask": "0.0.0.0", 
    "Ipv6Duid": "Auto", 
    "MaxMemBusFreqMHz": "Auto", 
    "MaxPcieSpeed": "MaxSupported", 
    "MemFastTraining": "Enabled", 
    "MinProcIdlePkgState": "NoState", 
    "MinProcIdlePower": "NoCStates", 
    "MixedPowerSupplyReporting": "Enabled", 
    "Modified": "2018-03-12T08:45:27+00:00", 
    "Name": "BIOS Current Settings", 
    "NetworkBootRetry": "Enabled", 
    "NicBoot1": "NetworkBoot", 
    "NicBoot10": "Disabled", 
    "NicBoot11": "Disabled", 
    "NicBoot12": "Disabled", 
    "NicBoot13": "Disabled", 
    "NicBoot14": "Disabled", 
    "NicBoot15": "Disabled", 
    "NicBoot16": "Disabled", 
    "NicBoot2": "Disabled", 
    "NicBoot3": "Disabled", 
    "NicBoot4": "Disabled", 
    "NicBoot5": "Disabled", 
    "NicBoot6": "Disabled", 
    "NicBoot7": "Disabled", 
    "NicBoot8": "Disabled", 
    "NicBoot9": "NetworkBoot", 
    "NmiDebugButton": "Enabled", 
    "NodeInterleaving": "Disabled", 
    "NumaGroupSizeOpt": "Clustered", 
    "OldAdminPassword": null, 
    "OldPowerOnPassword": null, 
    "PciBusPadding": "Enabled", 
    "PciSlot1Enable": "Enabled", 
    "PciSlot2Enable": "Enabled", 
    "PcieExpressEcrcSupport": "Disabled", 
    "PostF1Prompt": "Disabled", 
    "PowerButton": "Enabled", 
    "PowerOnLogo": "Enabled", 
    "PowerOnPassword": null, 
    "PowerProfile": "BalancedPowerPerf", 
    "PowerRegulator": "StaticHighPerf", 
    "PreBootNetwork": "Auto", 
    "ProcAes": "Enabled", 
    "ProcCoreDisable": 0, 
    "ProcHyperthreading": "Enabled", 
    "ProcNoExecute": "Enabled", 
    "ProcTurbo": "Enabled", 
    "ProcVirtualization": "Enabled", 
    "ProcX2Apic": "Enabled", 
    "ProductId": "Q1C54A", 
    "QpiBandwidthOpt": "Balanced", 
    "QpiSnoopConfig": "Standard", 
    "RemovableFlashBootSeq": "ExternalKeysFirst", 
    "RestoreDefaults": "No", 
    "RestoreManufacturingDefaults": "No", 
    "RomSelection": "CurrentRom", 
    "SataSecureErase": "Disabled", 
    "SaveUserDefaults": "No", 
    "SecureBootStatus": "Disabled", 
    "SerialConsoleBaudRate": "115200", 
    "SerialConsoleEmulation": "Vt100Plus", 
    "SerialConsolePort": "Auto", 
    "SerialNumber": "********", 
    "ServerAssetTag": "", 
    "ServerName": "", 
    "ServerOtherInfo": "", 
    "ServerPrimaryOs": "", 
    "ServiceEmail": "", 
    "ServiceName": "", 
    "ServiceOtherInfo": "", 
    "ServicePhone": "", 
    "SettingsResult": {
        "ETag": "877AAC20", 
        "Messages": [
            {
                "MessageArgs": [
                    "NicBoot4"
                ], 
                "MessageID": "Base.1.0:PropertyUnknown"
            }, 
            {
                "MessageArgs": [
                    "NicBoot8"
                ], 
                "MessageID": "Base.1.0:PropertyUnknown"
            }, 
            {
                "MessageArgs": [
                    "NicBoot15"
                ], 
                "MessageID": "Base.1.0:PropertyUnknown"
            }, 
            {
                "MessageArgs": [
                    "NicBoot3"
                ], 
                "MessageID": "Base.1.0:PropertyUnknown"
            }, 
            {
                "MessageArgs": [
                    "NicBoot5"
                ], 
                "MessageID": "Base.1.0:PropertyUnknown"
            }, 
            {
                "MessageArgs": [
                    "NicBoot16"
                ], 
                "MessageID": "Base.1.0:PropertyUnknown"
            }, 
            {
                "MessageArgs": [
                    "NicBoot14"
                ], 
                "MessageID": "Base.1.0:PropertyUnknown"
            }, 
            {
                "MessageArgs": [
                    "NicBoot12"
                ], 
                "MessageID": "Base.1.0:PropertyUnknown"
            }, 
            {
                "MessageArgs": [
                    "NicBoot11"
                ], 
                "MessageID": "Base.1.0:PropertyUnknown"
            }, 
            {
                "MessageArgs": [
                    "NicBoot13"
                ], 
                "MessageID": "Base.1.0:PropertyUnknown"
            }, 
            {
                "MessageArgs": [
                    "NicBoot6"
                ], 
                "MessageID": "Base.1.0:PropertyUnknown"
            }, 
            {
                "MessageArgs": [
                    "NicBoot7"
                ], 
                "MessageID": "Base.1.0:PropertyUnknown"
            }, 
            {
                "MessageArgs": [], 
                "MessageID": "Base.1.0:Success"
            }
        ], 
        "Time": "1987-03-12T08:41:55+00:00"
    }, 
    "Slot1NicBoot1": "NetworkBoot", 
    "Slot1NicBoot2": "Disabled", 
    "Slot1NicBoot3": "Disabled", 
    "Slot1NicBoot4": "Disabled", 
    "Sriov": "Enabled", 
    "ThermalConfig": "OptimalCooling", 
    "ThermalShutdown": "Enabled", 
    "TimeFormat": "Utc", 
    "TimeZone": "Utc0", 
    "TpmState": "NotPresent", 
    "TpmType": "NoTpm", 
    "Type": "HpBios.1.2.0", 
    "UefiOptimizedBoot": "Enabled", 
    "UefiPxeBoot": "Auto", 
    "UefiShellBootOrder": "Disabled", 
    "UefiShellStartup": "Disabled", 
    "UefiShellStartupLocation": "Auto", 
    "UefiShellStartupUrl": "", 
    "UrlBootFile": "", 
    "Usb3Mode": "Auto", 
    "UsbBoot": "Enabled", 
    "UsbControl": "UsbEnabled", 
    "UtilityLang": "English", 
    "VirtualInstallDisk": "Disabled", 
    "VirtualSerialPort": "Com1Irq4", 
    "VlanControl": "Disabled", 
    "VlanId": 0, 
    "VlanPriority": 0, 
    "WakeOnLan": "Disabled", 
    "links": {
        "BaseConfigs": {
            "href": "/rest/v1/systems/1/bios/BaseConfigs"
        }, 
        "Boot": {
            "href": "/rest/v1/systems/1/bios/Boot"
        }, 
        "Mappings": {
            "href": "/rest/v1/systems/1/bios/Mappings"
        }, 
        "Settings": {
            "href": "/rest/v1/systems/1/bios/Settings"
        }, 
        "iScsi": {
            "href": "/rest/v1/systems/1/bios/iScsi"
        }, 
        "self": {
            "href": "/rest/v1/systems/1/bios"
        }
    }
}

HPE Gen9 使用 RESTful API 管理服务器

标签:REST API HPE GEN9

原文地址:http://blog.51cto.com/gregdefanhua/2089399

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!