1<?php 2 3/** 4 * Observium 5 * 6 * This file is part of Observium. 7 * 8 * @package observium 9 * @subpackage discovery 10 * @copyright (C) 2006-2015 Adam Armstrong 11 * 12 */ 13 14echo('Caching OIDs: '); 15$ups_array = array(); 16 17$InputTableCount = snmp_get($device, 'upsESystemInputNumPhases.0', '-OQv', $mib); 18echo('upsESystemInputTable ('.$InputTableCount.' entries)'); 19$ups_array = snmpwalk_cache_multi_oid($device, 'upsESystemInputTable', $ups_array, $mib); 20 21$OutputTableCount = snmp_get($device, 'upsESystemOutputNumPhase.0', '-OQv', $mib); 22echo('upsESystemOutputTable ('.$OutputTableCount.' entries)'); 23$ups_array = snmpwalk_cache_multi_oid($device, 'upsESystemOutputTable', $ups_array, $mib); 24 25$BypassTableCount = snmp_get($device, 'upsESystemBypassNumPhase.0', '-OQv', $mib); 26echo('upsESystemBypassTable ('.$BypassTableCount.' entries)'); 27$ups_array = snmpwalk_cache_multi_oid($device, 'upsESystemBypassTable', $ups_array, $mib); 28 29$scale = 0.1; 30$nominal = snmp_get($device, 'upsESystemConfigOutputVoltage.0', '-OQv', $mib) * $scale; 31$voltage_limits = array('limit_high' => ($nominal * 1.03), 'limit_high_warn' => ($nominal * 1.01), 'limit_low' => ($nominal * 0.97), 'limit_low_warn' => ($nominal * 0.99)); 32 33# Input Sensors 34for ($index = 1; $index <= $InputTableCount; $index++) 35{ 36 $data = $ups_array[$index]; 37 38 $descr = 'Input'; 39 $oid = '.1.3.6.1.4.1.935.10.1.1.2.16.1.3.'.$index; # EPPC-MIB:upsESystemInputVoltage.$index 40 $value = $data['upsESystemInputVoltage']; 41 discover_sensor('voltage', $device, $oid, "upsESystemInputVoltage.$index", 'eppc-mib', $descr, 0.1, $value, $voltage_limits); 42 43 $descr = "Input"; 44 $oid = ".1.3.6.1.4.1.935.10.1.1.2.16.1.2.".$index; # EPPC-MIB:upsESystemInputFrequency.$index 45 $value = $data['upsESystemInputFrequency']; 46 $limits = array('limit_high' => 55, 'limit_high_warn' => 51, 'limit_low' => 45, 'limit_low_warn' => 49); 47 discover_sensor('frequency', $device, $oid, "upsESystemInputFrequency.$index", 'eppc-mib', $descr, 0.1, $value, $limits); 48} 49 50# Output Sensors 51for ($index = 1; $index <= $InputTableCount; $index++) 52{ 53 $data = $ups_array[$index]; 54 55 $descr = "Output"; 56 $oid = ".1.3.6.1.4.1.935.10.1.1.2.18.1.3.$index"; # EPPC-MIB:upsESystemOutputVoltage.$index 57 $value = $data['upsESystemOutputVoltage']; 58 discover_sensor('voltage', $device, $oid, "upsESystemOutputVoltage.$index", 'eppc-mib', $descr, 0.1, $value, $voltage_limits); 59 60 $descr = "Output"; 61 $oid = ".1.3.6.1.4.1.935.10.1.1.2.18.1.2.$index"; # EPPC-MIB:upsESystemOutputFrequency.$index 62 $value = $data['upsESystemOutputFrequency']; 63 $limits = array('limit_high' => 55, 'limit_high_warn' => 51, 'limit_low' => 45, 'limit_low_warn' => 49); // FIXME orly? 50Hz only? 64 discover_sensor('frequency', $device, $oid, "upsESystemOutputFrequency.$index", 'eppc-mib', $descr, 0.1, $value, $limits); 65 66 $descr = "Output"; 67 $oid = ".1.3.6.1.4.1.935.10.1.1.2.18.1.7.$index"; # EPPC-MIB:upsESystemOutputLoad.$index 68 $value = $data['upsESystemOutputLoad']; 69 $limits = array('limit_high' => 100, 'limit_high_warn' => 75, 'limit_low' => 0); 70 discover_sensor('load', $device, $oid, "upsESystemOutputLoad.$index", 'eppc-mib', $descr, 1, $value, $limits); 71} 72 73// FIXME Sensors below are a definite candidate for definition-based discovery 74 75$descr = 'Charge Remaining'; 76$oid = '.1.3.6.1.4.1.935.10.1.1.3.4.0'; # EPPC-MIB:upsEBatteryEstimatedChargeRemaining 77$value = snmp_get($device, 'upsEBatteryEstimatedChargeRemaining.0', '-OQv', $mib); 78$limits = array('limit_high' => 100, 'limit_low_warn' => 10, 'limit_low' => 0); 79discover_sensor('capacity', $device, $oid, 'upsEBatteryEstimatedChargeRemaining', 'eppc-mib', $descr, 1, $value, $limits); // FIXME should be upsEBatteryEstimatedChargeRemaining.0 80 81$descr = 'Seconds on Battery'; 82$oid = '.1.3.6.1.4.1.935.10.1.1.3.2.0'; # EPPC-MIB:upsESecondsOnBattery 83$value = snmp_get($device, 'upsESecondsOnBattery.0', '-OQv', $mib); 84discover_sensor('runtime', $device, $oid, 'upsESecondsOnBattery.0', 'eppc-mib', $descr, 1, $value); 85 86$descr = 'Runtime Remaining (minutes)'; 87$oid = '.1.3.6.1.4.1.935.10.1.1.3.3.0'; # EPPC-MIB:upsEBatteryEstimatedMinutesRemaining 88$value = snmp_get($device, 'upsEBatteryEstimatedMinutesRemaining.0', '-OQv', $mib); 89$limits = array('limit_high' => 100, 'limit_high_warn' => 99, 'limit_low_warn' => 25, 'limit_low' => 0); 90discover_sensor('runtime', $device, $oid, 'upsEBatteryEstimatedMinutesRemaining.0', 'eppc-mib', $descr, 1, $value, $limts); 91 92$descr = 'Temperature'; 93$oid = '.1.3.6.1.4.1.935.10.1.1.2.2.0'; # EPPC-MIB:upsESystemTemperature 94$value = snmp_get($device, 'upsESystemTemperature.0', '-OQv', $mib); 95$high = snmp_get($device, 'upsEEnvironmentTemperatureHighSetPoint.0', '-OQv', $mib); 96$low = snmp_get($device, 'upsEEnvironmentTemperatureLowSetPoint.0', '-OQv', $mib); 97$limits = array('limit_high' => $high * $scale, 'limit_high_warn' => ($high * $scale) * .75, 'limit_low' => $low * $scale); 98discover_sensor('temperature', $device, $oid, 'upsESystemTemperature', 'eppc-mib', $descr, $scale, $value, $limits); // FIXME should be upsESystemTemperature.0 99 100unset($limits, $ups_array); 101 102// EOF 103