Skip to content

Commit

Permalink
device: Added temp and humidity sesors + serial for websensor (rename…
Browse files Browse the repository at this point in the history
…d from cometsystem-p85xx) (#7854)
  • Loading branch information
laf committed Dec 11, 2017
1 parent c22c879 commit 9601324
Show file tree
Hide file tree
Showing 8 changed files with 640 additions and 8 deletions.
8 changes: 0 additions & 8 deletions includes/definitions/cometsystem-p85xx.yaml

This file was deleted.

10 changes: 10 additions & 0 deletions includes/definitions/websensor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
os: websensor
text: 'Comet System Web Sensor'
type: environment
icon: comet
mib_dir:
- comet
over:
- { graph: device_temperature, text: temperature }
discovery:
- sysObjectId: .1.3.6.1.4.1.22626.1.
34 changes: 34 additions & 0 deletions includes/discovery/sensors/humidity/websensor.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* websensor.inc.php
*
* LibreNMS humidity sensor discovery module for Comet System Web Sensor
*
* 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 <gh+n@laf.io>
*/

if (is_numeric($pre_cache['websensor_valuesInt']['humInt.0'])) {
$humidity_oid = '.1.3.6.1.4.1.22626.1.2.3.2.0';
$humidity_index = 'humInt.0';
$descr = 'Humidity';
$humidity = $pre_cache['websensor_valuesInt']['humInt.0'] / 10;
$high_limit = $pre_cache['websensor_settings']['humHighInt.0'] / 10;
$low_limit = $pre_cache['websensor_settings']['humLowInt.0'] / 10;
discover_sensor($valid['sensor'], 'humidity', $device, $humidity_oid, $humidity_index, 'websensor', $descr, '10', '1', $low_limit, null, null, $high_limit, $humidity);
}
27 changes: 27 additions & 0 deletions includes/discovery/sensors/pre-cache/websensor.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
/**
* websensor.inc.php
*
* LibreNMS pre-cache sensor discovery module for Comet System Web Sensor
*
* 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 <gh+n@laf.io>
*/

$pre_cache['websensor_valuesInt'] = snmpwalk_group($device, 'valuesInt', 'T3610-MIB');
$pre_cache['websensor_settings'] = snmpwalk_group($device, 'settings', 'T3610-MIB');
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,20 @@
}
}
}

$temp_unit = snmp_get($device, 'tempUnit.0', '-OevTQUs', 'T3610-MIB');
$user_func = '';

if (str_contains($temp_unit, 'F')) {
$user_func = 'fahrenheit_to_celsius';
}

if (is_numeric($pre_cache['websensor_valuesInt']['tempInt.0'])) {
$temperature_oid = '.1.3.6.1.4.1.22626.1.2.3.1.0';
$temperature_index = 'tempInt.0';
$descr = 'Temperature';
$temperature = $pre_cache['websensor_valuesInt']['tempInt.0'] / 10;
$high_limit = $pre_cache['websensor_settings']['tempHighInt.0'] / 10;
$low_limit = $pre_cache['websensor_settings']['tempLowInt.0'] / 10;
discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, $temperature_index, 'websensor', $descr, '10', '1', $low_limit, null, null, $high_limit, $temperature, 'snmp', null, null, $user_func);
}
26 changes: 26 additions & 0 deletions includes/polling/os/websensor.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/**
* websensor.inc.php
*
* LibreNMS OS poller module for Comet System Web Sensor
*
* 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 <gh+n@laf.io>
*/

$serial = snmp_get($device, 'serialNumber.0', '-OevTQUs', 'T3610-MIB');
Loading

0 comments on commit 9601324

Please sign in to comment.