mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-03 08:01:38 +02:00
automatically load all temperature include files, moved almost all of them over to internal snmp functions, PLEASE TEST
git-svn-id: http://www.observium.org/svn/observer/trunk@1325 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -4,9 +4,9 @@
|
|||||||
if($device['os'] == "junos")
|
if($device['os'] == "junos")
|
||||||
{
|
{
|
||||||
echo("JUNOS : ");
|
echo("JUNOS : ");
|
||||||
$processors_array = snmpwalk_cache_multi_oid($device, "jnxOperatingCPU", $processors_array, "JUNIPER-MIB" , "+".$config['install_dir']."/mibs/junos");
|
$processors_array = snmpwalk_cache_multi_oid($device, "jnxOperatingCPU", $processors_array, "JUNIPER-MIB" , '+'.$config['install_dir']."/mibs/junos");
|
||||||
$processors_array = snmpwalk_cache_multi_oid($device, "jnxOperatingDRAMSize", $processors_array, "JUNIPER-MIB" , "+".$config['install_dir']."/mibs/junos");
|
$processors_array = snmpwalk_cache_multi_oid($device, "jnxOperatingDRAMSize", $processors_array, "JUNIPER-MIB" , '+'.$config['install_dir']."/mibs/junos");
|
||||||
$processors_array = snmpwalk_cache_multi_oid($device, "jnxOperatingDescr", $processors_array, "JUNIPER-MIB" , "+".$config['install_dir']."/mibs/junos");
|
$processors_array = snmpwalk_cache_multi_oid($device, "jnxOperatingDescr", $processors_array, "JUNIPER-MIB" , '+'.$config['install_dir']."/mibs/junos");
|
||||||
if($debug) { print_r($processors_array); }
|
if($debug) { print_r($processors_array); }
|
||||||
|
|
||||||
if(is_array($processors_array[$device['device_id']])) {
|
if(is_array($processors_array[$device['device_id']])) {
|
||||||
|
|||||||
@@ -9,19 +9,7 @@ echo("Temperatures : ");
|
|||||||
|
|
||||||
$valid_temp = array();
|
$valid_temp = array();
|
||||||
|
|
||||||
#include("temperatures/adva.inc.php"); ## Disabled needing rewrite
|
include_dir("includes/discovery/temperatures");
|
||||||
include("temperatures/akcp.inc.php");
|
|
||||||
include("temperatures/areca.inc.php");
|
|
||||||
include("temperatures/cisco-envmon.inc.php");
|
|
||||||
include("temperatures/dell.inc.php");
|
|
||||||
include("temperatures/ironware.inc.php");
|
|
||||||
include("temperatures/junose.inc.php");
|
|
||||||
include("temperatures/junos.inc.php");
|
|
||||||
include("temperatures/lm-sensors.inc.php");
|
|
||||||
include("temperatures/netmanplus.inc.php");
|
|
||||||
include("temperatures/observer-custom.inc.php");
|
|
||||||
include("temperatures/papouch-tme.inc.php");
|
|
||||||
include("temperatures/supermicro.inc.php");
|
|
||||||
|
|
||||||
if($debug) { print_r($valid_temp); }
|
if($debug) { print_r($valid_temp); }
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
|
Disabled needing rewrite
|
||||||
|
|
||||||
$id = $device['device_id'];
|
$id = $device['device_id'];
|
||||||
$hostname = $device['hostname'];
|
$hostname = $device['hostname'];
|
||||||
$community = $device['community'];
|
$community = $device['community'];
|
||||||
@@ -81,4 +84,5 @@
|
|||||||
}
|
}
|
||||||
$temp_exists[] = "$id $oid_hss2";
|
$temp_exists[] = "$id $oid_hss2";
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
global $valid_temp;
|
||||||
|
|
||||||
if($device['os'] == "akcp" || $device['os'] == "minkelsrms")
|
if ($device['os'] == "akcp" || $device['os'] == "minkelsrms")
|
||||||
{
|
{
|
||||||
$oids = snmp_walk($device, ".1.3.6.1.4.1.3854.1.2.2.1.16.1.4", "-Osqn", "");
|
$oids = snmp_walk($device, ".1.3.6.1.4.1.3854.1.2.2.1.16.1.4", "-Osqn", "");
|
||||||
if ($debug) { echo($oids."\n"); }
|
if ($debug) { echo($oids."\n"); }
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if($device['os'] == "areca") {
|
global $valid_temp;
|
||||||
$oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -$snmpver -CI -Osqn -c $community $hostname:$port SNMPv2-SMI::enterprises.18928.1.1.2.14.1.2");
|
|
||||||
|
if ($device['os'] == "areca")
|
||||||
|
{
|
||||||
|
$oids = snmp_walk($device, "1.3.6.1.4.1.18928.1.1.2.14.1.2", "-Osqn", "");
|
||||||
if ($debug) { echo($oids."\n"); }
|
if ($debug) { echo($oids."\n"); }
|
||||||
$oids = trim($oids);
|
$oids = trim($oids);
|
||||||
if ($oids) echo("Areca Harddisk ");
|
if ($oids) echo("Areca Harddisk ");
|
||||||
@@ -14,7 +17,7 @@
|
|||||||
$split_oid = explode('.',$oid);
|
$split_oid = explode('.',$oid);
|
||||||
$temp_id = $split_oid[count($split_oid)-1];
|
$temp_id = $split_oid[count($split_oid)-1];
|
||||||
$temp_oid = "1.3.6.1.4.1.18928.1.1.2.14.1.2.$temp_id";
|
$temp_oid = "1.3.6.1.4.1.18928.1.1.2.14.1.2.$temp_id";
|
||||||
$temp = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $temp_oid"));
|
$temp = snmp_get($device, $temp_oid, "-Oqv", "");
|
||||||
$descr = "Hard disk $temp_id";
|
$descr = "Hard disk $temp_id";
|
||||||
if ($temp != -128) # -128 = not measured/present
|
if ($temp != -128) # -128 = not measured/present
|
||||||
{
|
{
|
||||||
@@ -41,6 +44,6 @@
|
|||||||
discover_temperature($valid_temp, $device, $oid, $index, $type, trim($descr,'"'), $precision, NULL, NULL, $current);
|
discover_temperature($valid_temp, $device, $oid, $index, $type, trim($descr,'"'), $precision, NULL, NULL, $current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if($device['os'] == "ios" || $device['os_group'] == "ios")
|
global $valid_temp;
|
||||||
|
|
||||||
|
if ($device['os'] == "ios" || $device['os_group'] == "ios")
|
||||||
{
|
{
|
||||||
echo("Cisco ");
|
echo("Cisco ");
|
||||||
$oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m CISCO-ENVMON-MIB -$snmpver -CI -Osqn -c $community $hostname:$port .1.3.6.1.4.1.9.9.13.1.3.1.2 | sed s/.1.3.6.1.4.1.9.9.13.1.3.1.2.//g");
|
$oids = snmp_walk($device, ".1.3.6.1.4.1.9.9.13.1.3.1.2", "-Osqn", "CISCO-ENVMON-MIB");
|
||||||
|
$oids = str_replace('.1.3.6.1.4.1.9.9.13.1.3.1.2.','',$oids);
|
||||||
$oids = trim($oids);
|
$oids = trim($oids);
|
||||||
foreach(explode("\n", $oids) as $data)
|
foreach(explode("\n", $oids) as $data)
|
||||||
{
|
{
|
||||||
@@ -25,9 +28,6 @@ if($device['os'] == "ios" || $device['os_group'] == "ios")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
global $valid_temp;
|
||||||
|
|
||||||
if (strstr($device['hardware'], "dell"))
|
if (strstr($device['hardware'], "dell"))
|
||||||
{
|
{
|
||||||
$oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m MIB-Dell-10892 -$snmpver -CI -Osqn -c $community $hostname:$port .1.3.6.1.4.1.674.10892.1.700.20.1.8");
|
$oids = snmp_walk($device, ".1.3.6.1.4.1.674.10892.1.700.20.1.8", "-Osqn", "MIB-Dell-10892");
|
||||||
$oids = trim($oids);
|
$oids = trim($oids);
|
||||||
if ($oids) echo("Dell OMSA ");
|
if ($oids) echo("Dell OMSA ");
|
||||||
foreach(explode("\n",$oids) as $oid)
|
foreach(explode("\n",$oids) as $oid)
|
||||||
@@ -11,7 +13,7 @@ if (strstr($device['hardware'], "dell"))
|
|||||||
list($oid) = explode(" ", $oid);
|
list($oid) = explode(" ", $oid);
|
||||||
if ($oid != "")
|
if ($oid != "")
|
||||||
{
|
{
|
||||||
$descr_query = $config['snmpget'] . " -M " . $config['mibdir'] . " -m MIB-Dell-10892 -$snmpver -Onvq -c $community $hostname:$port .1.3.6.1.4.1.674.10892.1.700.20.1.8.$oid";
|
$descr_query = snmp_get($device, ".1.3.6.1.4.1.674.10892.1.700.20.1.8.$oid", "-Onvq", "MIB-Dell-10892");
|
||||||
$descr = trim(str_replace("\"", "", shell_exec($descr_query)));
|
$descr = trim(str_replace("\"", "", shell_exec($descr_query)));
|
||||||
$fulloid = ".1.3.6.1.4.1.674.10892.1.700.20.1.6.$oid";
|
$fulloid = ".1.3.6.1.4.1.674.10892.1.700.20.1.6.$oid";
|
||||||
discover_temperature($valid_temp, $device, $fulloid, $oid, "dell", $descr, "10", NULL, NULL, NULL);
|
discover_temperature($valid_temp, $device, $fulloid, $oid, "dell", $descr, "10", NULL, NULL, NULL);
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if($device['os'] == "ironware") {
|
global $valid_temp;
|
||||||
|
|
||||||
|
if($device['os'] == "ironware")
|
||||||
|
{
|
||||||
echo("IronWare ");
|
echo("IronWare ");
|
||||||
$oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -$snmpver -CI -Osqn -m FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB -c $community $hostname:$port snAgentTempSensorDescr");
|
$oids = snmp_walk($device,"snAgentTempSensorDescr","-Osqn","FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB");
|
||||||
$oids = trim($oids);
|
$oids = trim($oids);
|
||||||
$oids = str_replace(".1.3.6.1.4.1.1991.1.1.2.13.1.1.3.", "", $oids);
|
$oids = str_replace(".1.3.6.1.4.1.1991.1.1.2.13.1.1.3.", "", $oids);
|
||||||
foreach(explode("\n", $oids) as $data)
|
foreach(explode("\n", $oids) as $data)
|
||||||
@@ -13,8 +16,8 @@
|
|||||||
list($oid) = explode(" ", $data);
|
list($oid) = explode(" ", $data);
|
||||||
$temp_oid = ".1.3.6.1.4.1.1991.1.1.2.13.1.1.4.$oid";
|
$temp_oid = ".1.3.6.1.4.1.1991.1.1.2.13.1.1.4.$oid";
|
||||||
$descr_oid = ".1.3.6.1.4.1.1991.1.1.2.13.1.1.3.$oid";
|
$descr_oid = ".1.3.6.1.4.1.1991.1.1.2.13.1.1.3.$oid";
|
||||||
$descr = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $descr_oid"));
|
$descr = snmp_get($device,$descr_oid,"-Oqv","");
|
||||||
$temp = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $temp_oid"));
|
$temp = snmp_get($device,$temp_oid,"-Oqv","");
|
||||||
if (!strstr($descr, "No") && !strstr($temp, "No") && $descr != "" && $temp != "0")
|
if (!strstr($descr, "No") && !strstr($temp, "No") && $descr != "" && $temp != "0")
|
||||||
{
|
{
|
||||||
$descr = str_replace("\"", "", $descr);
|
$descr = str_replace("\"", "", $descr);
|
||||||
@@ -30,6 +33,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
global $valid_temp;
|
||||||
|
|
||||||
if ($device['os'] == "junos" || $device['os_group'] == "junos")
|
if ($device['os'] == "junos" || $device['os_group'] == "junos")
|
||||||
{
|
{
|
||||||
echo("JunOS ");
|
echo("JunOS ");
|
||||||
$oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -M +".$config['install_dir']."/mibs/junos -m JUNIPER-MIB -$snmpver -CI -Osqn -c $community $hostname:$port 1.3.6.1.4.1.2636.3.1.13.1.7");
|
$oids = snmp_walk($device,"1.3.6.1.4.1.2636.3.1.13.1.7","-Osqn","JUNIPER-MIB", '+'.$config['install_dir']."/mibs/junos");
|
||||||
$oids = trim($oids);
|
$oids = trim($oids);
|
||||||
foreach(explode("\n", $oids) as $data)
|
foreach(explode("\n", $oids) as $data)
|
||||||
{
|
{
|
||||||
@@ -14,8 +16,8 @@ if ($device['os'] == "junos" || $device['os_group'] == "junos")
|
|||||||
list($oid) = explode(" ", $data);
|
list($oid) = explode(" ", $data);
|
||||||
$temp_oid = "1.3.6.1.4.1.2636.3.1.13.1.7.$oid";
|
$temp_oid = "1.3.6.1.4.1.2636.3.1.13.1.7.$oid";
|
||||||
$descr_oid = "1.3.6.1.4.1.2636.3.1.13.1.5.$oid";
|
$descr_oid = "1.3.6.1.4.1.2636.3.1.13.1.5.$oid";
|
||||||
$descr = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -M +".$config['install_dir']."/mibs/junos -m JUNIPER-MIB -O qv -$snmpver -c $community $hostname:$port $descr_oid"));
|
$descr = snmp_get($device,$descr_oid,"-Oqv","JUNIPER-MIB", '+'.$config['install_dir']."/mibs/junos");
|
||||||
$temp = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -M +".$config['install_dir']."/mibs/junos -m JUNIPER-MIB -O qv -$snmpver -c$community $hostname:$port $temp_oid"));
|
$temp = snmp_get($device,$temp_oid,"-Oqv","JUNIPER-MIB", '+'.$config['install_dir']."/mibs/junos");
|
||||||
if (!strstr($descr, "No") && !strstr($temp, "No") && $descr != "" && $temp != "0")
|
if (!strstr($descr, "No") && !strstr($temp, "No") && $descr != "" && $temp != "0")
|
||||||
{
|
{
|
||||||
$descr = str_replace("\"", "", $descr);
|
$descr = str_replace("\"", "", $descr);
|
||||||
@@ -25,11 +27,9 @@ if ($device['os'] == "junos" || $device['os_group'] == "junos")
|
|||||||
$descr = trim($descr);
|
$descr = trim($descr);
|
||||||
|
|
||||||
discover_temperature($valid_temp, $device, $temp_oid, $oid, "junos", $descr, "1", NULL, NULL, $temp);
|
discover_temperature($valid_temp, $device, $temp_oid, $oid, "junos", $descr, "1", NULL, NULL, $temp);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
global $valid_temp;
|
||||||
|
|
||||||
## JunOSe Temperatures
|
## JunOSe Temperatures
|
||||||
|
|
||||||
if ($device['os'] == "junose")
|
if ($device['os'] == "junose")
|
||||||
{
|
{
|
||||||
echo("JunOSe: ");
|
echo("JunOSe: ");
|
||||||
$oids = snmpwalk_cache_multi_oid($device, "juniSystemTempValue", array(), "Juniper-System-MIB", "+".$config['install_dir']."/mibs/junose");
|
$oids = snmpwalk_cache_multi_oid($device, "juniSystemTempValue", array(), "Juniper-System-MIB", "+".$config['install_dir']."/mibs/junose");
|
||||||
if(is_array($oids[$device['device_id']])) {
|
if(is_array($oids[$device['device_id']]))
|
||||||
foreach($oids[$device[device_id]] as $index => $entry) {
|
{
|
||||||
if(is_numeric($entry['juniSystemTempValue']) && is_numeric($index) && $entry['juniSystemTempValue'] > "0") {
|
foreach($oids[$device[device_id]] as $index => $entry)
|
||||||
|
{
|
||||||
|
if(is_numeric($entry['juniSystemTempValue']) && is_numeric($index) && $entry['juniSystemTempValue'] > "0")
|
||||||
|
{
|
||||||
$entPhysicalIndex = snmp_get($device, "juniSystemTempPhysicalIndex.".$index, "-Oqv", "Juniper-System-MIB", "+".$config['install_dir']."/mibs/junose");
|
$entPhysicalIndex = snmp_get($device, "juniSystemTempPhysicalIndex.".$index, "-Oqv", "Juniper-System-MIB", "+".$config['install_dir']."/mibs/junose");
|
||||||
$descr = snmp_get($device, "entPhysicalDescr.".$entPhysicalIndex, "-Oqv", "ENTITY-MIB");
|
$descr = snmp_get($device, "entPhysicalDescr.".$entPhysicalIndex, "-Oqv", "ENTITY-MIB");
|
||||||
$descr = preg_replace("/^Juniper\ [0-9a-zA-Z\-]+/", "", $descr); ## Wipe out ugly Juniper crap. Why put vendor and model in here? Idiots!
|
$descr = preg_replace("/^Juniper\ [0-9a-zA-Z\-]+/", "", $descr); ## Wipe out ugly Juniper crap. Why put vendor and model in here? Idiots!
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if($device['os'] == "linux")
|
global $valid_temp;
|
||||||
|
|
||||||
|
if ($device['os'] == "linux")
|
||||||
{
|
{
|
||||||
## FIX ME SNMP_WALK
|
$oids = snmp_walk($device, "lmTempSensorsDevice", "-Osqn", "LM-SENSORS-MIB");
|
||||||
$oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m LM-SENSORS-MIB -$snmpver -CI -Osqn -c $community $hostname:$port lmTempSensorsDevice");
|
|
||||||
if ($debug) { echo($oids."\n"); }
|
if ($debug) { echo($oids."\n"); }
|
||||||
$oids = trim($oids);
|
$oids = trim($oids);
|
||||||
if ($oids) echo("LM-SENSORS ");
|
if ($oids) echo("LM-SENSORS ");
|
||||||
@@ -25,8 +26,6 @@ if($device['os'] == "linux")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
global $valid_temp;
|
||||||
|
|
||||||
if($device['os'] == "netmanplus")
|
if($device['os'] == "netmanplus")
|
||||||
{
|
{
|
||||||
$oids = snmp_walk($device, "1.3.6.1.2.1.33.1.2.7", "-Osqn", "UPS-MIB");
|
$oids = snmp_walk($device, "1.3.6.1.2.1.33.1.2.7", "-Osqn", "UPS-MIB");
|
||||||
@@ -20,7 +22,6 @@ if($device['os'] == "netmanplus")
|
|||||||
discover_temperature($valid_temp, $device, $temp_oid, $temp_id, "netmanplus", $descr, 1, NULL, NULL, $temp);
|
discover_temperature($valid_temp, $device, $temp_oid, $temp_id, "netmanplus", $descr, 1, NULL, NULL, $temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if($device['os_group'] == "unix") {
|
global $valid_temp;
|
||||||
|
|
||||||
|
if($device['os_group'] == "unix")
|
||||||
|
{
|
||||||
|
# FIXME snmp_walk
|
||||||
# Observer-style temperature
|
# Observer-style temperature
|
||||||
$oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -M " . $config['mibdir'] . " -$snmpver -m SNMPv2-SMI -Osqn -CI -c $community $hostname:$port .1.3.6.1.4.1.2021.7891 | sed s/.1.3.6.1.4.1.2021.7891.// | grep '.1.1 ' | grep -v '.101.' | cut -d'.' -f 1");
|
$oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -M " . $config['mibdir'] . " -".$device['snmpver']." -m SNMPv2-SMI -Osqn -CI -c ".$device['community']." ".$device['hostname'].":".$device['port']." .1.3.6.1.4.1.2021.7891 | sed s/.1.3.6.1.4.1.2021.7891.// | grep '.1.1 ' | grep -v '.101.' | cut -d'.' -f 1");
|
||||||
$oids = trim($oids);
|
$oids = trim($oids);
|
||||||
if ($oids) echo("Observer-Style ");
|
if ($oids) echo("Observer-Style ");
|
||||||
foreach(explode("\n",$oids) as $oid)
|
foreach(explode("\n",$oids) as $oid)
|
||||||
@@ -11,12 +14,13 @@
|
|||||||
$oid = trim($oid);
|
$oid = trim($oid);
|
||||||
if ($oid != "")
|
if ($oid != "")
|
||||||
{
|
{
|
||||||
$descr_query = $config['snmpget'] . " -M " . $config['mibdir'] . " -$snmpver -m SNMPv2-SMI -Osqn -c $community $hostname:$port .1.3.6.1.4.1.2021.7891.$oid.2.1 | sed s/.1.3.6.1.4.1.2021.7891.$oid.2.1\ //";
|
# FIXME snmp_get
|
||||||
|
$descr_query = $config['snmpget'] . " -M " . $config['mibdir'] . " -".$device['snmpver']." -m SNMPv2-SMI -Osqn -c ".$device['community']." ".$device['hostname'].":".$device['port']." .1.3.6.1.4.1.2021.7891.$oid.2.1 | sed s/.1.3.6.1.4.1.2021.7891.$oid.2.1\ //";
|
||||||
$descr = trim(str_replace("\"", "", shell_exec($descr_query)));
|
$descr = trim(str_replace("\"", "", shell_exec($descr_query)));
|
||||||
$fulloid = ".1.3.6.1.4.1.2021.7891.$oid.101.1";
|
$fulloid = ".1.3.6.1.4.1.2021.7891.$oid.101.1";
|
||||||
discover_temperature($valid_temp, $device, $fulloid, $oid, "observer", $descr, "1", NULL, NULL, NULL);
|
discover_temperature($valid_temp, $device, $fulloid, $oid, "observer", $descr, "1", NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,21 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if($device['os'] == "papouch-tme") {
|
global $valid_temp;
|
||||||
|
|
||||||
|
if ($device['os'] == "papouch-tme")
|
||||||
|
{
|
||||||
echo("Papouch TME ");
|
echo("Papouch TME ");
|
||||||
#$descr = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port SNMPv2-SMI::enterprises.18248.1.1.3.0"));
|
|
||||||
#$temp = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port SNMPv2-SMI::enterprises.18248.1.1.1.0")) / 10;
|
|
||||||
|
|
||||||
$descr = snmp_get($device, "SNMPv2-SMI::enterprises.18248.1.1.3.0", "-Oqv");
|
$descr = snmp_get($device, "SNMPv2-SMI::enterprises.18248.1.1.3.0", "-Oqv");
|
||||||
$temp = snmp_get($device, "SNMPv2-SMI::enterprises.18248.1.1.1.0", "-Oqv") / 10;
|
$temp = snmp_get($device, "SNMPv2-SMI::enterprises.18248.1.1.1.0", "-Oqv") / 10;
|
||||||
|
|
||||||
if (!strstr($descr, "No") && !strstr($temp, "No") && $descr != "" && $temp != "0")
|
if ($descr != "" && $temp != "0")
|
||||||
{
|
{
|
||||||
$temp_oid = ".1.3.6.1.4.1.18248.1.1.1.0";
|
$temp_oid = ".1.3.6.1.4.1.18248.1.1.1.0";
|
||||||
$descr = trim(str_replace("\"", "", $descr));
|
$descr = trim(str_replace("\"", "", $descr));
|
||||||
discover_temperature($valid_temp, $device, $temp_oid, "1", "ironware", $descr, "10", NULL, NULL, $temp);
|
discover_temperature($valid_temp, $device, $temp_oid, "1", "ironware", $descr, "10", NULL, NULL, $temp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
global $valid_temp;
|
||||||
|
|
||||||
if($device['os'] == "linux")
|
if($device['os'] == "linux")
|
||||||
{
|
{
|
||||||
|
|
||||||
# Supermicro sensors
|
# Supermicro sensors
|
||||||
## FIX ME snmp_walk snmp_get needed
|
|
||||||
## Fix this shit if you can test it.
|
|
||||||
$oids = snmp_walk($device, "1.3.6.1.4.1.10876.2.1.1.1.1.3", "-Osqn", "SUPERMICRO-HEALTH-MIB");
|
$oids = snmp_walk($device, "1.3.6.1.4.1.10876.2.1.1.1.1.3", "-Osqn", "SUPERMICRO-HEALTH-MIB");
|
||||||
|
|
||||||
$oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m SUPERMICRO-HEALTH-MIB -$snmpver -CI -Osqn -c $community $hostname:$port 1.3.6.1.4.1.10876.2.1.1.1.1.3 | sed s/1.3.6.1.4.1.10876.2.1.1.1.1.3.//g");
|
|
||||||
$oids = trim($oids);
|
$oids = trim($oids);
|
||||||
if ($oids) echo("Supermicro ");
|
if ($oids) echo("Supermicro ");
|
||||||
foreach(explode("\n", $oids) as $data)
|
foreach(explode("\n", $oids) as $data)
|
||||||
@@ -17,22 +14,24 @@ if($device['os'] == "linux")
|
|||||||
if ($data)
|
if ($data)
|
||||||
{
|
{
|
||||||
list($oid,$type) = explode(" ", $data);
|
list($oid,$type) = explode(" ", $data);
|
||||||
|
$oid_ex = explode('.',$oid);
|
||||||
|
$index = $oid_ex[count($oid_ex)-1];
|
||||||
if ($type == 2)
|
if ($type == 2)
|
||||||
{
|
{
|
||||||
$temp_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.4$oid";
|
$temp_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.4.$index";
|
||||||
$descr_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.2$oid";
|
$descr_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.2.$index";
|
||||||
$limit_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.5$oid";
|
$limit_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.5.$index";
|
||||||
$divisor_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.9$oid";
|
$divisor_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.9.$index";
|
||||||
$monitor_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.10$oid";
|
$monitor_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.10.$index";
|
||||||
$descr = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m SUPERMICRO-HEALTH-MIB -O qv -$snmpver -c $community $hostname:$port $descr_oid"));
|
$descr = snmp_get($device, $descr_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||||
$temp = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m SUPERMICRO-HEALTH-MIB -O qv -$snmpver -c $community $hostname:$port $temp_oid"));
|
$temp = snmp_get($device, $temp_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||||
$limit = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m SUPERMICRO-HEALTH-MIB -O qv -$snmpver -c $community $hostname:$port $limit_oid"));
|
$limit = snmp_get($device, $limit_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||||
$divisor = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m SUPERMICRO-HEALTH-MIB -O qv -$snmpver -c $community $hostname:$port $divisor_oid"));
|
$divisor = snmp_get($device, $divisor_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB") || 1;
|
||||||
$monitor = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m SUPERMICRO-HEALTH-MIB -O qv -$snmpver -c $community $hostname:$port $monitor_oid"));
|
$monitor = snmp_get($device, $monitor_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||||
if ($monitor == 'true')
|
if ($monitor == 'true')
|
||||||
{
|
{
|
||||||
$descr = trim(str_ireplace("temperature", "", $descr));
|
$descr = trim(str_ireplace("temperature", "", $descr));
|
||||||
discover_temperature($valid_temp, $device, $temp_oid, trim($oid,'.'), "supermicro", $descr, $divisor, $limit, NULL, $temp);
|
discover_temperature($valid_temp, $device, $temp_oid, trim($index,'.'), "supermicro", $descr, $divisor, $limit, NULL, $temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -678,4 +678,23 @@ function isHexString($str)
|
|||||||
return preg_match("/^[a-f0-9][a-f0-9]( [a-f0-9][a-f0-9])*$/is",trim($str));
|
return preg_match("/^[a-f0-9][a-f0-9]( [a-f0-9][a-f0-9])*$/is",trim($str));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Include all .inc.php files in $dir
|
||||||
|
function include_dir($dir)
|
||||||
|
{
|
||||||
|
global $device, $config;
|
||||||
|
|
||||||
|
if ($handle = opendir($dir))
|
||||||
|
{
|
||||||
|
while (false !== ($file = readdir($handle)))
|
||||||
|
{
|
||||||
|
if (filetype($dir . '/' . $file) == 'file' && substr($file,strlen($file)-8) == '.inc.php')
|
||||||
|
{
|
||||||
|
include($dir . '/' . $file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closedir($handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user