Add support for Ingrasys iPoMan 1201 + minor fixes

git-svn-id: http://www.observium.org/svn/observer/trunk@1726 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-11-19 22:46:24 +00:00
parent 349cd58779
commit f5c7d989f6
16 changed files with 4813 additions and 6 deletions

View File

@ -25,6 +25,10 @@ function authenticate($username,$password)
}
}
}
else
{
echo ldap_error($ds);
}
}
else
{

View File

@ -156,7 +156,7 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
header("Content-type: image/".$_GET['format']);
} elseif ($_GET['format'] == "svg") {
header("Content-type: image/svg+xml");
$img = str_replace("<a ", "<a target = \"_parent\" ", $img);
$img = str_replace("<a ", '<a target="_parent" ', $img);
}
echo("$img");
}

View File

@ -7,7 +7,7 @@ if($total = mysql_result(mysql_query("SELECT count(sensor_id) from sensors WHERE
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/icons/current.png'> Current</p>");
$i = '1';
$currents = mysql_query("SELECT * FROM sensors WHERE sensor_class='current' AND device_id = '" . $device['device_id'] . "'");
$currents = mysql_query("SELECT * FROM sensors WHERE sensor_class='current' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_index");
echo("<table width=100% valign=top>");
while($current = mysql_fetch_array($currents)) {
if(is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }

View File

@ -24,7 +24,7 @@ if($total = mysql_result(mysql_query("SELECT count(sensor_id) from sensors WHERE
$humidity_year = "graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
$humidity_minigraph = "<img src='graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=80&height=20&bg=$graph_colour' align='absmiddle'>";
$humidity_link = "<a href='device/".$device['device_id']."/health/humiditys/' onmouseover=\"return ";
$humidity_link = "<a href='device/".$device['device_id']."/health/humidity/' onmouseover=\"return ";
$humidity_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$humidity['sensor_descr'];
$humidity_link .= "</div><div style=\'width: 750px\'><img src=\'$humidity_day\'><img src=\'$humidity_week\'><img src=\'$humidity_month\'><img src=\'$humidity_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
@ -34,7 +34,7 @@ if($total = mysql_result(mysql_query("SELECT count(sensor_id) from sensors WHERE
$humidity['sensor_descr'] = truncate($humidity['sensor_descr'], 25, '');
echo("<tr bgcolor='$row_colour'><td class=tablehead><strong>$humidity_link_a</strong></td><td width=80 align=right class=tablehead>$humidity_link_b<td width=80 align=right class=tablehead>$humidity_link_c</td></tr>");
if($i == $rows) { echo("</table></td><td valign=top><table width=100% cellspacing=0 cellpadding=2>"); }
# if($i == $rows) { echo("</table></td><td valign=top><table width=100% cellspacing=0 cellpadding=2>"); }
$i++;
}
echo("</table>");

View File

@ -7,7 +7,7 @@ if($total = mysql_result(mysql_query("SELECT count(sensor_id) from sensors WHERE
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/icons/voltages.png'> Voltages</p>");
$i = '1';
$volts = mysql_query("SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '" . $device['device_id'] . "'");
$volts = mysql_query("SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_index");
echo("<table width=100% valign=top>");
while($volt = mysql_fetch_array($volts)) {
if(is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }

View File

@ -8,7 +8,7 @@ if($_SESSION['userlevel'] >= '5') {
$query = mysql_query($sql);
$graph_type = "humidity";
$graph_type = "sensor_humidity";
echo('<table cellspacing="0" cellpadding="6" width="100%">');

View File

@ -0,0 +1,61 @@
<?php
global $valid_sensor, $ipoman_array;
## IPOMANII-MIB
if ($device['os'] == "ipoman")
{
echo(" IPOMANII-MIB ");
if(!is_array($ipoman_array))
{
echo("outletConfigDesc ");
$ipoman_array['out'] = snmpwalk_cache_multi_oid($device, "outletConfigDesc", $ipoman_array['out'], "IPOMANII-MIB");
echo("outletConfigLocation ");
$ipoman_array['out'] = snmpwalk_cache_multi_oid($device, "outletConfigLocation", $ipoman_array['out'], "IPOMANII-MIB");
echo("inletConfigDesc ");
$ipoman_array['in'] = snmpwalk_cache_multi_oid($device, "inletConfigDesc", $ipoman_array, "IPOMANII-MIB");
}
$oids_in = array();
$oids_out = array();
echo("inletConfigCurrentHigh ");
$oids_in = snmpwalk_cache_multi_oid($device, "inletConfigCurrentHigh", $oids_in, "IPOMANII-MIB");
echo("inletStatusCurrent ");
$oids_in = snmpwalk_cache_multi_oid($device, "inletStatusCurrent", $oids_in, "IPOMANII-MIB");
// $oids_in = snmpwalk_cache_multi_oid($device, "inletStatusKwatt", $oids_in, "IPOMANII-MIB"); // Not implemented yet in Obs?
echo("outletConfigCurrentHigh ");
$oids_out = snmpwalk_cache_multi_oid($device, "outletConfigCurrentHigh", $oids_out, "IPOMANII-MIB");
echo("outletStatusCurrent ");
$oids_out = snmpwalk_cache_multi_oid($device, "outletStatusCurrent", $oids_out, "IPOMANII-MIB");
// $oids_out = snmpwalk_cache_multi_oid($device, "outletStatusKwatt", $oids_out, "IPOMANII-MIB"); // See above
if(is_array($oids_in))
{
foreach($oids_in as $index => $entry)
{
$cur_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.3.' . $index;
$divisor = 1000;
$descr = (trim($ipoman_array['in'][$index]['inletConfigDesc'],'"') != '' ? trim($ipoman_array['in'][$index]['inletConfigDesc'],'"') : "Inlet $index");
$current = $entry['inletStatusCurrent'] / $divisor;
$high_limit = $entry['inletConfigCurrentHigh'];
echo discover_sensor($valid_sensor, 'current', $device, $cur_oid, '1.3.1.3.'.$index, 'ipoman', $descr, $divisor, '1', NULL, NULL, NULL, $high_limit, $current);
# FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf?
}
}
if(is_array($oids_out))
{
foreach($oids_out as $index => $entry)
{
$cur_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.2.3.1.3.' . $index;
$divisor = 1000;
$descr = (trim($ipoman_array['out'][$index]['outletConfigDesc'],'"') != '' ? trim($ipoman_array['out'][$index]['outletConfigDesc'],'"') : "Output $index");
$current = $entry['outletStatusCurrent'] / $divisor;
$high_limit = $entry['outletConfigCurrentHigh'];
echo discover_sensor($valid_sensor, 'current', $device, $cur_oid, '2.3.1.3.'.$index, $type, $descr, $divisor, '1', NULL, NULL, NULL, $high_limit, $current);
}
}
}
?>

View File

@ -92,4 +92,6 @@ if(is_array($oids))
}
}
echo("\n");
?>

View File

@ -0,0 +1,44 @@
<?php
global $valid_sensor, $ipoman_array;
## IPOMANII-MIB
if ($device['os'] == "ipoman")
{
echo(" IPOMANII-MIB ");
if(!is_array($ipoman_array))
{
echo("outletConfigDesc ");
$ipoman_array['out'] = snmpwalk_cache_multi_oid($device, "outletConfigDesc", $ipoman_array['out'], "IPOMANII-MIB");
echo("outletConfigLocation ");
$ipoman_array['out'] = snmpwalk_cache_multi_oid($device, "outletConfigLocation", $ipoman_array['out'], "IPOMANII-MIB");
echo("inletConfigDesc ");
$ipoman_array['in'] = snmpwalk_cache_multi_oid($device, "inletConfigDesc", $ipoman_array['in'], "IPOMANII-MIB");
}
$oids = array();
echo("inletConfigFrequencyHigh ");
$oids = snmpwalk_cache_multi_oid($device, "inletConfigFrequencyHigh", $oids, "IPOMANII-MIB");
echo("inletConfigFrequencyLow ");
$oids = snmpwalk_cache_multi_oid($device, "inletConfigFrequencyLow", $oids, "IPOMANII-MIB");
echo("inletStatusFrequency ");
$oids = snmpwalk_cache_multi_oid($device, "inletStatusFrequency", $oids, "IPOMANII-MIB");
if(is_array($oids))
{
foreach($oids as $index => $entry)
{
$freq_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.4.' . $index;
$divisor = 10;
$descr = (trim($ipoman_array['in'][$index]['inletConfigDesc'],'"') != '' ? trim($ipoman_array['in'][$index]['inletConfigDesc'],'"') : "Inlet $index");
$current = $entry['inletStatusFrequency'] / 10;
$low_limit = $entry['inletConfigFrequencyLow'];
$high_limit = $entry['inletConfigFrequencyHigh'];
echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, 'ipoman', $descr, $divisor, '1', $low_limit, NULL, NULL, $high_limit, $current);
# FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf?
}
}
}
?>

View File

@ -0,0 +1,29 @@
<?php
# FIXME: EMD "stack" support
# FIXME: What to do with IPOMANII-MIB::ipmEnvEmdConfigHumiOffset.0 ?
global $valid_sensor;
if ($device['os'] == "ipoman")
{
echo(" IPOMANII-MIB ");
$emd_installed = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdStatusEmdType.0"," -Oqv");
if ($emd_installed == 'eMD-HT')
{
$descr = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdConfigHumiName.0", "-Oqv");
$current = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdStatusHumidity.0", "-Oqv") / 10;
$high_limit = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdConfigHumiHighSetPoint.0", "-Oqv");
$low_limit = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdConfigHumiLowSetPoint.0", "-Oqv");
if ($descr != "" && is_numeric($current) && $current > "0")
{
$current_oid = ".1.3.6.1.4.1.2468.1.4.2.1.5.1.1.3.0";
$descr = trim(str_replace("\"", "", $descr));
discover_sensor($valid_sensor, 'humidity', $device, $current_oid, "1", 'ipoman', $descr, '10', '1', $low_limit, NULL, NULL, $high_limit, $current);
}
}
}
?>

View File

@ -0,0 +1,8 @@
<?php
if(!$os)
{
if (strstr($sysObjectId, "1.3.6.1.4.1.2468.1.4.2.1")) { $os = "ipoman"; }
}
?>

View File

@ -0,0 +1,29 @@
<?php
# FIXME: EMD "stack" support
# FIXME: What to do with IPOMANII-MIB::ipmEnvEmdConfigTempOffset.0 ?
global $valid_sensor;
if ($device['os'] == "ipoman")
{
echo(" IPOMANII-MIB ");
$emd_installed = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdStatusEmdType.0"," -Oqv");
if ($emd_installed != 'disabled')
{
$descr = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdConfigTempName.0", "-Oqv");
$current = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdStatusTemperature.0", "-Oqv") / 10;
$high_limit = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdConfigTempHighSetPoint.0", "-Oqv");
$low_limit = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdConfigTempLowSetPoint.0", "-Oqv");
if ($descr != "" && is_numeric($current) && $current > "0")
{
$current_oid = ".1.3.6.1.4.1.2468.1.4.2.1.5.1.1.2.0";
$descr = trim(str_replace("\"", "", $descr));
discover_sensor($valid_sensor, 'temperature', $device, $current_oid, "1", 'ipoman', $descr, '10', '1', $low_limit, NULL, NULL, $high_limit, $current);
}
}
}
?>

View File

@ -0,0 +1,44 @@
<?php
global $valid_sensor, $ipoman_array;
## IPOMANII-MIB
if ($device['os'] == "ipoman")
{
echo(" IPOMANII-MIB ");
if(!is_array($ipoman_array))
{
echo("outletConfigDesc ");
$ipoman_array['out'] = snmpwalk_cache_multi_oid($device, "outletConfigDesc", $ipoman_array['out'], "IPOMANII-MIB");
echo("outletConfigLocation ");
$ipoman_array['out'] = snmpwalk_cache_multi_oid($device, "outletConfigLocation", $ipoman_array['out'], "IPOMANII-MIB");
echo("inletConfigDesc ");
$ipoman_array['in'] = snmpwalk_cache_multi_oid($device, "inletConfigDesc", $ipoman_array['in'], "IPOMANII-MIB");
}
$oids = array();
echo("inletConfigVoltageHigh ");
$oids = snmpwalk_cache_multi_oid($device, "inletConfigVoltageHigh", $oids, "IPOMANII-MIB");
echo("inletConfigVoltageLow ");
$oids = snmpwalk_cache_multi_oid($device, "inletConfigVoltageLow", $oids, "IPOMANII-MIB");
echo("inletStatusVoltage ");
$oids = snmpwalk_cache_multi_oid($device, "inletStatusVoltage", $oids, "IPOMANII-MIB");
if(is_array($oids))
{
foreach($oids as $index => $entry)
{
$volt_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.2.' . $index;
$divisor = 10;
$descr = (trim($ipoman_array['in'][$index]['inletConfigDesc'],'"') != '' ? trim($ipoman_array['in'][$index]['inletConfigDesc'],'"') : "Inlet $index");
$current = $entry['inletStatusVoltage'] / 10;
$low_limit = $entry['inletConfigVoltageLow'];
$high_limit = $entry['inletConfigVoltageHigh'];
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, 'ipoman', $descr, $divisor, '1', $low_limit, NULL, NULL, $high_limit, $current);
# FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf?
}
}
}
?>

View File

@ -0,0 +1,10 @@
<?php
# IPOMANII-MIB::ipmIdentAgentSoftwareVersion.0 = STRING: "PDU System v1.06 (SN 11130141042005)"
$SoftwareVersion = trim(snmp_get($device, "ipmIdentAgentSoftwareVersion.0", "-OQv", "IPOMANII-MIB"),'" ');
preg_match("/v(.*) \(SN (.*)\)/", $SoftwareVersion, $matches);
if ($matches[1]) { $version = $matches[1]; }
if ($matches[2]) { $serial = $matches[2]; }
?>

View File

@ -499,6 +499,12 @@ $config['os'][$os]['type'] = "environment";
$config['os'][$os]['over'][0]['graph'] = "device_temperatures";
$config['os'][$os]['over'][0]['text'] = "Temperatures";
$os = "ipoman";
$config['os'][$os]['text'] = "Ingrasys iPoMan";
$config['os'][$os]['type'] = "power";
$config['os'][$os]['over'][0]['graph'] = "device_current";
$config['os'][$os]['over'][0]['text'] = "Current";
$os = "wxgoos";
$config['os'][$os]['text'] = "ITWatchDogs Goose";
$config['os'][$os]['type'] = "environment";

4570
mibs/IPOMANII-MIB Normal file

File diff suppressed because it is too large Load Diff