function parse_ipmitool_sensor($device, $results, $source = 'ipmi') { global $valid, $config; $index = 0; foreach (explode("\n", $results) as $row) { $index++; # BB +1.1V IOH | 1.089 | Volts | ok | na | 1.027 | 1.054 | 1.146 | 1.177 | na list($desc, $current, $unit, $state, $low_nonrecoverable, $low_limit, $low_warn, $high_warn, $high_limit, $high_nonrecoverable) = explode('|', $row); if (trim($current) != "na" && $config['ipmi_unit'][trim($unit)]) { discover_sensor($valid['sensor'], $config['ipmi_unit'][trim($unit)], $device, '', $index, $source, trim($desc), '1', '1', trim($low_limit) == 'na' ? NULL : trim($low_limit), trim($low_warn) == 'na' ? NULL : trim($low_warn), trim($high_warn) == 'na' ? NULL : trim($high_warn), trim($high_limit) == 'na' ? NULL : trim($high_limit), $current, $source); $ipmi_sensors[$config['ipmi_unit'][trim($unit)]][$source][$index] = array('description' => $desc, 'current' => $current, 'index' => $index, 'unit' => $unit); } } return $ipmi_sensors; }
upsmgConfigInput2OpenLabel.1 = "open" upsmgEnvironmentIndex.1 = 1 upsmgEnvironmentComFailure.1 = no upsmgEnvironmentTemperature.1 = 287 upsmgEnvironmentTemperatureLow.1 = no upsmgEnvironmentTemperatureHigh.1 = no upsmgEnvironmentHumidity.1 = 17 upsmgEnvironmentHumidityLow.1 = no upsmgEnvironmentHumidityHigh.1 = no upsmgEnvironmentInput1State.1 = open upsmgEnvironmentInput2State.1 = open */ foreach (array_keys($mge_env_data) as $index) { $descr = $mge_env_data[$index]['upsmgConfigSensorName']; $current = $mge_env_data[$index]['upsmgEnvironmentTemperature']; $sensorType = 'mge'; $oid = '.1.3.6.1.4.1.705.1.8.7.1.3.' . $index; $low_limit = $mge_env_data[$index]['upsmgConfigTemperatureLow']; $high_limit = $mge_env_data[$index]['upsmgConfigTemperatureHigh']; $hysteresis = $mge_env_data[$index]['upsmgConfigTemperatureHysteresis']; // FIXME warninglevels might need some other calculation in stead of hysteresis $low_warn_limit = $low_limit + $hysteresis; $high_warn_limit = $high_limit - $hysteresis; if ($debug) { echo "low_limit : {$low_limit}\nlow_warn_limit : {$low_warn_limit}\nhigh_warn_limit : {$high_warn_limit}\nhigh_limit : {$high_limit}\n"; } discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, $sensorType, $descr, '10', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current / 10); } } //end if
<?php if ($device['os'] == 'qnap') { echo 'QNAP temperature '; // Turbo NAS Temperature $turbonas_temperature_oid = '.1.3.6.1.4.1.24681.1.3.6.0'; // Turbo NAS Disk Temperature $disk_temperature_oid = '.1.3.6.1.4.1.24681.1.2.11.1.3.'; // Get Turbo NAS temperature $turbonas_temperature = snmp_get($device, $turbonas_temperature_oid, '-Oqv'); // Save the Turbo NAS temperature discover_sensor($valid['sensor'], 'temperature', $device, $turbonas_temperature_oid, '99', 'snmp', 'System Temperature', '1', '1', null, null, null, null, $turbonas_temperature); // Get all disks in the device $disks = snmpwalk_cache_multi_oid($device, 'SystemHdTable', array(), 'NAS-MIB'); // Parse all disks in the device to get the temperatures if (is_array($disks)) { foreach ($disks as $disk_number => $entry) { // Get the disk temperature full oid $disk_oid = $disk_temperature_oid . $disk_number; // Get the temperature for the disk $disk_temperature = $entry['HdTemperature']; // Getting the disk information (Number and model) $disk_information = $entry['HdDescr'] . ' ' . $entry['HdModel']; // Save the temperature for the disk discover_sensor($valid['sensor'], 'temperature', $device, $disk_oid, $disk_number, 'snmp', $disk_information, '1', '1', null, null, null, null, $disk_temperature); } } }
* the source code distribution for details. */ if ($device['os'] == 'cimc') { // Let's add some power sensors. $pwr_board = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.719.1.9.14'); /* * False == OID not found - this is not an error. * null == timeout or something else that caused an error. */ if (is_null($pwr_board)) { echo "Error\n"; } else { // No Error, lets process things. $index = 1; // Board Input Power $oid = '.1.3.6.1.4.1.9.9.719.1.9.14.1.4'; $description = "MB Input Power"; d_echo($oid . " - " . $description . " - " . $pwr_board[$oid][$index] . "\n"); discover_sensor($valid['sensor'], 'power', $device, $oid . "." . $index, 'mb-input-power', 'cimc', $description, '1', '1', null, null, null, null, $temp_board[$oid][$index]); // Board Input Current $oid = '.1.3.6.1.4.1.9.9.719.1.9.14.1.8'; $description = "MB Input Current"; d_echo($oid . " - " . $description . " - " . $pwr_board[$oid][$index] . "\n"); discover_sensor($valid['sensor'], 'current', $device, $oid . "." . $index, 'mb-input-current', 'cimc', $description, '1', '1', null, null, null, null, $temp_board[$oid][$index]); // Board Input Voltage $oid = '.1.3.6.1.4.1.9.9.719.1.9.14.1.12'; $description = "MB Input Voltage"; d_echo($oid . " - " . $description . " - " . $pwr_board[$oid][$index] . "\n"); discover_sensor($valid['sensor'], 'voltage', $device, $oid . "." . $index, 'mb-input-voltage', 'cimc', $description, '1', '1', null, null, null, null, $temp_board[$oid][$index]); } }
// IPMI - We can discover this on poll! if ($ipmi['host'] = get_dev_attrib($device, 'ipmi_hostname')) { echo 'IPMI : '; $ipmi['user'] = get_dev_attrib($device, 'ipmi_username'); $ipmi['password'] = get_dev_attrib($device, 'ipmi_password'); if ($config['own_hostname'] != $device['hostname'] || $ipmi['host'] != 'localhost') { $remote = " -H " . $ipmi['host'] . " -U '" . $ipmi['user'] . "' -P '" . $ipmi['password'] . "' -L USER"; } foreach ($config['ipmi']['type'] as $ipmi_type) { $results = external_exec($config['ipmitool'] . " -I {$ipmi_type}" . $remote . ' sensor 2>/dev/null|sort'); if ($results != '') { set_dev_attrib($device, 'ipmi_type', $ipmi_type); break; } } echo $ipmi_type; $index = 0; foreach (explode("\n", $results) as $sensor) { // BB +1.1V IOH | 1.089 | Volts | ok | na | 1.027 | 1.054 | 1.146 | 1.177 | na list($desc, $current, $unit, $state, $low_nonrecoverable, $low_limit, $low_warn, $high_warn, $high_limit, $high_nonrecoverable) = explode('|', $sensor); $index++; if (trim($current) != 'na' && $config['ipmi_unit'][trim($unit)]) { discover_sensor($valid['sensor'], $config['ipmi_unit'][trim($unit)], $device, trim($desc), $index, 'ipmi', trim($desc), '1', '1', trim($low_limit) == 'na' ? null : trim($low_limit), trim($low_warn) == 'na' ? null : trim($low_warn), trim($high_warn) == 'na' ? null : trim($high_warn), trim($high_limit) == 'na' ? null : trim($high_limit), $current, 'ipmi'); } } echo "\n"; } check_valid_sensors($device, 'voltage', $valid['sensor'], 'ipmi'); check_valid_sensors($device, 'temperature', $valid['sensor'], 'ipmi'); check_valid_sensors($device, 'fanspeed', $valid['sensor'], 'ipmi'); check_valid_sensors($device, 'power', $valid['sensor'], 'ipmi');
<?php echo " EXTREME-BASE-MIB "; if ($device['os'] == 'xos') { // Power Usage $descr = "Power Usage"; $oid = "1.3.6.1.4.1.1916.1.1.1.40.1.0"; // extremeSystemPowerUsage $value = snmp_get($device, $oid, '-Oqv', 'EXTREME-BASE-MIB'); $divisor = "1000"; if (is_numeric($value)) { $value = $value / $divisor; // Nasty hack to divide the first value by 1000 since the divisor only works for polling after the sensor has been added discover_sensor($valid['sensor'], 'power', $device, $oid, '1', 'extreme-power', $descr, $divisor, 1, null, null, null, null, $value); // No limits have been specified since all equipment is different and will use different amount of Watts } } // EOF
* the source code distribution for details. */ if ($device['os'] == 'riverbed') { $tables = array(array('systemHealth.0', '1.3.6.1.4.1.17163.1.1.2.7.0', 'systemHealth', 'System Health'), array('optServiceStatus.0', '1.3.6.1.4.1.17163.1.1.2.8.0', 'optServiceStatus', 'Optimization Service Status')); foreach ($tables as $tablevalue) { $temp = snmp_get($device, $tablevalue[0], "-Ovqe", "STEELHEAD-MIB"); $oid = $tablevalue[1]; if (is_numeric($temp)) { //Create State Index $state_name = $tablevalue[2]; $state_index_id = create_state_index($state_name); //Create State Translation if ($state_index_id !== null) { if ($state_name == 'systemHealth') { $states = array(array($state_index_id, 'healthy', 0, 10000, 0), array($state_index_id, 'degraded', 0, 30000, 1), array($state_index_id, 'admissionControl', 0, 31000, 1), array($state_index_id, 'critical', 0, 50000, 2)); } else { $states = array(array($state_index_id, 'none', 0, 0, 3), array($state_index_id, 'unmanaged', 0, 1, 3), array($state_index_id, 'running', 0, 2, 0), array($state_index_id, 'sentCom1', 0, 3, 1), array($state_index_id, 'sentTerm1', 0, 4, 1), array($state_index_id, 'sentTerm2', 0, 5, 1), array($state_index_id, 'sentTerm3', 0, 6, 1), array($state_index_id, 'pending', 0, 7, 1), array($state_index_id, 'stopped', 0, 8, 2)); } foreach ($states as $value) { $insert = array('state_index_id' => $value[0], 'state_descr' => $value[1], 'state_draw_graph' => $value[2], 'state_value' => $value[3], 'state_generic_value' => $value[4]); dbInsert($insert, 'state_translations'); } } $descr = $tablevalue[3]; //Discover Sensors discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $temp, 'snmp', $tablevalue[0]); //Create Sensor To State Index create_sensor_to_state_index($device, $state_name, $index); } } }
$oid = "1.3.6.1.4.1.4555.1.1.1.1.3.2.0"; $descr = "Input"; $value = snmp_get($device, $oid, "-Oqv"); $index = '3.2.0'; discover_sensor($valid['sensor'], 'frequency', $device, $oid, $index, 'netvision', $descr, $scale, $value * $scale); $oid = "1.3.6.1.4.1.4555.1.1.1.1.4.2.0"; $descr = "Output"; $value = snmp_get($device, $oid, "-Oqv"); $index = '4.2.0'; discover_sensor($valid['sensor'], 'frequency', $device, $oid, $index, 'netvision', $descr, $scale, $value * $scale); // Battery voltage $oid = "1.3.6.1.4.1.4555.1.1.1.1.2.5.0"; $descr = "Battery"; $value = snmp_get($device, $oid, "-Oqv"); $index = 200; discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, 'netvision', $descr, $scale, $value * $scale); for ($i = 1; $i <= 3; $i++) { $oid = "1.3.6.1.4.1.4555.1.1.1.1.3.3.1.2.{$i}"; $descr = "Input Phase {$i}"; $value = snmp_get($device, $oid, "-Oqv"); $index = $i; discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, 'netvision', $descr, $scale, $value * $scale); } for ($i = 1; $i <= 3; $i++) { $oid = "1.3.6.1.4.1.4555.1.1.1.1.4.4.1.2.{$i}"; $descr = "Output Phase {$i}"; $value = snmp_get($device, $oid, "-Oqv"); $index = 100 + $i; discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, 'netvision', $descr, $scale, $value * $scale); } // EOF
<?php /* * LibreNMS * * Copyright (c) 2016 Cercel Valentin (crc@nuamchefazi.ro) * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ if ($device['os'] == 'hwg-ste2') { d_echo('HWg STE2 Humidity '); $oid = '.1.3.6.1.4.1.21796.4.9.3.1.4.1'; $sensorType = 'ste2_humidity'; $descr = 'Input 1 Humidity'; $humidity = snmp_get($device, $oid, '-Osqnv'); if ($humidity !== false) { discover_sensor($valid['sensor'], 'humidity', $device, $oid, '1', $sensorType, $descr, '1', '1', null, null, null, null, $humidity); } }
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage discovery * @copyright (C) 2006-2014 Adam Armstrong * */ echo " DeltaUPS-MIB "; $dupsSensors = array(array('OID' => "1.3.6.1.4.1.2254.2.4.7.7.0", 'descr' => "Battery", 'divisor' => 1, 'class' => 'current'), array('OID' => "1.3.6.1.4.1.2254.2.4.5.5.0", 'descr' => "Output", 'divisor' => 10, 'class' => 'current'), array('OID' => "1.3.6.1.4.1.2254.2.4.4.4.0", 'descr' => "Input", 'divisor' => 10, 'class' => 'current'), array('OID' => "1.3.6.1.4.1.2254.2.4.6.4.0", 'descr' => "Bypass", 'divisor' => 10, 'class' => 'current'), array('OID' => "1.3.6.1.4.1.2254.2.4.5.2.0", 'descr' => "Output", 'divisor' => 10, 'class' => 'frequency'), array('OID' => "1.3.6.1.4.1.2254.2.4.4.2.0", 'descr' => "Input", 'divisor' => 10, 'class' => 'frequency'), array('OID' => "1.3.6.1.4.1.2254.2.4.10.2.0", 'descr' => "Environment", 'divisor' => 1, 'class' => 'humidity'), array('OID' => "1.3.6.1.4.1.2254.2.4.10.1.0", 'descr' => "Environment", 'divisor' => 1, 'class' => 'temperature'), array('OID' => "1.3.6.1.4.1.2254.2.4.7.9.0", 'descr' => "Battery", 'divisor' => 1, 'class' => 'temperature'), array('OID' => "1.3.6.1.4.1.2254.2.4.7.6.0", 'descr' => "Battery", 'divisor' => 10, 'class' => 'voltage'), array('OID' => "1.3.6.1.4.1.2254.2.4.5.4.0", 'descr' => "Output", 'divisor' => 10, 'class' => 'voltage'), array('OID' => "1.3.6.1.4.1.2254.2.4.4.3.0", 'descr' => "Input", 'divisor' => 10, 'class' => 'voltage'), array('OID' => "1.3.6.1.4.1.2254.2.4.6.3.0", 'descr' => "Bypass", 'divisor' => 10, 'class' => 'voltage')); //FIXME - This only discovers a single phase - probably needs more values above? ie dupsBypassVoltage1.0 is polled, dupsBypassVoltage2.0 and 3.0 aren't, etc. foreach ($dupsSensors as $eachArray => $eachValue) { // DeltaUPS does not have tables, so no need to walk, only need snmpget $value = snmp_get($device, $eachValue['OID'], "-O vq"); // Get index values from current OID $preIndex = strstr($eachValue['OID'], '2254.2.4'); // Format and strip index to only include everything after 2254.2.4 $index = substr($preIndex, 9); // Prevent NULL returned values from being added as sensors if ($value != "NULL") { discover_sensor($valid['sensor'], $eachValue['class'], $device, $eachValue['OID'], $index, "DeltaUPS", $eachValue['descr'], $eachValue['divisor'], 1, NULL, NULL, NULL, NULL, $value); } } // EOF
} // $oids_in = array(); $oids_out = array(); // echo("inletStatusWH "); // $oids_in = snmpwalk_cache_multi_oid($device, "inletStatusWH", $oids_in, "IPOMANII-MIB"); d_echo('outletStatusWH '); $oids_out = snmpwalk_cache_multi_oid($device, 'outletStatusWH', $oids_out, 'IPOMANII-MIB'); // if (is_array($oids_in)) // { // foreach ($oids_in as $index => $entry) // { // $cur_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.5.' . $index; // $divisor = 10; // $descr = (trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') != '' ? trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') : "Inlet $index"); // $power = $entry['inletStatusWH'] / $divisor; // // discover_sensor($valid['sensor'], 'power', $device, $cur_oid, '1.3.1.3.'.$index, 'ipoman', $descr, $divisor, '1', NULL, NULL, NULL, NULL, $power); // // FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf? // } // } if (is_array($oids_out)) { foreach ($oids_out as $index => $entry) { $cur_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.2.3.1.5.' . $index; $divisor = 10; $descr = trim($cache['ipoman']['out'][$index]['outletConfigDesc'], '"') != '' ? trim($cache['ipoman']['out'][$index]['outletConfigDesc'], '"') : "Output {$index}"; $power = $entry['outletStatusWH'] / $divisor; discover_sensor($valid['sensor'], 'power', $device, $cur_oid, '2.3.1.3.' . $index, 'ipoman', $descr, $divisor, '1', null, null, null, null, $power); } } } //end if
* @package observium * @subpackage discovery * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ $cml['temp'] = snmpwalk_cache_oid($device, 'scEnclTempTable', array(), 'COMPELLENT-MIB'); $cml['fan'] = snmpwalk_cache_oid($device, 'scEnclFanTable', array(), 'COMPELLENT-MIB'); $cml['ctrl'] = snmpwalk_cache_oid($device, 'scCtlrEntry', array(), 'COMPELLENT-MIB'); $cml['disk'] = snmpwalk_cache_oid($device, 'scDiskEntry', array(), 'COMPELLENT-MIB'); $cml['cache'] = snmpwalk_cache_oid($device, 'ScCacheEntry', array(), 'COMPELLENT-MIB'); foreach ($cml['temp'] as $index => $entry) { $oid = '.1.3.6.1.4.1.16139.2.23.1.5.' . $index; $descr = $entry['scEnclTempLocation']; $value = $entry['scEnclTempCurrentC']; if (is_numeric($value)) { discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'compellent', $descr, 1, $value); } } foreach ($cml['fan'] as $index => $entry) { $oid = '.1.3.6.1.4.1.16139.2.20.1.3.' . $index; $descr = $entry['scEnclFanLocation']; $value = $entry['scEnclFanStatus']; if ($value) { discover_status($device, $oid, 'scEnclFanStatus.' . $index, 'compellent-mib-state', $descr, $value, array('entPhysicalClass' => 'fan')); } } foreach ($cml['ctrl'] as $index => $entry) { $oid = '.1.3.6.1.4.1.16139.2.13.1.3.' . $index; $descr = 'Controller ' . $entry['scCtlrNbr'] . ' (' . $entry['scCtlrName'] . ')'; $value = $entry['scCtlrStatus']; if ($value) {
<?php if ($device['os'] == 'pcoweb') { echo ' pCOWeb '; $temperatures = array(array('mib' => 'CAREL-ug40cdz-MIB::roomTemp.0', 'descr' => 'Room Temperature', 'oid' => '.1.3.6.1.4.1.9839.2.1.2.1.0', 'precision' => '10'), array('mib' => 'CAREL-ug40cdz-MIB::outdoorTemp.0', 'descr' => 'Ambient Temperature', 'oid' => '.1.3.6.1.4.1.9839.2.1.2.2.0', 'precision' => '10'), array('mib' => 'CAREL-ug40cdz-MIB::deliveryTemp.0', 'descr' => 'Delivery Air Temperature', 'oid' => '.1.3.6.1.4.1.9839.2.1.2.3.0', 'precision' => '10'), array('mib' => 'CAREL-ug40cdz-MIB::cwTemp.0', 'descr' => 'Chilled Water Temperature', 'oid' => '.1.3.6.1.4.1.9839.2.1.2.4.0', 'precision' => '10'), array('mib' => 'CAREL-ug40cdz-MIB::hwTemp.0', 'descr' => 'Hot Water Temperature', 'oid' => '.1.3.6.1.4.1.9839.2.1.2.5.0', 'precision' => '10'), array('mib' => 'CAREL-ug40cdz-MIB::cwoTemp.0', 'descr' => 'Chilled Water Outlet Temperature', 'oid' => '.1.3.6.1.4.1.9839.2.1.2.7.0', 'precision' => '10'), array('mib' => 'CAREL-ug40cdz-MIB::suctTemp1.0', 'descr' => 'Circuit 1 Suction Temperature', 'oid' => '.1.3.6.1.4.1.9839.2.1.2.10.0', 'precision' => '10'), array('mib' => 'CAREL-ug40cdz-MIB::suctTemp2.0', 'descr' => 'Circuit 2 Suction Temperature', 'oid' => '.1.3.6.1.4.1.9839.2.1.2.11.0', 'precision' => '10'), array('mib' => 'CAREL-ug40cdz-MIB::evapTemp1.0', 'descr' => 'Circuit 1 Evap. Temperature', 'oid' => '.1.3.6.1.4.1.9839.2.1.2.12.0', 'precision' => '10'), array('mib' => 'CAREL-ug40cdz-MIB::evapTemp2.0', 'descr' => 'Circuit 2 Evap. Temperature', 'oid' => '.1.3.6.1.4.1.9839.2.1.2.13.0', 'precision' => '10'), array('mib' => 'CAREL-ug40cdz-MIB::ssh1.0', 'descr' => 'Circuit 1 Superheat', 'oid' => '.1.3.6.1.4.1.9839.2.1.2.14.0', 'precision' => '10'), array('mib' => 'CAREL-ug40cdz-MIB::ssh2.0', 'descr' => 'Circuit 2 Superheat', 'oid' => '.1.3.6.1.4.1.9839.2.1.2.15.0', 'precision' => '10'), array('mib' => 'CAREL-ug40cdz-MIB::coolSetP.0', 'descr' => 'Cooling Set Point', 'oid' => '.1.3.6.1.4.1.9839.2.1.2.20.0', 'precision' => '10'), array('mib' => 'CAREL-ug40cdz-MIB::coolDiff.0', 'descr' => 'Cooling Prop. Band', 'oid' => '.1.3.6.1.4.1.9839.2.1.2.21.0', 'precision' => '10'), array('mib' => 'CAREL-ug40cdz-MIB::cool2SetP.0', 'descr' => 'Cooling 2nd Set Point', 'oid' => '.1.3.6.1.4.1.9839.2.1.2.22.0', 'precision' => '10'), array('mib' => 'CAREL-ug40cdz-MIB::heatSetP.0', 'descr' => 'Heating Set Point', 'oid' => '.1.3.6.1.4.1.9839.2.1.2.23.0', 'precision' => '10'), array('mib' => 'CAREL-ug40cdz-MIB::heatDiff.0', 'descr' => 'Heating Prop. Band', 'oid' => '.1.3.6.1.4.1.9839.2.1.2.25.0', 'precision' => '10'), array('mib' => 'CAREL-ug40cdz-MIB::heat2SetP.0', 'descr' => 'Heating 2nd Set Point', 'oid' => '.1.3.6.1.4.1.9839.2.1.2.24.0', 'precision' => '10')); foreach ($temperatures as $temperature) { $current = snmp_get($device, $temperature['mib'], '-OqvU') / $temperature['precision']; $high_limit = null; $low_limit = null; if (is_numeric($current) && $current != 0) { $index = implode('.', array_slice(explode('.', $temperature['oid']), -5)); discover_sensor($valid['sensor'], 'temperature', $device, $temperature['oid'], $index, 'pcoweb', $temperature['descr'], $temperature['precision'], '1', $low_limit, null, null, $high_limit, $current); } } /* FIXME thrsHT.0 = INTEGER: 30 degrees C x10 thrsLT.0 = INTEGER: 10 degrees C x10 smCoolSetp.0 = INTEGER: 280 degrees C smHeatSetp.0 = INTEGER: 160 degrees C cwDehumSetp.0 = INTEGER: 70 degrees C cwHtThrsh.0 = INTEGER: 150 degrees C cwModeSetp.0 = INTEGER: 70 degrees C radcoolSpES.0 = INTEGER: 80 degrees C radcoolSpDX.0 = INTEGER: 280 degrees C delTempLimit.0 = INTEGER: 14 degrees C x10 dtAutChgMLT.0 = INTEGER: 20 degrees C */ }
STE-MIB::sensValue.2 = INTEGER: 261 STE-MIB::sensSN.1 = STRING: "289667F30100000F" STE-MIB::sensSN.2 = STRING: "268C71130100004D" STE-MIB::sensUnit.1 = INTEGER: celsius(1) STE-MIB::sensUnit.2 = INTEGER: percent(4) STE-MIB::sensID.1 = INTEGER: 26518 STE-MIB::sensID.2 = INTEGER: 29068 */ $oids = snmpwalk_cache_multi_oid($device, "sensTable", array(), "STE-MIB"); foreach ($oids as $index => $entry) { $oid = ".1.3.6.1.4.1.21796.4.1.3.1.5.{$index}"; $descr = $entry['sensName']; $value = $entry['sensValue']; $scale = 0.1; // sensUnit: none (0), celsius (1), fahrenheit (2), kelvin (3), percent(4) switch ($entry['sensUnit']) { case 'celsius': $type = 'temperature'; break; case 'percent': $type = 'humidity'; break; default: continue 2; // continue foreach loop } if (is_numeric($value) && $entry['sensState'] != 'invalid') { discover_sensor($valid['sensor'], $type, $device, $oid, "steSensor.{$index}", 'ste', $descr, $scale, $value * $scale); } } // EOF
/* * LibreNMS Telco Systems Temperature Sensor Discovery module * * Copyright (c) 2016 Chris A. Evans <*****@*****.**> * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ if ($device['os'] == 'binox') { if (strpos($device['sysObjectID'], 'enterprises.738.10.5.100') !== false) { echo "Telco Systems:"; // CPU temperature $high_limit = 70; $high_warn_limit = 65; $low_warn_limit = 5; $low_limit = 0; $descr = "CPU Temperature"; $valueoid = ".1.3.6.1.4.1.738.10.111.3.1.2.0"; // PRVT-SYS-MON-MIB::prvtSysMonCurrentCpuTemperature.0 $value = snmp_get($device, $valueoid, '-Oqv'); $value = str_replace('C', '', $value); $value = str_replace('"', '', $value); if (is_numeric($value)) { discover_sensor($valid['sensor'], 'temperature', $device, $valueoid, 1, 'binox', $descr, '1', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $value); } } }
// 32768 = No sensor connected if ($value != 32768 && $value != '') { discover_sensor($valid['sensor'], 'humidity', $device, $oid, "isDeviceMonitorHumidity.{$index}", 'ispro-mib', $descr, 0.01, $value, $options); } $oid = ".1.3.6.1.4.1.19011.1.3.2.1.3.1.2.1.4.{$index}"; $value = $entry['isDeviceMonitorHumidityAlarm']; // isDeviceMonitorHumidityAlarm.1 = INTEGER: normal(3) // unknown = No sensor connected if ($value != 'unknown' && $value != '') { discover_sensor($valid['sensor'], 'state', $device, $oid, "isDeviceMonitorHumidityAlarm.{$index}", 'ispro-mib-threshold-state', $descr, 1, $value); } } } $oids = snmpwalk_cache_oid($device, 'isDeviceMonitorDigitalInTable', array(), 'ISPRO-MIB'); $oids = snmpwalk_cache_oid($device, 'isDeviceConfigDigitalInTable', $oids, 'ISPRO-MIB'); foreach ($oids as $index => $entry) { // Unfortunately, there is no (direct) SNMP link between the sensors connected above, even though they are represented together in the Web UI. // Unless we use a ugly "divide by 2" hack, we can't know if these alerts are meant to be "not displayed" like we do for Temp/Humidity. // If you don't want digital sensors displayed, make sure they are set to Disabled and not Normal Open or Normal Close. // isDeviceMonitorDigitalInIndex.1 = INTEGER: 1 // isDeviceMonitorDigitalInName.1 = STRING: "Alarm1-1" // isDeviceMonitorDigitalIn.1 = INTEGER: inactive(2) // isDeviceMonitorDigitalInAlarm.1 = INTEGER: normal(1) $descr = $entry['isDeviceMonitorDigitalInName']; $oid = "1.3.6.1.4.1.19011.1.3.2.1.3.1.3.1.4.{$index}"; $value = $entry['isDeviceMonitorDigitalInAlarm']; if ($entry['isDeviceConfigDigitalInState'] != 'disabled' && $value != '') { discover_sensor($valid['sensor'], 'state', $device, $oid, "isDeviceMonitorDigitalInAlarm.{$index}", 'ispro-mib-trigger-state', $descr, 1, $value); } } // EOF
$current = snmp_get($device, $freq_oid, '-Oqv') / 10; $type = 'rfc1628'; $divisor = 10; if ($device['os'] == 'huaweiups') { $divisor = 100; } $index = '3.2.0.' . $i; discover_sensor($valid['sensor'], 'frequency', $device, $freq_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); } $freq_oid = '1.3.6.1.2.1.33.1.4.2.0'; $descr = 'Output'; $current = snmp_get($device, $freq_oid, '-Oqv') / 10; $type = 'rfc1628'; $divisor = 10; if ($device['os'] == 'huaweiups') { $divisor = 100; } $index = '4.2.0'; discover_sensor($valid['sensor'], 'frequency', $device, $freq_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); $freq_oid = '1.3.6.1.2.1.33.1.5.1.0'; $descr = 'Bypass'; $current = snmp_get($device, $freq_oid, '-Oqv') / 10; $type = 'rfc1628'; $divisor = 10; if ($device['os'] == 'huaweiups') { $divisor = 100; } $index = '5.1.0'; discover_sensor($valid['sensor'], 'frequency', $device, $freq_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); } //end if
//.1.3.6.1.4.1.32050.2.1.27.5.5 = 1000 //.1.3.6.1.4.1.32050.2.1.27.5.6 = -1000 //.1.3.6.1.4.1.32050.2.1.27.6.0 = 0 //.1.3.6.1.4.1.32050.2.1.27.6.1 = 0 //.1.3.6.1.4.1.32050.2.1.27.6.2 = 0 //.1.3.6.1.4.1.32050.2.1.27.6.3 = 0 //.1.3.6.1.4.1.32050.2.1.27.6.4 = 0 //.1.3.6.1.4.1.32050.2.1.27.6.5 = 1000 //.1.3.6.1.4.1.32050.2.1.27.6.6 = -1000 $index_analog = '.1.3.6.1.4.1.32050.2.1.27'; $packetflux_analog = snmpwalk_numericoids($device, $index_analog, array(), 'SNMPv2', mib_dirs()); $oids_analog[0] = array('class' => 'temperature', 'divisor' => 10); $oids_analog[1] = array('class' => 'voltage', 'divisor' => 10000); $oids_analog[2] = array('class' => 'voltage', 'divisor' => 10); $oids_analog[3] = array('class' => 'voltage', 'divisor' => 10); $oids_analog[4] = array('class' => 'current', 'divisor' => 1000); $oids_analog[5] = array('class' => 'temperature', 'divisor' => 10); // What is this? $oids_analog[6] = array('class' => 'temperature', 'divisor' => 10); // What is this? foreach ($oids_analog as $index => $entry) { $oid = "{$index_analog}.5.{$index}"; if (is_numeric($packetflux_analog[$oid])) { list($descr) = explode(' (', $packetflux_analog["{$index_analog}.2.{$index}"]); $class = $oids_analog[$index]['class']; $divisor = $oids_analog[$index]['divisor']; $value = $packetflux_analog[$oid] / $divisor; discover_sensor($valid['sensor'], $class, $device, $oid, "packetflux-analog-{$index}", 'packetflux', $descr, $divisor, 1, NULL, NULL, NULL, NULL, $value); } } // EOF
/* * LibreNMS * * Copyright (c) 2015 Steve Calvário <https://github.com/Calvario/> * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ if ($device['os'] == 'dsm') { echo 'DSM UPS Load'; // UPS Device Manufacturer, example return : SNMPv2-SMI::enterprises.6574.4.1.2.0 = STRING: "American Power Conversion" $ups_device_manufacturer_oid = '.1.3.6.1.4.1.6574.4.1.2.0'; $ups_device_manufacturer = str_replace('"', '', snmp_get($device, $ups_device_manufacturer_oid, '-Oqv')); // Too long name for APC if ($ups_device_manufacturer == 'American Power Conversion') { $ups_device_manufacturer = 'APC'; } // UPS Device Model, example return : SNMPv2-SMI::enterprises.6574.4.1.1.0 = STRING: "Back-UPS RS 900G" $ups_device_model_oid = '.1.3.6.1.4.1.6574.4.1.1.0'; $ups_device_model = str_replace('"', '', snmp_get($device, $ups_device_model_oid, '-Oqv')); // UPS Load Value, example return : SNMPv2-SMI::enterprises.6574.4.2.12.1.0 = Opaque: Float: 4.000000 $ups_load_oid = '.1.3.6.1.4.1.6574.4.2.12.1.0'; $ups_load = snmp_get($device, $ups_load_oid, '-Oqv'); if (is_numeric($ups_load)) { discover_sensor($valid['sensor'], 'load', $device, $ups_load_oid, 0, 'snmp', $ups_device_manufacturer . ' ' . $ups_device_model . ' - UPS Load', '1', '1', 0, null, null, 100, intval($ups_load)); } } //end if
upsmgEnvironmentComFailure.1 = no upsmgEnvironmentTemperature.1 = 287 upsmgEnvironmentTemperatureLow.1 = no upsmgEnvironmentTemperatureHigh.1 = no upsmgEnvironmentHumidity.1 = 17 upsmgEnvironmentHumidityLow.1 = no upsmgEnvironmentHumidityHigh.1 = no upsmgEnvironmentInput1State.1 = open upsmgEnvironmentInput2State.1 = open */ foreach (array_keys($mge_env_data) as $index) { $descr = $mge_env_data[$index]['upsmgConfigSensorName']; $current = $mge_env_data[$index]['upsmgEnvironmentHumidity']; $sensorType = 'mge'; $oid = '.1.3.6.1.4.1.705.1.8.7.1.6.' . $index; $low_limit = $mge_env_data[$index]['upsmgConfigHumidityLow']; $high_limit = $mge_env_data[$index]['upsmgConfigHumidityHigh']; $hysteresis = $mge_env_data[$index]['upsmgConfigHumidityHysteresis']; // FIXME warninglevels might need some other calculation in stead of hysteresis $low_warn_limit = $low_limit + $hysteresis; $high_warn_limit = $high_limit - $hysteresis; if ($debug) { echo "low_limit : {$low_limit}\nlow_warn_limit : {$low_warn_limit}\nhigh_warn_limit : {$high_warn_limit}\nhigh_limit : {$high_limit}\n"; } if ($current != 0) { # Humidity = 0 -> Sensor not available // FIXME true for MGE as wel as APC? discover_sensor($valid['sensor'], 'humidity', $device, $oid, $index, $sensorType, $descr, '1', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current); } } }
$states = array(array($state_index_id, 'unknown', 0, 0, 3), array($state_index_id, 'ready', 1, 1, 0), array($state_index_id, 'failed', 1, 2, 2), array($state_index_id, 'online', 1, 3, 1), array($state_index_id, 'offline', 1, 4, 2), array($state_index_id, 'degraded', 1, 6, 2), array($state_index_id, 'verifying', 1, 7, 1), array($state_index_id, 'resynching', 1, 15, 1), array($state_index_id, 'regenerating', 1, 16, 1), array($state_index_id, 'failedRedundancy', 1, 18, 2), array($state_index_id, 'rebuilding', 1, 24, 1), array($state_index_id, 'formatting', 1, 26, 1), array($state_index_id, 'reconstructing', 1, 32, 1), array($state_index_id, 'initializing', 1, 35, 1), array($state_index_id, 'backgroundInit', 1, 36, 1), array($state_index_id, 'permanentlyDegraded', 1, 52, 2)); } elseif ($state_name == 'batteryState') { $states = array(array($state_index_id, 'ready', 0, 1, 0), array($state_index_id, 'failed', 1, 2, 2), array($state_index_id, 'degraded', 1, 6, 2), array($state_index_id, 'reconditioning', 1, 7, 1), array($state_index_id, 'high', 1, 9, 1), array($state_index_id, 'low', 1, 10, 1), array($state_index_id, 'charging', 1, 12, 1), array($state_index_id, 'missing', 1, 21, 2), array($state_index_id, 'learning', 1, 36, 1)); } foreach ($states as $value) { $insert = array('state_index_id' => $value[0], 'state_descr' => $value[1], 'state_draw_graph' => $value[2], 'state_value' => $value[3], 'state_generic_value' => $value[4]); dbInsert($insert, 'state_translations'); } } foreach ($temp as $index => $entry) { if (strpos($index, '54.') === false) { //Because Dell is buggy if ($state_name == 'intrusionStatus') { $descr = $tablevalue[3]; } elseif ($state_name == 'batteryState') { $descr = str_replace('"', "", snmp_get($device, "batteryConnectionControllerName." . $index . "", "-Ovqn", $tablevalue[4])) . ' - ' . $temp[$index][$tablevalue[3]]; } elseif ($state_name == 'arrayDiskState') { $descr = str_replace('"', "", snmp_get($device, "arrayDiskEnclosureConnectionEnclosureName." . $index . "", "-Ovqn", $tablevalue[4])) . ' - ' . $temp[$index][$tablevalue[3]]; } else { $descr = clean($temp[$index][$tablevalue[3]]); // Use clean as virtualDiskDeviceName is user defined } //Discover Sensors discover_sensor($valid['sensor'], 'state', $device, $cur_oid . $index, $index, $state_name, $descr, '1', '1', null, null, null, null, $temp[$index][$tablevalue[2]], 'snmp', $index); //Create Sensor To State Index create_sensor_to_state_index($device, $state_name, $index); } } } } }
echo 'Dell OMSA '; } foreach (explode("\n", $oids) as $data) { $data = trim($data); if ($data) { list($oid, $status) = explode(' ', $data, 2); d_echo('status : ' . $status . "\n"); if ($status == 'ok') { // 2 = normal, 0 = not connected $split_oid = explode('.', $oid); $temperature_id = $split_oid[count($split_oid) - 2] . '.' . $split_oid[count($split_oid) - 1]; $descr_oid = ".1.3.6.1.4.1.674.10892.1.700.20.1.8.{$temperature_id}"; $temperature_oid = ".1.3.6.1.4.1.674.10892.1.700.20.1.6.{$temperature_id}"; $limit_oid = ".1.3.6.1.4.1.674.10892.1.700.20.1.10.{$temperature_id}"; $warnlimit_oid = ".1.3.6.1.4.1.674.10892.1.700.20.1.11.{$temperature_id}"; $lowwarnlimit_oid = ".1.3.6.1.4.1.674.10892.1.700.20.1.12.{$temperature_id}"; $lowlimit_oid = ".1.3.6.1.4.1.674.10892.1.700.20.1.13.{$temperature_id}"; $descr = trim(snmp_get($device, $descr_oid, '-Oqv', 'MIB-Dell-10892'), '"'); $temperature = snmp_get($device, $temperature_oid, '-Oqv', 'MIB-Dell-10892'); $lowwarnlimit = snmp_get($device, $lowwarnlimit_oid, '-Oqv', 'MIB-Dell-10892'); $warnlimit = snmp_get($device, $warnlimit_oid, '-Oqv', 'MIB-Dell-10892'); $limit = snmp_get($device, $limit_oid, '-Oqv', 'MIB-Dell-10892'); $lowlimit = snmp_get($device, $lowlimit_oid, '-Oqv', 'MIB-Dell-10892'); discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, $temperature_id, 'dell', $descr, '10', '1', $lowlimit / 10, $low_warn_limit / 10, $warnlimit / 10, $limit / 10, $temperature / 10); } } //end if } //end foreach } //end if
// Convert from fahrenheit to celsius } } if ($entry['sensorProbeTempStatus'] != 'noStatus') { discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'akcp', $descr, $scale_temp, $value, $limits); } } if ($entry['sensorProbeHumidityStatus']) { # Humidity sensor # FIXME do we need to take note of this? [sensorProbeHumidityOffset] => 0 $descr = $entry['sensorProbeHumidityDescription']; $oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.3.{$index}"; # SPAGENT-MIB:sensorProbeHumidityPercent.$index $value = $entry['sensorProbeHumidityPercent']; $limits = array('limit_high' => $entry['sensorProbeHumidityHighCritical'], 'limit_low' => $entry['sensorProbeHumidityLowCritical'], 'limit_high_warn' => $entry['sensorProbeHumidityHighWarning'], 'limit_low_warn' => $entry['sensorProbeHumidityLowWarning']); if ($entry['sensorProbeHumidityStatus'] != 'noStatus') { discover_sensor($valid['sensor'], 'humidity', $device, $oid, $index, 'akcp', $descr, 1, $value, $limits); } } if ($entry['sensorProbeSwitchStatus']) { # Switch sensor $descr = $entry['sensorProbeSwitchDescription']; $oid = ".1.3.6.1.4.1.3854.1.2.2.1.18.1.3.{$index}"; # SPAGENT-MIB:sensorProbeSwitchStatus.$index $value = $entry['sensorProbeSwitchStatus']; if ($entry['sensorProbeSwitchStatus'] != 'noStatus') { discover_sensor($valid['sensor'], 'state', $device, $oid, $index, 'spagent-state', $descr, NULL, $value, array('entPhysicalClass' => 'other')); } } } // EOF
$index = 1; if ($set_oids !== false) { list(, $set_point_raw) = explode(' ', $set_oids); $set_point = $set_point_raw / $precision; $descr = 'Return Temp - Setpoint: ' . $set_point . '°C'; } else { $descr = 'Return Temperature'; } discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, $sensorType, $descr, $precision, '1', null, null, null, null, $current); } unset($oids); $oids = snmp_get($device, '1.3.6.1.4.1.318.1.1.13.2.2.14.0', '-OsqnU', ''); d_echo($oids . "\n"); if ($oids !== false) { echo 'APC Portable Remote Temp '; list($oid, $current_raw) = explode(' ', $oids); $precision = 10; $current = $current_raw / $precision; $sensorType = 'apc'; $index = 2; if ($set_oids !== false) { list(, $set_point_raw) = explode(' ', $set_oids); $set_point = $set_point_raw / $precision; $descr = 'Remote Temp - Setpoint: ' . $set_point . '°C'; } else { $descr = 'Remote Temperature'; } discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, $sensorType, $descr, $precision, '1', null, null, null, null, $current); } } //end if
<?php // Force10 S-Series // F10-S-SERIES-CHASSIS-MIB::chStackUnitTemp.1 = Gauge32: 47 // F10-S-SERIES-CHASSIS-MIB::chStackUnitModelID.1 = STRING: S25-01-GE-24V if ($device['os'] == 'ftos' || $device['os_group'] == 'ftos' || $device['os'] == 'dnos') { echo 'FTOS C-Series '; $oids = snmpwalk_cache_oid($device, 'chStackUnitTemp', array(), 'F10-S-SERIES-CHASSIS-MIB', $config['mib_dir'] . ':' . $config['mib_dir'] . '/ftos'); $oids = snmpwalk_cache_oid($device, 'chStackUnitSysType', $oids, 'F10-S-SERIES-CHASSIS-MIB', $config['mib_dir'] . ':' . $config['mib_dir'] . '/ftos'); if (is_array($oids)) { foreach ($oids as $index => $entry) { $descr = 'Unit ' . $index . ' ' . $entry['chStackUnitSysType']; $oid = '.1.3.6.1.4.1.6027.3.10.1.2.2.1.14.' . $index; $current = $entry['chStackUnitTemp']; discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'ftos-sseries', $descr, '1', '1', null, null, null, null, $current); } } }
<?php if ($device['os'] == 'gamatronicups') { for ($i = 1; $i <= 3; $i++) { $volt_oid = "GAMATRONIC-MIB::gamatronicLTD.5.4.1.1.2.{$i}"; $descr = "Input Phase {$i}"; $volt = snmp_get($device, $volt_oid, '-Oqv'); $type = 'gamatronicups'; $divisor = 1; $index = $i; $lowlimit = 0; $limit = null; discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $volt); } for ($i = 1; $i <= 3; $i++) { $volt_oid = "GAMATRONIC-MIB::gamatronicLTD.5.5.1.1.2.{$i}"; $descr = "Output Phase {$i}"; $volt = snmp_get($device, $volt_oid, '-Oqv'); $type = 'gamatronicups'; $divisor = 1; $index = 100 + $i; $lowlimit = 0; $limit = null; discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $volt); } }
} else { $limits = array(); } $temperature_oid = ".1.3.6.1.4.1.18248.20.1.2.1.1.2.1"; discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, 1, 'papouch-th2e', "Temperature", $scale, $temperature * $scale, $limits); } $temperature = snmp_get($device, "1.3.6.1.4.1.18248.20.1.2.1.1.2.3", "-Oqv"); if (is_numeric($temperature) && $temperature > 0) { if (snmp_get($device, "1.3.6.1.4.1.18248.20.1.3.1.1.1.3", "-Oqv")) { $limits = array('limit_low' => snmp_get($device, "1.3.6.1.4.1.18248.20.1.3.1.1.2.3", "-Oqv") * $scale); // The MIB is invalid and I can't find the max value in snmpwalk :[ *sigh* // Hysteresis parameter value is in SNMPv2-SMI::enterprises.18248.20.1.3.1.1.3.3 = INTEGER: 100 } else { $limits = array(); } $temperature_oid = ".1.3.6.1.4.1.18248.20.1.2.1.1.2.3"; discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, "3", 'papouch-th2e', "Dew Point", $scale, $temperature * $scale, $limits); } $humidity = snmp_get($device, "1.3.6.1.4.1.18248.20.1.2.1.1.2.1", "-Oqv"); if (is_numeric($humidity) && $humidity > 0) { if (snmp_get($device, "1.3.6.1.4.1.18248.20.1.2.1.1.1.2", "-Oqv")) { $limits = array('limit_low' => snmp_get($device, "1.3.6.1.4.1.18248.20.1.3.1.1.2.2", "-Oqv") * $scale); // The MIB is invalid and I can't find the max value in snmpwalk :[ *sigh* // Hysteresis parameter value is in SNMPv2-SMI::enterprises.18248.20.1.3.1.1.3.2 = INTEGER: 100 } else { $limits = array(); } $humidity_oid = ".1.3.6.1.4.1.18248.20.1.2.1.1.2.2"; discover_sensor($valid['sensor'], 'humidity', $device, $humidity_oid, 1, 'papouch-th2e', "Humidity", $scale, $humidity * $scale, $limits); } // EOF
d_echo($oids . "\n"); list($unused, $numPhase) = explode(' ', $oids); for ($i = 1; $i <= $numPhase; $i++) { $current_oid = "1.3.6.1.2.1.33.1.3.3.1.4.{$i}"; $descr = 'Input'; if ($numPhase > 1) { $descr .= " Phase {$i}"; } $precision = 10; $current = snmp_get($device, $current_oid, '-Oqv') / $precision; $type = 'rfc1628'; $index = 100 + $i; discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', null, null, null, null, $current); } $oids = trim(snmp_walk($device, '1.3.6.1.2.1.33.1.5.2.0', '-OsqnU')); d_echo($oids . "\n"); list($unused, $numPhase) = explode(' ', $oids); for ($i = 1; $i <= $numPhase; $i++) { $current_oid = "1.3.6.1.2.1.33.1.5.3.1.3.{$i}"; $descr = 'Bypass'; if ($numPhase > 1) { $descr .= " Phase {$i}"; } $precision = 10; $current = snmp_get($device, $current_oid, '-Oqv') / $precision; $type = 'rfc1628'; $index = 200 + $i; discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', null, null, null, null, $current); } } //end if
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage discovery * @copyright (C) 2006-2014 Adam Armstrong * */ echo " ALCATEL-IND1-HEALTH-MIB "; $descr = "Chassis Temperature"; $oid = ".1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.17.0"; $value = snmp_get($device, $oid, "-Oqv"); if (is_numeric($value) && $value > 0) { discover_sensor($valid['sensor'], 'temperature', $device, $oid, 1, 'alcatel-device', $descr, 1, 1, NULL, NULL, NULL, NULL, $value); } // EOF
<?php if ($device['os'] == "junos" || $device['os_group'] == "junos") { echo "JunOS "; $oids = snmp_walk($device, "1.3.6.1.4.1.2636.3.1.13.1.7", "-Osqn", "JUNIPER-MIB", $config['install_dir'] . "/mibs/junos"); $oids = trim($oids); foreach (explode("\n", $oids) as $data) { $data = trim($data); $data = substr($data, 29); if ($data) { list($oid) = explode(" ", $data); $temperature_oid = "1.3.6.1.4.1.2636.3.1.13.1.7.{$oid}"; $descr_oid = "1.3.6.1.4.1.2636.3.1.13.1.5.{$oid}"; $descr = snmp_get($device, $descr_oid, "-Oqv", "JUNIPER-MIB", '+' . $config['install_dir'] . "/mibs/junos"); $temperature = snmp_get($device, $temperature_oid, "-Oqv", "JUNIPER-MIB", '+' . $config['install_dir'] . "/mibs/junos"); if (!strstr($descr, "No") && !strstr($temperature, "No") && $descr != "" && $temperature != "0") { $descr = str_replace("\"", "", $descr); $descr = str_replace("temperature", "", $descr); $descr = str_replace("temperature", "", $descr); $descr = str_replace("sensor", "", $descr); $descr = trim($descr); discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, $oid, 'junos', $descr, '1', '1', NULL, NULL, NULL, NULL, $temperature); } } } }