start of adding basic support for the servertech sentry4 cdus

I agree to the conditions of the Contributor Agreement
    contained in doc/General/Contributing.md.
This commit is contained in:
Vikram Adukia
2016-06-14 18:21:16 -07:00
parent 3d8e75a216
commit 5b9fb7db5a
5 changed files with 4541 additions and 1 deletions

View File

@@ -106,6 +106,7 @@ LibreNMS contributors:
- Marc Runkel <marc@runkel.org> (mrunkel)
- Josh Driver <keeperofdakeys@gmail.com> (keeperofdakeys)
- Felix Eckhofer <felix@eckhofer.com> (tribut)
- Vikram Adukia <adukia@dropbox.com> (justmedude)
[1]: http://observium.org/ "Observium web site"
Observium was written by:

View File

@@ -1401,6 +1401,13 @@ $config['os'][$os]['over'][0]['graph'] = 'device_current';
$config['os'][$os]['over'][0]['text'] = 'Current';
$config['os'][$os]['icon'] = 'servertech';
$os = 'sentry4';
$config['os'][$os]['text'] = 'ServerTech Sentry4';
$config['os'][$os]['type'] = 'power';
$config['os'][$os]['over'][0]['graph'] = 'device_current';
$config['os'][$os]['over'][0]['text'] = 'Current';
$config['os'][$os]['icon'] = 'servertech';
$os = 'raritan';
$config['os'][$os]['text'] = 'Raritan PDU';
$config['os'][$os]['type'] = 'power';

View File

@@ -2,6 +2,18 @@
if (!$os) {
if (preg_match('/^Sentry\ (Switched|Smart) /', $sysDescr)) {
$os = 'sentry3';
// ServerTech doesn't have a way to distinguish between sentry3 and sentry4 devices
// Hopefully, we can use the version string to figure it out
$version = trim(snmp_get($device, 'Sentry3-MIB::serverTech.4.1.1.1.3.0', '-Osqnv'));
$version = explode(" ", $version)[1];
$version = intval($version);
// It appears that version 8 and up is good for sentry4
if ($version >= 8) {
$os = 'sentry4';
} else {
$os = 'sentry3';
}
}
}

View File

@@ -0,0 +1,54 @@
<?php
/*
* Copyright (c) 2016 Dropbox, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
if ($device['os'] == 'sentry4') {
$oids = snmp_walk($device, 'st4TempSensorValue', '-Osqn', 'Sentry4-MIB');
d_echo($oids."\n");
$oids = trim($oids);
$divisor = '10';
$multiplier = '1';
if ($oids) {
echo 'ServerTech Sentry4 Temperature ';
}
foreach (explode("\n", $oids) as $data) {
$data = trim($data);
if ($data) {
list($oid,$descr) = explode(' ', $data, 2);
$split_oid = explode('.', $oid);
$index = $split_oid[(count($split_oid) - 1)];
// Sentry4-MIB::st4TempSensorValue
$temperature_oid = '1.3.6.1.4.1.1718.4.1.9.3.1.1.1.'.$index;
$descr = 'Removable Sensor '.$index;
$low_warn_limit = (snmp_get($device, "st4TempSensorLowWarning.1.$index", '-Ovq', 'Sentry4-MIB') / $divisor);
$low_limit = (snmp_get($device, "st4TempSensorLowAlarm.1.$index", '-Ovq', 'Sentry4-MIB') / $divisor);
$high_warn_limit = (snmp_get($device, "st4TempSensorHighWarning.1.$index", '-Ovq', 'Sentry4-MIB') / $divisor);
$high_limit = (snmp_get($device, "st4TempSensorHighAlarm.1.$index", '-Ovq', 'Sentry4-MIB') / $divisor);
$current = (snmp_get($device, "$temperature_oid", '-Ovq', 'Sentry4-MIB') / $divisor);
if ($current >= 0) {
discover_sensor($valid['sensor'], 'temperature', $device,
$temperature_oid, $index, 'sentry4',
$descr, $divisor, $multiplier, $low_limit, $low_warn_limit,
$high_warn_limit, $high_limit, $current);
}
}
}
}

4466
mibs/Sentry4.mib Normal file

File diff suppressed because it is too large Load Diff