Finished dell rac support and updated mib

This commit is contained in:
laf
2015-05-19 01:04:17 +01:00
parent c332e17c3a
commit 57a08a0ade
10 changed files with 2920 additions and 21 deletions

View File

@ -0,0 +1,9 @@
<?php
$class = "state";
$unit = "";
$unit_long = "State";
include("includes/graphs/device/sensor.inc.php");
?>

View File

@ -0,0 +1,17 @@
<?php
$scale_min = "0";
$scale_max = "10";
include("includes/graphs/common.inc.php");
$rrd_options .= " COMMENT:' Min Max Last\\n'";
$rrd_options .= " DEF:sensor=$rrd_filename:sensor:AVERAGE";
$rrd_options .= " LINE1.5:sensor#cc0000:'" . rrdtool_escape($sensor['sensor_descr'],21)."'";
$rrd_options .= " GPRINT:sensor:MIN:%4.1lf";
$rrd_options .= " GPRINT:sensor:MAX:%4.1lf";
$rrd_options .= " GPRINT:sensor:LAST:%4.1lf\\\\l";
if (is_numeric($sensor['sensor_limit'])) $rrd_options .= " HRULE:".$sensor['sensor_limit']."#999999::dashes";
if (is_numeric($sensor['sensor_limit_low'])) $rrd_options .= " HRULE:".$sensor['sensor_limit_low']."#999999::dashes";

View File

@ -14,6 +14,7 @@ $current = dbFetchCell("select count(*) from sensors WHERE sensor_class='cu
$freqs = dbFetchCell("select count(*) from sensors WHERE sensor_class='frequency' AND device_id = ?", array($device['device_id']));
$power = dbFetchCell("select count(*) from sensors WHERE sensor_class='power' AND device_id = ?", array($device['device_id']));
$dBm = dbFetchCell("select count(*) from sensors WHERE sensor_class='dBm' AND device_id = ?", array($device['device_id']));
$states = dbFetchCell("select count(*) from sensors WHERE sensor_class='state' AND device_id = ?", array($device['device_id']));
unset($datas);
$datas[] = 'overview';
@ -30,6 +31,7 @@ if ($freqs) { $datas[] = 'frequency'; }
if ($current) { $datas[] = 'current'; }
if ($power) { $datas[] = 'power'; }
if ($dBm) { $datas[] = 'dbm'; }
if ($states) { $datas[] = 'state'; }
$type_text['overview'] = "Overview";
$type_text['charge'] = "Battery Charge";
@ -45,6 +47,7 @@ $type_text['frequency'] = "Frequency";
$type_text['current'] = "Current";
$type_text['power'] = "Power";
$type_text['dbm'] = "dBm";
$type_text['state'] = "State";
$link_array = array('page' => 'device',
'device' => $device['device_id'],

View File

@ -0,0 +1,7 @@
<?php
$class = "state";
$unit = "";
$graph_type = "sensor_state";
include("sensors.inc.php");

View File

@ -19,5 +19,6 @@ include("includes/discovery/power.inc.php");
include("includes/discovery/fanspeeds.inc.php");
include("includes/discovery/charge.inc.php");
include("includes/discovery/load.inc.php");
include "includes/discovery/states.inc.php";
?>

View File

@ -0,0 +1,26 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
*
* 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.
*/
echo "States: ";
$include_dir = "includes/discovery/states";
include("includes/include-dir.inc.php");
if ($debug) {
print_r($valid['sensor']['states']);
}
check_valid_sensors($device, 'states', $valid['sensor']);
echo "\n";

View File

@ -0,0 +1,31 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
*
* 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'] == "linux") {
$oids = snmp_walk($device, "virtualDiskNumber", "-Oesqn", "StorageManagement-MIB");
$main_oid = ".1.3.6.1.4.1.674.10893.1.20.140.1.1.";
if ($debug) {
echo $oids."\n";
}
$oids = trim($oids);
if ($oids) {
echo "Dell ";
foreach (explode("\n", $oids) as $data) {
list($oid,) = explode(" ", $data, 2);
$state_oid = "4.1";
$state_current = snmp_get($device, $main_oid.$state_oid, "-Oevq");
discover_sensor($valid['sensor'], 'state', $device, $main_oid.$state_oid, "virtualDiskState.$state_oid", 'dell', 'Raid State', '1', '1', NULL, NULL, NULL, NULL, $state_current);
}
}
}

View File

@ -34,6 +34,8 @@ function poll_sensor($device, $class, $unit)
sleep(1); # Give the TME some time to reset
}
}
} elseif ($class == "state") {
$sensor_value = trim(str_replace("\"", "", snmp_walk($device, $sensor['sensor_oid'], "-Oevq", "SNMPv2-MIB")));
} else {
if ($sensor['sensor_type'] == 'apc') {
$sensor_value = trim(str_replace("\"", "", snmp_walk($device, $sensor['sensor_oid'], "-OUqnv", "SNMPv2-MIB:PowerNet-MIB$mib")));

View File

@ -22,7 +22,8 @@ $supported_sensors = array('current' => 'A',
'temperature' => 'C',
'dbm' => 'dBm',
'charge' => '%',
'load' => '%'
'load' => '%',
'state' => '#',
);
foreach ($supported_sensors as $sensor_type => $sensor_unit)

File diff suppressed because it is too large Load Diff