5.02021-11-21T21:50:41ZTemplatesHuawei OceanStor Rest-API v2Huawei OceanStor Rest-API v2## Overview
Python script for monitoring huawei storages
Tested on 5500 V5, 5600 V5, 2600 V3, 5500 V3, dorado 5000 V3, 18800 V3 and dorado 5000 V6
TemplatesBBU healthCommonControllerController healthDiskDiskDomainDisk healthDisk temperatureEnclosureEnclosure healthEthEth healthExpBoardExpBoard healthFANFAN healthFCFC healthget_data_from_scriptHealthINFOInterface ModuleInterface Module healthLUN CapacityLUN healthOtherPoolPSUPSU healthSASSAS healthStorageTier- get discoveryEXTERNALhuawei_get_state.py["--api_ip={HOST.IP}","--api_port={$API_PORT}","--api_user={$API_USER}","--api_password={$API_PASSWORD}","--storage_name={HOST.NAME}","--discovery"]1hget_data_from_scriptPOST
- get health stateEXTERNALhuawei_get_state.py["--api_ip={HOST.IP}","--api_port={$API_PORT}","--api_user={$API_USER}","--api_password={$API_PASSWORD}","--storage_name={HOST.NAME}","--status"]get_data_from_scriptPOST{count(2h,1,ge)}=40 or {count(2h,2,ge)}=40Error occurs on sending metricsHIGH{nodata(3600)}=1No data from storage in next 1 hourHIGH
BBUTRAPbackup_power01dHealth status of a BBU "{#LOCATION}"TRAPhealth.backup_power.[{#LOCATION}]01w90dBBU healthHuawei_HEALTH_STATUSPOST{min(43200)}=12 or {last()}=2 or {last()}=3 or {last()}=0BBU "{#LOCATION}" health status is {ITEM.VALUE}HIGHRunning status of a BBU "{#LOCATION}"TRAPrunning.backup_power.[{#LOCATION}]01w90dBBU healthHuawei_RUNNING_STATUSPOST{last()}=28 or {last()}=0BBU "{#LOCATION}" running status is {ITEM.VALUE}HIGHPOSTControllerTRAPcontroller01dHealth status of a Controller "{#LOCATION}"TRAPhealth.controller.[{#LOCATION}]01w90dController healthHuawei_HEALTH_STATUSPOST{last(0)}<>1Controller "{#LOCATION}" health status is {ITEM.VALUE}HIGHRunning status of a Controller "{#LOCATION}"TRAPrunning.controller.[{#LOCATION}]01w90dControllerHuawei_RUNNING_STATUSPOST{last(0)}<>27Controller "{#LOCATION}" running status is {ITEM.VALUE}HIGHPOSTDiskTRAPdisk01dHealth status of disk "{#LOCATION}"TRAPhealth.disk.[{#LOCATION}]01w90dDisk healthHuawei_HEALTH_STATUSPOST{last()}<>1Hard disk "{#LOCATION}" health status is {ITEM.VALUE}HIGHRunning status of disk "{#LOCATION}"TRAPrunning.disk.[{#LOCATION}]01w90dDiskHuawei_RUNNING_STATUSPOST{last()}<>27Hard disk "{#LOCATION}" running status is {ITEM.VALUE}HIGHPOSTDiskDomainTRAPdiskpool01dHealth status of a DiskDomain "{#NAME}"TRAPhealth.diskpool.[{#NAME}]01w90dDiskDomainHuawei_HEALTH_STATUSPOST{last()}=2DiskDomain "{#NAME}" health status is {ITEM.VALUE}DISASTERRunning status of a DiskDomain "{#NAME}"TRAPrunning.diskpool.[{#NAME}]01w90dDiskDomainHuawei_RUNNING_STATUSPOST{last()}=28DiskDomain "{#NAME}" running status is {ITEM.VALUE}DISASTERPOSTEnclosureTRAPenclosure01dHealth status of an enclosure "{#LOCATION}"TRAPhealth.enclosure.[{#LOCATION}]01w90dEnclosure healthHuawei_HEALTH_STATUSPOST{last()}<>1Enclosure "{#LOCATION}" health status is {ITEM.VALUE}HIGHRunning status of an enclosure "{#LOCATION}"TRAPrunning.enclosure.[{#LOCATION}]01w90dEnclosureHuawei_RUNNING_STATUSPOST{last()}<>27Enclosure "{#LOCATION}" running status is {ITEM.VALUE}HIGHPOSTPortEthTRAPeth_port01dHealth status of an Ethernet port "{#LOCATION}"TRAPhealth.eth_port.[{#LOCATION}]01w90dEth healthHuawei_HEALTH_STATUSPOST{last()}<>1PortEth "{#LOCATION}" health status is {ITEM.VALUE}HIGHRunning status of an Ethernet port "{#LOCATION}"TRAPrunning.eth_port.[{#LOCATION}]01w90dEthHuawei_RUNNING_STATUSPOST{last()}=11PortEth "{#LOCATION}" running status is {ITEM.VALUE}HIGHPOSTExpBoardTRAPexpboard01dHealth status of an expansion module "{#LOCATION}"TRAPhealth.expboard.[{#LOCATION}]01w90dExpBoard healthHuawei_HEALTH_STATUSPOST{last()}<>1ExpBoard "{#LOCATION}" health status is {ITEM.VALUE}HIGHRunning status of an expansion module "{#LOCATION}"TRAPrunning.expboard.[{#LOCATION}]01w90dExpBoardHuawei_RUNNING_STATUSPOST{last()}<>27 and {last()}<>2ExpBoard "{#LOCATION}" running status is {ITEM.VALUE}HIGHPOSTFANTRAPfan03dHealth Status of a FAN "{#LOCATION}"TRAPhealth.fan.[{#LOCATION}]01w90dFAN healthHuawei_HEALTH_STATUSPOST{last()}<>1FAN "{#LOCATION}" health status is {ITEM.VALUE}HIGHRunning status of a FAN "{#LOCATION}"TRAPrunning.fan.[{#LOCATION}]01w90dFANHuawei_RUNNING_STATUSPOST{last()}<>27 and {last()}<>2FAN "{#LOCATION}" running status is {ITEM.VALUE}HIGHPOSTPortFibreChannelTRAPfc_port01dHealth status of a Fibre Channel port "{#LOCATION}"TRAPhealth.fc_port.[{#LOCATION}]01w90dFC healthHuawei_HEALTH_STATUSPOST{last()}<>1PortFibreChannel "{#LOCATION}" health status is {ITEM.VALUE}HIGHRunning status of a Fibre Channel port "{#LOCATION}"TRAPrunning.fc_port.[{#LOCATION}]01w90dFCHuawei_RUNNING_STATUSPOST{last()}=11PortFibreChannel "{#LOCATION}" running status is {ITEM.VALUE}HIGHPOSTInterfaceModuleTRAPintf_module01dHealth status of an interface module "{#LOCATION}"TRAPhealth.intf_module.[{#LOCATION}]01w90dInterface Module healthHuawei_HEALTH_STATUSPOST{last()}<>1InterfaceModule "{#LOCATION}" health status is {ITEM.VALUE}HIGHRunning status of an interface module "{#LOCATION}"TRAPrunning.intf_module.[{#LOCATION}]01w90dInterface ModuleHuawei_RUNNING_STATUSPOST{last()}<>27 and {last()}<>2InterfaceModule "{#LOCATION}" running status is {ITEM.VALUE}HIGHPOSTLunTRAPlun01dHealth status of the LUN "{#NAME}"TRAPhealth.lun.[{#NAME}]01w60dLUN healthHuawei_HEALTH_STATUSPOST{last()}<>1LUN "{#NAME}" health status is {ITEM.VALUE}HIGHRunning status of the LUN "{#NAME}"TRAPrunning.lun.[{#NAME}]01w60dLUN healthHuawei_RUNNING_STATUSPOST{last()}<>27LUN "{#NAME}" running status is {ITEM.VALUE}HIGHPOSTPSUTRAPpower01dHealth Status of a PSU "{#LOCATION}"TRAPhealth.power.[{#LOCATION}]01w90dPSU healthHuawei_HEALTH_STATUSPOST{last()}<>1PSU "{#LOCATION}" health status is {ITEM.VALUE}HIGHRunning Status of a PSU "{#LOCATION}"TRAPrunning.power.[{#LOCATION}]01w90dPSUHuawei_RUNNING_STATUSPOST{last()}<>27PSU "{#LOCATION}" running status is {ITEM.VALUE}HIGHPOSTPortSASTRAPsas_port01dHealth status of a SAS port "{#LOCATION}"TRAPhealth.sas_port.[{#LOCATION}]01w90dSAS healthHuawei_HEALTH_STATUSPOST{last()}<>1PortSAS "{#LOCATION}" health status is {ITEM.VALUE}HIGHRunning status of a SAS port "{#LOCATION}"TRAPrunning.sas_port.[{#LOCATION}]01w90dSASHuawei_RUNNING_STATUSPOST{last()}=11PortSAS "{#LOCATION}" running status is {ITEM.VALUE}HIGHPOSTPoolTRAPstoragepool01dFree capacity of a Pool "{#NAME}"TRAPfree.capacity.storagepool.[{#NAME}]01w90dBPoolPOSTHealth status of a Pool "{#NAME}"TRAPhealth.storagepool.[{#NAME}]01w90dPoolHuawei_HEALTH_STATUSPOST{last()}=2Pool "{#NAME}" health status is {ITEM.VALUE}DISASTERRunning status of a Pool "{#NAME}"TRAPrunning.storagepool.[{#NAME}]01w90dPoolHuawei_RUNNING_STATUSPOST{last()}=28Pool "{#NAME}" running status is {ITEM.VALUE}DISASTERSubscribed capacity of a Pool "{#NAME}" in percentCALCULATEDsubscribed.capacity.percent.storagepool.[{#NAME}]3m1w90dFLOAT%(100*last("subscribed.capacity.storagepool.[{#NAME}]"))/last("total.capacity.storagepool.[{#NAME}]")PoolPOST{last()}>{$SUBSCRIBED_PERCENT:"{#NAME}"}Subscribed capacity on pool "{#NAME}" > {$SUBSCRIBED_PERCENT:"{#NAME}"}%HIGHSubscribed capacity of a Pool "{#NAME}"TRAPsubscribed.capacity.storagepool.[{#NAME}]01w90dBPoolPOSTTotal capacity of a Pool "{#NAME}"TRAPtotal.capacity.storagepool.[{#NAME}]01w90dBPoolPOSTUsed capacity of a Pool "{#NAME}" in percentCALCULATEDused.capacity.percent.storagepool.[{#NAME}]3mFLOAT%(100*last("used.capacity.storagepool.[{#NAME}]"))/last("total.capacity.storagepool.[{#NAME}]")PoolPOST{last()}>{$USED_PERCENT:"{#NAME}"}Used capacity on pool "{#NAME}" > {$USED_PERCENT:"{#NAME}"}%HIGHUsed capacity of a Pool "{#NAME}"TRAPused.capacity.storagepool.[{#NAME}]01w90dBPoolPOSTPOST{$API_PASSWORD}{$API_PORT}8088{$API_USER}{$SUBSCRIBED_PERCENT}91{$USED_PERCENT}91Huawei_HEALTH_STATUS0Unknown1Normal2Fault3Pre-fail4Partially broken5Degraded6Bad sectors found7Bit errors found8Consistent9Inconsistent10Busy11No input12Low battery13Single link fault14Invalid15Write protectHuawei_RUNNING_STATUS0Unknown1Normal2Running5sleep in high temperature10Link_up11Link_down12powering on13powered off14pre-copy16reconstruction27online28offline32balancing48charging49charging completed50discharging53initializing103power-on failed