mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 10:28:13 +00:00
newdevice: Added further health support for Netbotz devices (#6529)
This commit is contained in:
parent
e7e5d51b30
commit
72a0d8202a
@ -365,7 +365,7 @@ function sensor_low_limit($class, $current)
|
||||
break;
|
||||
|
||||
case 'humidity':
|
||||
$limit = '70';
|
||||
$limit = '30';
|
||||
break;
|
||||
|
||||
case 'frequency':
|
||||
@ -387,6 +387,9 @@ function sensor_low_limit($class, $current)
|
||||
case 'signal':
|
||||
$limit = -80;
|
||||
break;
|
||||
case 'airflow':
|
||||
$limit = ($current * 0.95);
|
||||
break;
|
||||
}//end switch
|
||||
|
||||
return $limit;
|
||||
@ -438,6 +441,9 @@ function sensor_limit($class, $current)
|
||||
case 'load':
|
||||
$limit = 80;
|
||||
break;
|
||||
case 'airflow':
|
||||
$limit = ($current * 1.05);
|
||||
break;
|
||||
}//end switch
|
||||
|
||||
return $limit;
|
||||
|
43
includes/discovery/sensors/airflow/netbotz.inc.php
Normal file
43
includes/discovery/sensors/airflow/netbotz.inc.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* netbotz.inc.php
|
||||
*
|
||||
* LibreNMS airflow discovery module for Netbotz
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 Neil Lathwood
|
||||
* @author Neil Lathwood <neil@lathwood.co.uk>
|
||||
*/
|
||||
|
||||
d_echo($pre_cache['netbotz_airflow']);
|
||||
|
||||
if (is_array($pre_cache['netbotz_airflow'])) {
|
||||
echo 'NetBotz ';
|
||||
foreach ($pre_cache['netbotz_airflow'] as $index => $data) {
|
||||
if ($data['airFlowSensorValue']) {
|
||||
$divisor = 10;
|
||||
$multiplier = 1;
|
||||
$value = $data['airFlowSensorValue'] / $divisor;
|
||||
$oid = '.1.3.6.1.4.1.5528.100.4.1.5.1.2.' . $index;
|
||||
$index = 'airFlowSensorValue.' . $index;
|
||||
$descr = $data['airFlowSensorLabel'];
|
||||
if (is_numeric($value)) {
|
||||
discover_sensor($valid['sensor'], 'airflow', $device, $oid, $index, 'netbotz', $descr, $divisor, $multiplier, null, null, null, null, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
30
includes/discovery/sensors/pre-cache/netbotz.inc.php
Normal file
30
includes/discovery/sensors/pre-cache/netbotz.inc.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* netbotz.inc.php
|
||||
*
|
||||
* LibreNMS pre-cache discovery module for Netbotz
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 Neil Lathwood
|
||||
* @author Neil Lathwood <neil@lathwood.co.uk>
|
||||
*/
|
||||
|
||||
$pre_cache['netbotz_airflow'] = snmpwalk_cache_oid($device, 'airFlowSensorTable', array(), 'NETBOTZV2-MIB');
|
||||
$pre_cache['netbotz_temperature'] = snmpwalk_cache_oid($device, 'dewPointSensorTable', array(), 'NETBOTZV2-MIB');
|
||||
$pre_cache['netbotz_state'] = snmpwalk_cache_oid($device, 'dryContactSensorTable', array(), 'NETBOTZV2-MIB', null, '-OeQUs');
|
||||
$pre_cache['netbotz_state'] = snmpwalk_cache_oid($device, 'doorSwitchSensorTable', $pre_cache['netbotz_state'], 'NETBOTZV2-MIB', null, '-OeQUs');
|
||||
$pre_cache['netbotz_state'] = snmpwalk_cache_oid($device, 'cameraMotionSensorTable', $pre_cache['netbotz_state'], 'NETBOTZV2-MIB', null, '-OeQUs');
|
@ -49,3 +49,54 @@ if (is_array($temp)) {
|
||||
create_sensor_to_state_index($device, $state_name, $index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($pre_cache['netbotz_state'] as $index => $data) {
|
||||
if (is_array($data)) {
|
||||
$tmp_keys = array_keys($data);
|
||||
$state_name = str_replace('Id', '', $tmp_keys[0]);
|
||||
$state_index_id = create_state_index($state_name);
|
||||
if ($state_name === 'cameraMotionSensor') {
|
||||
$states = array(
|
||||
array($state_index_id, 'null', 0, -1, 3),
|
||||
array($state_index_id, 'noMotion', 0, 0, 0),
|
||||
array($state_index_id, 'motionDetected', 0, 1, 2),
|
||||
);
|
||||
$oid = '.1.3.6.1.4.1.5528.100.4.2.3.1.2.';
|
||||
} elseif ($state_name === 'doorSwitchSensor') {
|
||||
$states = array(
|
||||
array($state_index_id, 'null', 0, -1, 3),
|
||||
array($state_index_id, 'open', 0, 0, 0),
|
||||
array($state_index_id, 'closed', 0, 1, 2),
|
||||
);
|
||||
$oid = '.1.3.6.1.4.1.5528.100.4.2.2.1.2.';
|
||||
} elseif ($state_name === 'dryContactSensor') {
|
||||
$states = array(
|
||||
array($state_index_id, 'null', 0, -1, 3),
|
||||
array($state_index_id, 'open', 0, 0, 0),
|
||||
array($state_index_id, 'closed', 0, 1, 2),
|
||||
);
|
||||
$oid = '.1.3.6.1.4.1.5528.100.4.2.1.1.2.';
|
||||
}
|
||||
if ($state_index_id !== null) {
|
||||
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');
|
||||
}
|
||||
}
|
||||
$cur_oid = $oid . $index;
|
||||
$index = $state_name . '.' . $index;
|
||||
$descr = $data[$state_name . 'Label'];
|
||||
$value = $data[$state_name . 'Value'];
|
||||
if (isset($value)) {
|
||||
discover_sensor($valid['sensor'], 'state', $device, $cur_oid, $index, $state_name, $descr, 1, 1, null, null, null, null, $value);
|
||||
create_sensor_to_state_index($device, $state_name, $index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,3 +19,22 @@ if ($oids) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
d_echo($pre_cache['netbotz_temperature']);
|
||||
|
||||
if (is_array($pre_cache['netbotz_temperature'])) {
|
||||
echo 'NetBotz ';
|
||||
foreach ($pre_cache['netbotz_temperature'] as $index => $data) {
|
||||
if ($data['dewPointSensorValue']) {
|
||||
$divisor = 10;
|
||||
$multiplier = 1;
|
||||
$value = $data['dewPointSensorValue'] / $divisor;
|
||||
$oid = '.1.3.6.1.4.1.5528.100.4.1.3.1.2.' . $index;
|
||||
$index = 'dewPointSensorValue.' . $index;
|
||||
$descr = $data['dewPointSensorLabel'];
|
||||
if (is_numeric($value)) {
|
||||
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'netbotz', $descr, $divisor, $multiplier, null, null, null, null, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
7831
mibs/netbotz/NETBOTZV2-MIB
Normal file
7831
mibs/netbotz/NETBOTZV2-MIB
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user