mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
Merge pull request #1045 from NURDspace/raritan
Raritan PX iPDU inlet support
This commit is contained in:
@@ -8,6 +8,30 @@ if ($device['os'] == 'raritan')
|
||||
$outlet_divisor = $divisor;
|
||||
$multiplier = "1";
|
||||
|
||||
// Check Inlets
|
||||
$inlet_oids = snmp_walk($device,"inletLabel","-Osqn","PDU2-MIB");
|
||||
$inlet_oids = trim($inlet_oids);
|
||||
if ($inlet_oids) echo("PDU Inlet ");
|
||||
foreach (explode("\n", $inlet_oids) as $inlet_data)
|
||||
{
|
||||
$inlet_data = trim($inlet_data);
|
||||
if ($inlet_data)
|
||||
{
|
||||
list($inlet_oid,$inlet_descr) = explode(" ", $inlet_data,2);
|
||||
$inlet_split_oid = explode('.', $inlet_oid);
|
||||
$inlet_index = $inlet_split_oid[count($inlet_split_oid)-2].".".$inlet_split_oid[count($inlet_split_oid)-1];
|
||||
|
||||
$inlet_oid = ".1.3.6.1.4.1.13742.6.5.2.3.1.4.$inlet_index.1";
|
||||
$inlet_divisor = pow(10,snmp_get($device, "inletSensorDecimalDigits.$inlet_index.rmsCurrent", "-Ovq","PDU2-MIB"));
|
||||
$inlet_current = snmp_get($device, "measurementsInletSensorValue.$inlet_index.1", "-Ovq","PDU2-MIB") / $inlet_divisor;
|
||||
|
||||
if ($inlet_current >= 0) {
|
||||
discover_sensor($valid['sensor'], 'current', $device, $inlet_oid, $inlet_index, 'raritan', $inlet_descr, $inlet_divisor, $multiplier, NULL, NULL, NULL, NULL, $inlet_current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
# Check for per-outlet polling
|
||||
$outlet_oids = snmp_walk($device, "outletIndex", "-Osqn", "PDU-MIB");
|
||||
@@ -53,4 +77,3 @@ if ($device['os'] == 'raritan')
|
||||
} // foreach (explode("\n", $outlet_oids) as $outlet_data)
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
if ($device['os'] == 'raritan')
|
||||
{
|
||||
// Check Inlets
|
||||
$inlet_oids = snmp_walk($device,"inletLabel","-Osqn","PDU2-MIB");
|
||||
$inlet_oids = trim($inlet_oids);
|
||||
if ($inlet_oids) echo("PDU Inlet ");
|
||||
foreach (explode("\n", $inlet_oids) as $inlet_data)
|
||||
{
|
||||
$inlet_data = trim($inlet_data);
|
||||
if ($inlet_data)
|
||||
{
|
||||
list($inlet_oid,$inlet_descr) = explode(" ", $inlet_data,2);
|
||||
$inlet_split_oid = explode('.', $inlet_oid);
|
||||
$inlet_index = $inlet_split_oid[count($inlet_split_oid)-2].".".$inlet_split_oid[count($inlet_split_oid)-1];
|
||||
|
||||
$inlet_oid = ".1.3.6.1.4.1.13742.6.5.2.3.1.4.$inlet_index.23";
|
||||
$inlet_divisor = pow(10,snmp_get($device, "inletSensorDecimalDigits.$inlet_index.frequency", "-Ovq","PDU2-MIB"));
|
||||
$inlet_frequency = snmp_get($device, "measurementsInletSensorValue.$inlet_index.frequency", "-Ovq", "PDU2-MIB") / $inlet_divisor;
|
||||
|
||||
if ($inlet_frequency >= 0) {
|
||||
discover_sensor($valid['sensor'], 'frequency', $device, $inlet_oid, $inlet_index, 'raritan', $inlet_descr, $inlet_divisor, 1, NULL, NULL, NULL, NULL, $inlet_frequency);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,11 @@ if (!$os)
|
||||
if (strstr($sysDescr, "Raritan")) { $os = "raritan"; }
|
||||
}
|
||||
|
||||
if (!$os)
|
||||
{
|
||||
if (strstr($sysDescr, "PX2")) { $os = "raritan"; }
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
if ($device['os'] == 'raritan')
|
||||
{
|
||||
// Check Inlets
|
||||
$inlet_oids = snmp_walk($device,"inletLabel","-Osqn","PDU2-MIB");
|
||||
$inlet_oids = trim($inlet_oids);
|
||||
if ($inlet_oids) echo("PDU Inlet ");
|
||||
foreach (explode("\n", $inlet_oids) as $inlet_data)
|
||||
{
|
||||
$inlet_data = trim($inlet_data);
|
||||
if ($inlet_data)
|
||||
{
|
||||
list($inlet_oid,$inlet_descr) = explode(" ", $inlet_data,2);
|
||||
$inlet_split_oid = explode('.', $inlet_oid);
|
||||
$inlet_index = $inlet_split_oid[count($inlet_split_oid)-2].".".$inlet_split_oid[count($inlet_split_oid)-1];
|
||||
|
||||
$inlet_oid = ".1.3.6.1.4.1.13742.6.5.2.3.1.4.$inlet_index.5";
|
||||
$inlet_divisor = pow(10,snmp_get($device, "inletSensorDecimalDigits.$inlet_index.activePower", "-Ovq","PDU2-MIB"));
|
||||
$inlet_power = snmp_get($device, "measurementsInletSensorValue.$inlet_index.activePower", "-Ovq", "PDU2-MIB") / $inlet_divisor;
|
||||
|
||||
if ($inlet_power >= 0) {
|
||||
discover_sensor($valid['sensor'], 'power', $device, $inlet_oid, $inlet_index, 'raritan', $inlet_descr, $inlet_divisor, 1, NULL, NULL, NULL, NULL, $inlet_power);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10832
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user