<!DOCTYPE html> <html lang="en"> <head> <title>UPS SNMP monitoring page</title> </head> <body> <?php // UPS IP $apcSymmetra0130 = "10.11.220.11"; $apcSymmetra2326 = "10.11.220.12"; $apcSmart3129 = "10.11.220.13"; $delta4023 = "10.11.220.14"; // SNMP settings $snmpGroup = "public"; $timeout = 10000; $retry = 100; // Delta OIDs $deltaModel = ".1.3.6.1.2.1.33.20.1.1.0"; $deltaModel2 = ".1.3.6.1.2.1.33.20.1.2.0"; $deltaInputVoltage = ".1.3.6.1.2.1.33.1.3.3.1.3.1"; $deltaTemp = ".1.3.6.1.2.1.33.1.2.7.0"; $deltaLoad = ".1.3.6.1.2.1.33.1.4.4.1.5.1"; $deltaAlarm = ".1.3.6.1.2.1.33.1.6.1.0"; // APC OIDs $apcModel = ".1.3.6.1.4.1.318.1.1.1.1.1.1.0"; $apcSN = ".1.3.6.1.4.1.318.1.1.1.1.2.3.0"; $apcInputVoltage = ".1.3.6.1.4.1.318.1.1.1.3.2.1.0"; $apcTemp = ".1.3.6.1.4.1.318.1.1.1.2.2.2.0"; $apcLoad = ".1.3.6.1.4.1.318.1.1.1.4.2.3.0"; // $apcAlarm = ".1.3.6.1.2.1.33.1.6.1.0"; ?> <h2>Отчёт о состоянии ИБП</h2> <table style="text-align: left;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr style="font-weight: bold;"> <td style="vertical-align: top;">Местоположение<br> </td> <td style="vertical-align: top;">Название устройства<br> </td> <td style="vertical-align: top;">Серийный номер<br> </td> <td style="vertical-align: top;">Входящее напряжение (В)<br> </td> <td style="vertical-align: top;">Температура (°C)<br> </td> </tr> <tr> <td style="vertical-align: top;">каб. 0130 </td> <td style="vertical-align: top;"><?php $apcModelInfo = substr(snmpget("$apcSymmetra0130", "$snmpGroup", "$apcModel", "$timeout", "$retry"), 9, -1); echo $apcModelInfo; ?> </td> <td style="vertical-align: top;"><?php $apcSNInfo = substr(snmpget("$apcSymmetra0130", "$snmpGroup", "$apcSN", "$timeout", "$retry"), 9, -1); echo $apcSNInfo; ?> </td> <td style="vertical-align: top;"><?php $apcInputVoltageInfo = substr(snmpget("$apcSymmetra0130", "$snmpGroup", "$apcInputVoltage", "$timeout", "$retry"), 8, 4); echo $apcInputVoltageInfo; ?> </td> <td style="vertical-align: top;"><?php $apcTempInfo = substr(snmpget("$apcSymmetra0130", "$snmpGroup", "$apcTemp", "$timeout", "$retry"), 8, 4); echo $apcTempInfo; ?> </td> </tr> <tr> <td style="vertical-align: top;">каб. 2326 </td> <td style="vertical-align: top;"><?php $apcModelInfo = substr(snmpget("$apcSymmetra2326", "$snmpGroup", "$apcModel", "$timeout", "$retry"), 9, -1); echo $apcModelInfo; ?> </td> <td style="vertical-align: top;"><?php $apcSNInfo = substr(snmpget("$apcSymmetra2326", "$snmpGroup", "$apcSN", "$timeout", "$retry"), 9, -1); echo $apcSNInfo; ?> </td> <td style="vertical-align: top;"><?php $apcInputVoltageInfo = substr(snmpget("$apcSymmetra2326", "$snmpGroup", "$apcInputVoltage", "$timeout", "$retry"), 8, 4); echo $apcInputVoltageInfo; ?> </td> <td style="vertical-align: top;"><?php $apcTempInfo = substr(snmpget("$apcSymmetra2326", "$snmpGroup", "$apcTemp", "$timeout", "$retry"), 8, 4); echo $apcTempInfo; ?> </td> </tr> <tr> <td style="vertical-align: top;">каб. 3129 </td> <td style="vertical-align: top;"><?php $apcModelInfo = substr(snmpget("$apcSmart3129", "$snmpGroup", "$apcModel", "$timeout", "$retry"), 9, -1); echo $apcModelInfo; ?> </td> <td style="vertical-align: top;"><?php $apcSNInfo = substr(snmpget("$apcSmart3129", "$snmpGroup", "$apcSN", "$timeout", "$retry"), 9, -1); echo $apcSNInfo; ?> </td> <td style="vertical-align: top;"><?php $apcInputVoltageInfo = substr(snmpget("$apcSmart3129", "$snmpGroup", "$apcInputVoltage", "$timeout", "$retry"), 8, 4); echo $apcInputVoltageInfo; ?> </td> <td style="vertical-align: top;"><?php $apcTempInfo = substr(snmpget("$apcSmart3129", "$snmpGroup", "$apcTemp", "$timeout", "$retry"), 8, 4); echo $apcTempInfo; ?> </td> </tr> <tr> <td style="vertical-align: top;">каб. 4023 </td> <td style="vertical-align: top;"><?php $deltaModelInfo = substr(snmpget("$delta4023", "$snmpGroup", "$deltaModel", "$timeout", "$retry"), 9, -1); $deltaModelInfo2 = substr(snmpget("$delta4023", "$snmpGroup", "$deltaModel2", "$timeout", "$retry"), 9, -2); echo "$deltaModelInfo" . " " . "$deltaModelInfo2"; ?> </td> // Серийник в Дельтах захардкожен, т.к. нет возможности получить его по SNMP <td style="vertical-align: top;">--------------- </td> <td style="vertical-align: top;"><?php $deltaInputVoltageInfo = substr(snmpget("$delta4023", "$snmpGroup", "$deltaInputVoltage", "$timeout", "$retry"), 9, 3); echo "$deltaInputVoltageInfo"; ?> </td> <td style="vertical-align: top;"><?php $deltaTempInfo = substr(snmpget("$delta4023", "$snmpGroup", "$deltaTemp", "$timeout", "$retry"), 8, 4); echo $deltaTempInfo; ?> </td> </tr> </tbody> </table> <p><i>Время формирования отчёта: <?php date_default_timezone_set('Europe/Moscow'); echo date('j F Y G:i:s'); ?> </i> </p> </body> </html>