本文整理汇总了PHP中discover_sensor函数的典型用法代码示例。如果您正苦于以下问题:PHP discover_sensor函数的具体用法?PHP discover_sensor怎么用?PHP discover_sensor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了discover_sensor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse_ipmitool_sensor
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;
}
示例2: foreach
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
示例3: snmp_get
<?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);
}
}
}
示例4: snmpwalk_array_num
* 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]);
}
}
示例5: get_dev_attrib
// 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');
示例6: snmp_get
<?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
示例7: array
* 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);
}
}
}
示例8: snmp_get
$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
示例9: d_echo
<?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);
}
}
示例10: array
<?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
示例11: array
}
// $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
示例12: snmpwalk_cache_oid
* @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) {
示例13: array
<?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
*/
}
示例14: celsius
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
示例15: snmp_get
/*
* LibreNMS Telco Systems Temperature Sensor Discovery module
*
* Copyright (c) 2016 Chris A. Evans <thecityofguanyu@outlook.com>
*
* 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);
}
}
}