山特UPS电量信息采集环境配置
硬件需求
- 支持智能卡插口的山特UPS
- 山特NMC网络管理卡
安装与配置NMC卡
NMC 是一种介于UPS和网络的设备,它可以从UPS获得状态信息并且发出指令。NMC支持两种协议-简易网络管理协议(SNMP)和超文件传输协议(HTTP)以供使用者进入。通过SNMP的网络管理站(NMS)和网页浏览器,用户可以获得UPS的状态信息、发出指令至UPS并且通过网络设定NMC。下图为NMC卡:
安装配置参考官方文档:
NMC卡使用手册
其中,主要是配置好NMC卡的网络(将NMC卡加入到当前局域网)
UPS电量信息采集
NMC支持通过SNMP协议获取UPS状态信息,所以我们通过SNMP协议采集UPS的电量信息。
NMC MIB文件下载地址:https://santakblobstorage.blob.core.chinacloudapi.cn/picture/MIB.zip,其中RFC1628.MIB为各UPS的通用MIB文件。
根据RFC1628.MIB,查找到电池信息相关的oid如下:
名称 | oid | 描述 |
---|---|---|
upsBatteryStatus | .1.3.6.1.2.1.33.1.2.1.0 | The indication of the capacity remaining in the UPS system’s batteries. A value of batteryNormal indicates that the remaining run-time is greater than upsConfigLowBattTime. A value of batteryLow indicates that the remaining battery run-time is less than or equal to upsConfigLowBattTime. A value of batteryDepleted indicates that the UPS will be unable to sustain the present load when and if the utility power is lost (including the possibility that the utility power is mandatoryly absent and the UPS is unable to sustain the output). |
upsSecondsOnBattery | .1.3.6.1.2.1.33.1.2.2.0 | If the unit is on battery power, the elapsed time since the UPS last switched to battery power, or the time since the network management subsystem was last restarted, whichever is less. Zero shall be returned if the unit is not on battery power. |
upsEstimatedMinutesRemaining | .1.3.6.1.2.1.33.1.2.3.0 | An estimate of the time to battery charge depletion under the present load conditions if the utility power is off and remains off, or if it were to be lost and remain off. |
upsEstimatedChargeRemaining | .1.3.6.1.2.1.33.1.2.4.0 | An estimate of the battery charge remaining expressed as a percent of full charge. |
upsBatteryVoltage | .1.3.6.1.2.1.33.1.2.5.0 | The magnitude of the present battery voltage. |
upsBatterymandatory | .1.3.6.1.2.1.33.1.2.6.0 | The present battery mandatory. |
upsBatteryTemperature | .1.3.6.1.2.1.33.1.2.7.0 | The ambient temperature at or near the UPS Battery casing. |
通过snmpwalk命令(需要安装net-snmp软件)获取UPS剩余电量信息:
# snmpwalk -v 1 -c private 172.16.51.233 .1.3.6.1.2.1.33.1.2.4.0返回电量为100%:
SNMPv2-SMI::mib-2.33.1.2.4.0 = INTEGER: 100
其它
当前只测试了山特的UPS,其它品牌的UPS的电量信息采集方式应该类似