mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
retooled sensors discovery. use global $valid_sensor, use sensors table only, replace sensor_precision with sensor_multiplier and sensor_divisor, remove all old discover_* functions and replace with discover_sensor
git-svn-id: http://www.observium.org/svn/observer/trunk@1529 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -41,10 +41,11 @@ CREATE TABLE IF NOT EXISTS `ports_adsl` ( `interface_id` int(11) NOT NULL, `po
|
||||
ALTER TABLE `devices` ADD `last_polled_timetaken` DOUBLE( 5, 2 ) NOT NULL AFTER `last_polled` , ADD `last_discovered_timetaken` DOUBLE( 5, 2 ) NOT NULL AFTER `last_polled_timetaken`;
|
||||
CREATE TABLE IF NOT EXISTS `perf_times` ( `type` varchar(8) NOT NULL, `doing` varchar(64) NOT NULL, `start` int(11) NOT NULL, `duration` double(5,2) NOT NULL, `devices` int(11) NOT NULL, KEY `type` (`type`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
## 0.10.7.1
|
||||
ALTER TABLE `bills` ADD `bill_autoadded` BOOLEAN NOT NULL DEFAULT '0'
|
||||
ALTER TABLE `bill_ports` ADD `bill_port_autoadded` BOOLEAN NOT NULL DEFAULT '0'
|
||||
ALTER TABLE `bills` ADD `bill_autoadded` BOOLEAN NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `bill_ports` ADD `bill_port_autoadded` BOOLEAN NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `sensors` CHANGE `sensor_precision` `sensor_divisor` INT( 11 ) NOT NULL DEFAULT '1'
|
||||
ALTER TABLE `sensors` ADD `sensor_multiplier` INT( 11 ) NOT NULL AFTER `sensor_divisor`;
|
||||
CREATE TABLE IF NOT EXISTS `device_graphs` ( `device_id` int(11) NOT NULL, `graph` varchar(32) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
DROP TABLE IF EXISTS `graph_types`;
|
||||
CREATE TABLE IF NOT EXISTS `graph_types` ( `graph_type` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `graph_subtype` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `graph_section` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `graph_descr` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `graph_order` int(11) NOT NULL, KEY `graph_type` (`graph_type`), KEY `graph_subtype` (`graph_subtype`), KEY `graph_section` (`graph_section`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
INSERT INTO `graph_types` (`graph_type`, `graph_subtype`, `graph_section`, `graph_descr`, `graph_order`) VALUES('device', 'bits', 'netstats', 'Total Traffic', 0),('device', 'hr_users', 'system', 'Users Logged In', 0),('device', 'ucd_load', 'system', 'Load Averages', 0),('device', 'ucd_cpu', 'system', 'Detailed Processor Usage', 0),('device', 'ucd_memory', 'system', 'Detailed Memory Usage', 0),('device', 'netstat_tcp', 'netstats', 'TCP Statistics', 0),('device', 'netstat_icmp_info', 'netstats', 'ICMP Informational Statistics', 0),('device', 'netstat_icmp_stat', 'netstats', 'ICMP Statistics', 0),('device', 'netstat_ip', 'netstats', 'IP Statistics', 0),('device', 'netstat_ip_frag', 'netstats', 'IP Fragmentation Statistics', 0),('device', 'netstat_udp', 'netstats', 'UDP Statistics', 0),('device', 'netstat_snmp', 'netstats', 'SNMP Statistics', 0),('device', 'temperatures', 'system', 'Temperatures', 0),('device', 'mempools', 'system', 'Memory Pool Usage', 0),('device', 'processors', 'system', 'Processor Usage', 0),('device', 'storage', 'system', 'Filesystem Usage', 0),('device', 'hr_processes', 'system', 'Running Processes', 0),('device', 'uptime', 'system', 'System Uptime', ''),('device', 'ipsystemstats_ipv4', 'netstats', 'IPv4 Packet Statistics', 0),('device', 'ipsystemstats_ipv6_frag', 'netstats', 'IPv6 Fragmentation Statistics', 0),('device', 'ipsystemstats_ipv6', 'netstats', 'IPv6 Packet Statistics', 0),('device', 'ipsystemstats_ipv4_frag', 'netstats', 'IPv4 Fragmentation Statistics', 0),('device', 'fortigate_sessions', 'firewall', 'Active Sessions', ''), ('device', 'screenos_settings', 'firewall', 'Active Sessions', '');
|
||||
|
||||
|
@@ -114,12 +114,13 @@ while ($device = mysql_fetch_array($device_query))
|
||||
include("includes/discovery/mempools.inc.php");
|
||||
include("includes/discovery/ipv4-addresses.inc.php");
|
||||
include("includes/discovery/ipv6-addresses.inc.php");
|
||||
include("includes/discovery/temperatures.inc.php");
|
||||
include("includes/discovery/humidity.inc.php");
|
||||
include("includes/discovery/voltages.inc.php");
|
||||
include("includes/discovery/frequencies.inc.php");
|
||||
include("includes/discovery/current.inc.php");
|
||||
include("includes/discovery/fanspeeds.inc.php");
|
||||
# include("includes/discovery/temperatures.inc.php");
|
||||
# include("includes/discovery/humidity.inc.php");
|
||||
# include("includes/discovery/voltages.inc.php");
|
||||
# include("includes/discovery/frequencies.inc.php");
|
||||
# include("includes/discovery/current.inc.php");
|
||||
# include("includes/discovery/fanspeeds.inc.php");
|
||||
include("includes/discovery/sensors.inc.php");
|
||||
include("includes/discovery/storage.inc.php");
|
||||
include("includes/discovery/hr-device.inc.php");
|
||||
include("includes/discovery/discovery-protocols.inc.php");
|
||||
|
@@ -1,12 +1,4 @@
|
||||
<?php
|
||||
$id = $device['device_id'];
|
||||
$hostname = $device['hostname'];
|
||||
$community = $device['community'];
|
||||
$snmpver = $device['snmpver'];
|
||||
$port = $device['port'];
|
||||
|
||||
$valid_current = array();
|
||||
|
||||
echo("Current : ");
|
||||
|
||||
## APC
|
||||
@@ -47,8 +39,7 @@ if ($device['os'] == "apc")
|
||||
{
|
||||
$descr = "Output";
|
||||
}
|
||||
|
||||
echo discover_current($valid_current,$device, $current_oid, $index, $type, $descr, $precision, $lowlimit, $warnlimit, $limit, $current);
|
||||
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +59,8 @@ if ($device['os'] == "apc")
|
||||
$warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
|
||||
$descr = "Output Feed";
|
||||
|
||||
echo discover_current($valid_current,$device, $current_oid, $index, $type, $descr, $precision, $lowlimit, $warnlimit, $limit, $current);
|
||||
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +88,9 @@ if ($device['os'] == "mgeups")
|
||||
$warnlimit = NULL;
|
||||
$lowlimit = 0;
|
||||
$limit = NULL;
|
||||
echo discover_current($valid_current,$device, $current_oid, $index, $type, $descr, $precision, $lowlimit, $warnlimit, $limit, $current);
|
||||
$lowwarnlimit = NULL;
|
||||
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current);
|
||||
|
||||
}
|
||||
$oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.6.1", "-OsqnU"));
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
@@ -118,7 +112,8 @@ if ($device['os'] == "mgeups")
|
||||
$warnlimit = NULL;
|
||||
$lowlimit = 0;
|
||||
$limit = NULL;
|
||||
echo discover_current($valid_current,$device, $current_oid, $index, $type, $descr, $precision, $lowlimit, $warnlimit, $limit, $current);
|
||||
$lowwarnlimit = NULL;
|
||||
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,11 +136,10 @@ if ($device['os'] == "netmanplus")
|
||||
$current_oid = "1.3.6.1.2.1.33.1.2.6.$current_id";
|
||||
$precision = 10;
|
||||
$current = snmp_get($device, $current_oid, "-O vq") / $precision;
|
||||
#$current = trim(shell_exec($config['snmpget'] . " -O qv -$snmpver -c $community $hostname:$port $current_oid")) / $precision;
|
||||
$descr = "Battery" . (count(explode("\n",$oids)) == 1 ? '' : ' ' . ($current_id+1));
|
||||
$type = "netmanplus";
|
||||
$index = 500+$current_id;
|
||||
discover_current($valid_current,$device, $current_oid, $index, $type, $descr, $precision, NULL, NULL, NULL, $current);
|
||||
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +154,7 @@ if ($device['os'] == "netmanplus")
|
||||
$type = "netmanplus";
|
||||
$precision = 1;
|
||||
$index = $i;
|
||||
echo discover_current($valid_current,$device, $current_oid, $index, $type, $descr, $precision, NULL, NULL, NULL, $current);
|
||||
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
|
||||
$oids = trim(snmp_walk($device, "1.3.6.1.2.1.33.1.3.2.0", "-OsqnU"));
|
||||
@@ -174,7 +168,7 @@ if ($device['os'] == "netmanplus")
|
||||
$type = "netmanplus";
|
||||
$precision = 1;
|
||||
$index = 100+$i;
|
||||
echo discover_current($valid_current,$device, $current_oid, $index, $type, $descr, $precision, NULL, NULL, NULL, $current);
|
||||
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
|
||||
$oids = trim(snmp_walk($device, "1.3.6.1.2.1.33.1.5.2.0", "-OsqnU"));
|
||||
@@ -188,7 +182,7 @@ if ($device['os'] == "netmanplus")
|
||||
$type = "netmanplus";
|
||||
$precision = 1;
|
||||
$index = 200+$i;
|
||||
echo discover_current($valid_current,$device, $current_oid, $index, $type, $descr, $precision, NULL, NULL, NULL, $current);
|
||||
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,8 +201,7 @@ if ($device['os'] == "gamatronicups") {
|
||||
$warnlimit = NULL;
|
||||
$limit = NULL;
|
||||
|
||||
echo discover_current($valid_current,$device, $current_oid, $index, $type, $descr, $precision, $lowlimit, $warnlimit, $limit, $current);
|
||||
|
||||
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', $lowlimit, NULL, NULL, NULL, $current);
|
||||
}
|
||||
|
||||
|
||||
@@ -224,32 +217,15 @@ if ($device['os'] == "gamatronicups") {
|
||||
$lowlimit = 0;
|
||||
$warnlimit = NULL;
|
||||
$limit = NULL;
|
||||
|
||||
echo discover_current($valid_current,$device, $current_oid, $index, $type, $descr, $precision, $lowlimit, $warnlimit, $limit, $current);
|
||||
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', $lowlimit, NULL, NULL, NULL, $current);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($debug) { print_r($valid['current']); }
|
||||
|
||||
## Delete removed sensors
|
||||
check_valid_sensors($device, 'current', $valid_sensor);
|
||||
|
||||
if($debug) { print_r($valid_current); }
|
||||
|
||||
$sql = "SELECT * FROM current WHERE device_id = '".$device['device_id']."'";
|
||||
if ($query = mysql_query($sql))
|
||||
{
|
||||
while ($test_current = mysql_fetch_array($query))
|
||||
{
|
||||
$index = $test_current['current_index'];
|
||||
$type = $test_current['current_type'];
|
||||
if($debug) { echo("$type -> $index\n"); }
|
||||
if(!$valid_current[$type][$index]) {
|
||||
echo("-");
|
||||
mysql_query("DELETE FROM `current` WHERE current_id = '" . $test_current['current_id'] . "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($valid_current); echo("\n");
|
||||
echo("\n");
|
||||
|
||||
?>
|
||||
|
@@ -1,30 +1,12 @@
|
||||
<?php
|
||||
|
||||
$valid_fan = array();
|
||||
|
||||
echo("Fanspeeds : ");
|
||||
|
||||
include_dir("includes/discovery/fanspeeds");
|
||||
|
||||
## Delete removed sensors
|
||||
if($debug) { print_r($valid['fanspeed']); }
|
||||
|
||||
if($debug) { echo("\n Checking ... \n"); print_r($valid_fan); }
|
||||
check_valid_sensors($device, 'fanspeed', $valid_sensor);
|
||||
|
||||
$sql = "SELECT * FROM sensors WHERE sensor_class='fanspeed' AND device_id = '".$device['device_id']."'";
|
||||
if ($query = mysql_query($sql))
|
||||
{
|
||||
while ($test_fan = mysql_fetch_array($query))
|
||||
{
|
||||
$fan_index = $test_fan['sensor_index'];
|
||||
$fan_type = $test_fan['sensor_type'];
|
||||
if($debug) { echo("$fan_type -> $fan_index\n"); }
|
||||
if(!$valid_fan[$fan_type][$fan_index]) {
|
||||
echo("-");
|
||||
mysql_query("DELETE FROM `fanspeed` WHERE sensor_id = '" . $test_fan['sensor_id'] . "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($valid_fan); echo("\n");
|
||||
echo("\n");
|
||||
|
||||
?>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
global $valid_fan;
|
||||
global $valid_sensor;
|
||||
|
||||
## Areca Fanspeeds
|
||||
if ($device['os'] == "areca")
|
||||
@@ -8,8 +8,6 @@ if ($device['os'] == "areca")
|
||||
$oids = snmp_walk($device, "1.3.6.1.4.1.18928.1.2.2.1.9.1.2", "-OsqnU", "");
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
if ($oids) echo("Areca ");
|
||||
$precision = 1;
|
||||
$type = "areca";
|
||||
foreach(explode("\n", $oids) as $data)
|
||||
{
|
||||
$data = trim($data);
|
||||
@@ -20,7 +18,7 @@ if ($device['os'] == "areca")
|
||||
$index = $split_oid[count($split_oid)-1];
|
||||
$oid = "1.3.6.1.4.1.18928.1.2.2.1.9.1.3." . $index;
|
||||
$current = snmp_get($device, $oid, "-Oqv", "") / $precision;
|
||||
discover_fan($valid_fan,$device, $oid, $index, $type, trim($descr,'"'), $precision, NULL, NULL, $current);
|
||||
discover_sensor($valid_sensor, 'fanspeed', $device, $oid, $index, 'areca', $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
global $valid_fan;
|
||||
global $valid_sensor;
|
||||
|
||||
## LMSensors Fanspeeds
|
||||
if ($device['os'] == "linux")
|
||||
@@ -9,8 +9,6 @@ if ($device['os'] == "linux")
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
$oids = trim($oids);
|
||||
if ($oids) echo("LM-SENSORS ");
|
||||
$precision = 1;
|
||||
$type = 'lmsensors';
|
||||
foreach(explode("\n", $oids) as $data)
|
||||
{
|
||||
$data = trim($data);
|
||||
@@ -23,10 +21,10 @@ if ($device['os'] == "linux")
|
||||
$current = snmp_get($device, $oid, "-Oqv", "LM-SENSORS-MIB");
|
||||
$descr = trim(str_ireplace("fan-", "", $descr));
|
||||
if($current > '0' && $current < '500') {
|
||||
discover_fan($valid_fan,$device, $oid, $index, $type, $descr, $precision, NULL, NULL, $current);
|
||||
discover_sensor($valid_sensor, 'fanspeed', $device, $oid, $index, 'lmsensors', $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
global $valid_fan;
|
||||
global $valid_sensor;
|
||||
|
||||
## Supermicro Fanspeeds
|
||||
if ($device['os'] == "linux")
|
||||
@@ -9,7 +9,6 @@ if ($device['os'] == "linux")
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
$oids = trim($oids);
|
||||
if ($oids) echo("Supermicro ");
|
||||
$type = "supermicro";
|
||||
foreach(explode("\n", $oids) as $data)
|
||||
{
|
||||
$data = trim($data);
|
||||
@@ -28,16 +27,15 @@ if ($device['os'] == "linux")
|
||||
$descr = snmp_get($device, $descr_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
$current = snmp_get($device, $fan_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
$limit = snmp_get($device, $limit_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
# $precision = snmp_get($device, $precision_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
# This returns an incorrect precision. At least using the raw value... I think. -TL
|
||||
$precision = 1;
|
||||
#$precision = snmp_get($device, $precision_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
# This returns an incorrect precision. At least using the raw value... I think. -TL
|
||||
$divisor = "1";
|
||||
$monitor = snmp_get($device, $monitor_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
$descr = str_replace(' Fan Speed','',$descr);
|
||||
$descr = str_replace(' Speed','',$descr);
|
||||
|
||||
$descr = str_replace(' Speed','',$descr);
|
||||
if ($monitor == 'true')
|
||||
{
|
||||
echo discover_fan($valid_fan,$device, $fan_oid, $index, $type, $descr, $precision, $limit, NULL, $current);
|
||||
discover_sensor($valid_sensor, 'fanspeed', $device, $oid, $index, 'supermicro', $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,12 +1,4 @@
|
||||
<?php
|
||||
$id = $device['device_id'];
|
||||
$hostname = $device['hostname'];
|
||||
$community = $device['community'];
|
||||
$snmpver = $device['snmpver'];
|
||||
$port = $device['port'];
|
||||
|
||||
$valid_freq = array();
|
||||
|
||||
echo("Frequencies : ");
|
||||
|
||||
## MGE UPS Frequencies
|
||||
@@ -28,9 +20,9 @@ if ($device['os'] == "mgeups")
|
||||
}
|
||||
$current /= 10;
|
||||
$type = "mge-ups";
|
||||
$precision = 10;
|
||||
$divisor = 10;
|
||||
$index = $i;
|
||||
echo discover_freq($valid_freq, $device, $freq_oid, $index, $type, $descr, $precision, $lowlimit, $limit, $current);
|
||||
echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
$oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.6.1", "-OsqnU"));
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
@@ -47,9 +39,9 @@ if ($device['os'] == "mgeups")
|
||||
}
|
||||
$current /= 10;
|
||||
$type = "mge-ups";
|
||||
$precision = 10;
|
||||
$divisor = 10;
|
||||
$index = 100+$i;
|
||||
echo discover_freq($valid_freq, $device, $freq_oid, $index, $type, $descr, $precision, $lowlimit, $limit, $current);
|
||||
echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,26 +59,26 @@ if ($device['os'] == "netmanplus")
|
||||
$descr = "Input"; if ($numPhase > 1) $descr .= " Phase $i";
|
||||
$current = snmp_get($device, $freq_oid, "-Oqv") / 10;
|
||||
$type = "netmanplus";
|
||||
$precision = 10;
|
||||
$divisor = 10;
|
||||
$index = '3.2.0.'.$i;
|
||||
echo discover_freq($valid_freq, $device, $freq_oid, $index, $type, $descr, $precision, NULL, NULL, $current);
|
||||
echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
|
||||
$freq_oid = "1.3.6.1.2.1.33.1.4.2.0";
|
||||
$descr = "Output";
|
||||
$current = snmp_get($device, $freq_oid, "-Oqv") / 10;
|
||||
$type = "netmanplus";
|
||||
$precision = 10;
|
||||
$divisor = 10;
|
||||
$index = '4.2.0';
|
||||
echo discover_freq($valid_freq, $device, $freq_oid, $index, $type, $descr, $precision, NULL, NULL, $current);
|
||||
echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
|
||||
$freq_oid = "1.3.6.1.2.1.33.1.5.1.0";
|
||||
$descr = "Bypass";
|
||||
$current = snmp_get($device, $freq_oid, "-Oqv") / 10;
|
||||
$type = "netmanplus";
|
||||
$precision = 10;
|
||||
$divisor = 10;
|
||||
$index = '5.1.0';
|
||||
echo discover_freq($valid_freq, $device, $freq_oid, $index, $type, $descr, $precision, NULL, NULL, $current);
|
||||
echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
|
||||
## APC
|
||||
@@ -95,7 +87,7 @@ if ($device['os'] == "apc")
|
||||
$oids = snmp_walk($device, "1.3.6.1.4.1.318.1.1.8.5.3.2.1.4", "-OsqnU", "");
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
if ($oids) echo("APC In ");
|
||||
$precision = 1;
|
||||
$divisor = 1;
|
||||
$type = "apc";
|
||||
foreach(explode("\n", $oids) as $data)
|
||||
{
|
||||
@@ -107,14 +99,14 @@ if ($device['os'] == "apc")
|
||||
$index = $split_oid[count($split_oid)-1];
|
||||
$oid = "1.3.6.1.4.1.318.1.1.8.5.3.2.1.4." . $index;
|
||||
$descr = "Input Feed " . chr(64+$index);
|
||||
discover_freq($valid_freq,$device, $oid, "3.2.1.4.$index", $type, $descr, $precision, NULL, NULL, $current);
|
||||
discover_sensor($valid_sensor, 'freq', $device, $oid, "3.2.1.4.$index", $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
|
||||
$oids = snmp_walk($device, "1.3.6.1.4.1.318.1.1.8.5.4.2.1.4", "-OsqnU", "");
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
if ($oids) echo(" APC Out ");
|
||||
$precision = 1;
|
||||
$divisor = 1;
|
||||
$type = "apc";
|
||||
foreach(explode("\n", $oids) as $data)
|
||||
{
|
||||
@@ -126,7 +118,7 @@ if ($device['os'] == "apc")
|
||||
$index = $split_oid[count($split_oid)-3];
|
||||
$oid = "1.3.6.1.4.1.318.1.1.8.5.4.2.1.4." . $index;
|
||||
$descr = "Output Feed"; if (count(explode("\n", $oids)) > 1) { $descr .= " $index"; }
|
||||
discover_freq($valid_freq,$device, $oid, "4.2.1.4.$index", $type, $descr, $precision, NULL, NULL, $current);
|
||||
discover_sensor($valid_sensor, 'freq', $device, $oid, "4.2.1.4.$index", $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,11 +128,11 @@ if ($device['os'] == "apc")
|
||||
{
|
||||
echo(" APC In ");
|
||||
list($oid,$current) = explode(" ",$oids);
|
||||
$precision = 1;
|
||||
$divisor = 1;
|
||||
$type = "apc";
|
||||
$index = "3.2.4.0";
|
||||
$descr = "Input";
|
||||
discover_freq($valid_freq, $device, $oid, $index, $type, $descr, $precision, NULL, NULL, $current);
|
||||
discover_sensor($valid_sensor, 'freq', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
|
||||
$oids = snmp_get($device, "1.3.6.1.4.1.318.1.1.1.4.2.2.0", "-OsqnU", "");
|
||||
@@ -149,33 +141,18 @@ if ($device['os'] == "apc")
|
||||
{
|
||||
echo(" APC Out ");
|
||||
list($oid,$current) = explode(" ",$oids);
|
||||
$precision = 1;
|
||||
$divisor = 1;
|
||||
$type = "apc";
|
||||
$index = "4.2.2.0";
|
||||
$descr = "Output";
|
||||
discover_freq($valid_freq, $device, $oid, $index, $type, $descr, $precision, NULL, NULL, $current);
|
||||
discover_sensor($valid_sensor, 'freq', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
|
||||
## Delete removed sensors
|
||||
|
||||
if($debug) { print_r($valid_freq); }
|
||||
if($debug) { print_r($valid['freq']); }
|
||||
|
||||
$sql = "SELECT * FROM frequency WHERE device_id = '".$device['device_id']."'";
|
||||
if ($query = mysql_query($sql))
|
||||
{
|
||||
while ($test_freq = mysql_fetch_array($query))
|
||||
{
|
||||
$index = $test_freq['freq_index'];
|
||||
$type = $test_freq['freq_type'];
|
||||
if($debug) { echo("$type -> $index\n"); }
|
||||
if(!$valid_freq[$type][$index]) {
|
||||
echo("-");
|
||||
mysql_query("DELETE FROM `frequency` WHERE freq_id = '" . $test_freq['freq_id'] . "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($fan_exists); echo("\n");
|
||||
check_valid_sensors($device, 'freq', $valid_sensor);
|
||||
|
||||
echo("\n");
|
||||
?>
|
||||
|
@@ -1,42 +1,61 @@
|
||||
<?php
|
||||
|
||||
function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr, $precision = 1, $low_limit = NULL, $low_warn_limit = NULL, $warn_limit = NULL, $high_limit = NULL, $current = NULL)
|
||||
function discover_sensor (&$valid, $class, $device, $oid, $index, $type, $descr, $divisor = '1', $multiplier = '1', $low_limit = NULL, $low_warn_limit = NULL, $warn_limit = NULL, $high_limit = NULL, $current = NULL)
|
||||
{
|
||||
global $config, $debug;
|
||||
|
||||
if($debug) { echo("$oid, $index, $type, $descr, $precision\n"); }
|
||||
if(!$low_limit)
|
||||
{
|
||||
$low_limit = $config['limit']['current'];
|
||||
}
|
||||
|
||||
}
|
||||
if (mysql_result(mysql_query("SELECT count(sensor_id) FROM `sensors` WHERE sensor_class='" . mres($class) . "' AND device_id = '".$device['device_id']."' AND sensor_type = '$type' AND `sensor_index` = '$index'"),0) == '0')
|
||||
{
|
||||
$query = "INSERT INTO sensors (`sensor_class`, `device_id`, `sensor_oid`, `sensor_index`, `sensor_type`, `sensor_descr`, `sensor_precision`, `sensor_limit`, `sensor_limit_warn`, `sensor_limit_low`, `sensor_limit_low_warn`, `sensor_current`) ";
|
||||
$query .= " VALUES ('" . mres($class) . "', '".$device['device_id']."', '$oid', '$index', '$type', '$descr', '$precision', '$high_limit', '$warn_limit', '$low_limit', '$low_warn_limit', '$current')";
|
||||
$query = "INSERT INTO sensors (`sensor_class`, `device_id`, `sensor_oid`, `sensor_index`, `sensor_type`, `sensor_descr`, `sensor_divisor`, `sensor_multiplier`, `sensor_limit`, `sensor_limit_warn`, `sensor_limit_low`, `sensor_limit_low_warn`, `sensor_current`) ";
|
||||
$query .= " VALUES ('" . mres($class) . "', '".$device['device_id']."', '$oid', '$index', '$type', '$descr', '$divisor', '$multiplier', '$high_limit', '$warn_limit', '$low_limit', '$low_warn_limit', '$current')";
|
||||
mysql_query($query);
|
||||
if($debug) { echo("$query ". mysql_affected_rows() . " inserted"); }
|
||||
echo("+");
|
||||
$sensor_id = mysql_result(mysql_query("SELECT `sensor_id` FROM `sensors` WHERE sensor_class='" . mres($class) . "' AND device_id = '".$device['device_id']."' AND sensor_type = '$type' AND `sensor_index` = '$index'"),0);
|
||||
log_event("Sensor Added: ".mres($class)." ".mres($type)." ". mres($index)." ".mres($descr)." ". mres($current)."C", $device['device_id'], 'sensor', $sensor_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sensor_entry = mysql_fetch_array(mysql_query("SELECT * FROM `sensors` WHERE sensor_class='" . mres($class) . "' AND device_id = '".$device['device_id']."' AND sensor_type = '$type' AND `sensor_index` = '$index'"));
|
||||
if($oid == $sensor_entry['sensor_oid'] && $descr == $sensor_entry['sensor_descr'] && $precision == $sensor_entry['sensor_precision'])
|
||||
if($oid == $sensor_entry['sensor_oid'] && $descr == $sensor_entry['sensor_descr'] && $multiplier == $sensor_entry['sensor_multiplier'] && $divisor == $sensor_entry['sensor_divisor'])
|
||||
{
|
||||
echo(".");
|
||||
}
|
||||
else
|
||||
{
|
||||
mysql_query("UPDATE sensors SET `sensor_descr` = '$descr', `sensor_oid` = '$oid', `sensor_precision` = '$precision' WHERE `sensor_class` = '" . mres($class) . "' AND `device_id` = '" . $device['device_id'] . "' AND sensor_type = '$type' AND `sensor_index` = '$index' ");
|
||||
mysql_query("UPDATE sensors SET `sensor_descr` = '$descr', `sensor_oid` = '$oid', `sensor_multiplier` = '$multiplier', `sensor_divisor` = '$divisor' WHERE `sensor_class` = '" . mres($class) . "' AND `device_id` = '" . $device['device_id'] . "' AND sensor_type = '$type' AND `sensor_index` = '$index' ");
|
||||
echo("U");
|
||||
log_event("Sensor Updated: ".mres($class)." ".mres($type)." ". mres($index)." ".mres($descr)." ". mres($current)."C", $device['device_id'], 'sensor', $sensor_id);
|
||||
if($debug) { echo("$query ". mysql_affected_rows() . " updated"); }
|
||||
}
|
||||
}
|
||||
|
||||
$valid[$type][$index] = 1;
|
||||
$valid[$class][$type][$index] = 1;
|
||||
return $return;
|
||||
}
|
||||
|
||||
function check_valid_sensors($device, $class, $valid) {
|
||||
$sql = "SELECT * FROM sensors AS S, devices AS D WHERE S.sensor_class='".$class."' AND S.device_id = D.device_id AND D.device_id = '".$device['device_id']."'";
|
||||
if ($query = mysql_query($sql))
|
||||
{
|
||||
while ($test = mysql_fetch_array($query))
|
||||
{
|
||||
$index = $test['sensor_index'];
|
||||
$type = $test['sensor_type'];
|
||||
if($debug) { echo($index . " -> " . $type . "\n"); }
|
||||
if(!$valid[$class][$type][$index])
|
||||
{
|
||||
echo("-");
|
||||
mysql_query("DELETE FROM `sensors` WHERE sensor_class='humidity' AND sensor_id = '" . $test['sensor_id'] . "'");
|
||||
}
|
||||
unset($oid); unset($type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function discover_juniAtmVp(&$valid, $interface_id, $vp_id, $vp_descr)
|
||||
{
|
||||
global $config, $debug;
|
||||
@@ -174,204 +193,6 @@ function discover_mempool(&$valid, $device, $index, $type, $descr, $precision =
|
||||
}
|
||||
}
|
||||
|
||||
function discover_temperature(&$valid, $device, $oid, $index, $type, $descr, $precision = 1, $low_limit = NULL, $high_limit = NULL, $current)
|
||||
{
|
||||
global $config, $debug;
|
||||
if($debug) { echo("$oid, $index, $type, $descr, $precision, $current\n"); }
|
||||
|
||||
if (mysql_result(mysql_query("SELECT COUNT(sensor_id) FROM `sensors` WHERE sensor_class='temperature' AND sensor_type = '$type' AND sensor_index = '$index' AND device_id = '".$device['device_id']."'"),0) == '0')
|
||||
{
|
||||
$query = "INSERT INTO sensors (`sensor_class`, `device_id`, `sensor_type`,`sensor_index`,`sensor_oid`, `sensor_descr`, `sensor_limit`, `sensor_current`, `sensor_precision`)";
|
||||
$query .= " values ('temperature','".$device['device_id']."', '$type','$index','$oid', '$descr','" . ($high_limit ? $high_limit : $config['defaults']['sensor_limit']) . "', '$current', '$precision')";
|
||||
mysql_query($query);
|
||||
echo("+");
|
||||
}
|
||||
else
|
||||
{
|
||||
$entry = mysql_fetch_array(mysql_query("SELECT * FROM `sensors` WHERE sensor_class='temperature' AND device_id = '".$device['device_id']."' AND `sensor_type` = '$type' AND `sensor_index` = '$index'"));
|
||||
echo(mysql_error());
|
||||
if($oid == $entry['sensor_oid'] && $descr == $entry['sensor_descr'] && $precision == $entry['sensor_precision'])
|
||||
{
|
||||
echo(".");
|
||||
}
|
||||
else
|
||||
{
|
||||
mysql_query("UPDATE sensors SET `sensor_descr` = '$descr', `sensor_oid` = '$oid', `sensor_precision` = '$precision' WHERE `sensor_class` = 'temperature' AND`sensor_id` = '".$entry['sensor_id']."'");
|
||||
echo("U");
|
||||
}
|
||||
}
|
||||
$valid[$type][$index] = 1;
|
||||
return $return;
|
||||
}
|
||||
|
||||
function discover_fan(&$valid, $device, $oid, $index, $type, $descr, $precision = 1, $low_limit = NULL, $high_limit = NULL, $current = NULL)
|
||||
{
|
||||
global $config, $debug;
|
||||
|
||||
if($debug) { echo("$oid, $index, $type, $descr, $precision\n"); }
|
||||
|
||||
if(!$low_limit)
|
||||
{
|
||||
$low_limit = $config['limit']['fan'];
|
||||
}
|
||||
|
||||
if (mysql_result(mysql_query("SELECT count(sensor_id) FROM `sensors` WHERE sensor_class='fanspeed' AND device_id = '".$device['device_id']."' AND sensor_type = '$type' AND `sensor_index` = '$index'"),0) == '0')
|
||||
{
|
||||
$query = "INSERT INTO sensors (`sensor_class`, `device_id`, `sensor_oid`, `sensor_index`, `sensor_type`, `sensor_descr`, `sensor_precision`, `sensor_limit`, `sensor_current`) ";
|
||||
$query .= " VALUES ('fanspeed','".$device['device_id']."', '$oid', '$index', '$type', '$descr', '$precision', '$low_limit', '$current')";
|
||||
mysql_query($query);
|
||||
echo("+");
|
||||
}
|
||||
else
|
||||
{
|
||||
$fan_entry = mysql_fetch_array(mysql_query("SELECT * FROM `sensors` WHERE sensor_class='fanspeed' AND device_id = '".$device['device_id']."' AND sensor_type = '$type' AND `sensor_index` = '$index'"));
|
||||
if($oid == $fan_entry['sensor_oid'] && $descr == $fan_entry['sensor_descr'] && $precision == $fan_entry['sensor_precision'])
|
||||
{
|
||||
echo(".");
|
||||
}
|
||||
else
|
||||
{
|
||||
mysql_query("UPDATE sensors SET `sensor_descr` = '$descr', `sensor_oid` = '$oid', `sensor_precision` = '$precision' WHERE `sensor_class` = 'fanspeed' AND `device_id` = '".$device['device_id']."' AND sensor_type = '$type' AND `sensor_index` = '$index' ");
|
||||
echo("U");
|
||||
}
|
||||
}
|
||||
$valid[$type][$index] = 1;
|
||||
return $return;
|
||||
}
|
||||
|
||||
function discover_volt(&$valid, $device, $oid, $index, $type, $descr, $precision = 1, $low_limit = NULL, $high_limit = NULL, $current = NULL)
|
||||
{
|
||||
global $config, $debug;
|
||||
|
||||
if($debug) { echo("$oid, $index, $type, $descr, $precision\n"); }
|
||||
if(!$low_limit)
|
||||
{
|
||||
$low_limit = $config['limit']['volt'];
|
||||
}
|
||||
|
||||
if (mysql_result(mysql_query("SELECT count(sensor_id) FROM `sensors` WHERE sensor_class='voltage' AND device_id = '".$device['device_id']."' AND sensor_type = '$type' AND `sensor_index` = '$index'"),0) == '0')
|
||||
{
|
||||
|
||||
if(!$high_limit && isset($current)) { $high_limit = round($current * 1.05, 2); }
|
||||
if(!$low_limit && isset($current)) { $low_limit = round($current * 0.95, 2); }
|
||||
|
||||
$query = "INSERT INTO sensors (`sensor_class`, `device_id`, `sensor_oid`, `sensor_index`, `sensor_type`, `sensor_descr`, `sensor_precision`, `sensor_limit`, `sensor_limit_low`, `sensor_current`) ";
|
||||
$query .= " VALUES ('voltage','".$device['device_id']."', '$oid', '$index', '$type', '$descr', '$precision', '$high_limit', '$low_limit', '$current')";
|
||||
mysql_query($query);
|
||||
if($debug) { echo("$query ". mysql_affected_rows() . " inserted"); }
|
||||
echo("+");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$volt_entry = mysql_fetch_array(mysql_query("SELECT * FROM `sensors` WHERE sensor_class='voltage' AND device_id = '".$device['device_id']."' AND sensor_type = '$type' AND `sensor_index` = '$index'"));
|
||||
|
||||
if(!isset($current) && isset($volt_entry['current'])) { $current = $volt_entry['current']; }
|
||||
|
||||
|
||||
if(!$high_limit && !$volt_entry['sensor_limit'] && $current) { $high_limit = round($current * 1.05, 2); } elseif (!$high_limit && $volt_entry['sensor_limit']) { $high_limit = $volt_entry['sensor_limit']; }
|
||||
if(!$low_limit && !$volt_entry['sensor_limit_low'] && $current) { $low_limit = round($current * 0.95, 2); } elseif (!$low_limit && $volt_entry['sensor_limit_low']) { $low_limit = $volt_entry['sensor_limit_low']; }
|
||||
|
||||
if($oid == $volt_entry['sensor_oid'] && $descr == $volt_entry['sensor_descr'] && $precision == $volt_entry['sensor_precision'] && $volt_entry['sensor_limit'] == $high_limit && $volt_entry['sensor_limit_low'] == $low_limit)
|
||||
{
|
||||
echo(".");
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "UPDATE sensors SET `sensor_descr` = '$descr', `sensor_oid` = '$oid', `sensor_precision` = '$precision', `sensor_limit_low` = '$low_limit', `sensor_limit` = '$high_limit' WHERE `sensor_class` = 'voltage' AND `device_id` = '" . $device['device_id'] . "' AND sensor_type = '$type' AND `sensor_index` = '$index'";
|
||||
$query = mysql_query($sql);
|
||||
echo("U");
|
||||
if($debug) { echo("$sql ". mysql_affected_rows() . " updated"); }
|
||||
}
|
||||
}
|
||||
|
||||
$valid[$type][$index] = 1;
|
||||
return $return;
|
||||
}
|
||||
|
||||
function discover_freq(&$valid, $device, $oid, $index, $type, $descr, $precision = 1, $low_limit = NULL, $high_limit = NULL, $current = NULL)
|
||||
{
|
||||
global $config, $debug;
|
||||
|
||||
if($debug) { echo("$oid, $index, $type, $descr, $precision\n"); }
|
||||
if(!$low_limit)
|
||||
{
|
||||
$low_limit = $config['limit']['freq'];
|
||||
}
|
||||
|
||||
if (mysql_result(mysql_query("SELECT count(freq_id) FROM `frequency` WHERE device_id = '".$device['device_id']."' AND freq_type = '$type' AND `freq_index` = '$index'"),0) == '0')
|
||||
{
|
||||
|
||||
if(!$high_limit && isset($current)) { $high_limit = round($current * 1.05, 0); }
|
||||
if(!$low_limit && isset($current)) { $low_limit = round($current * 0.95, 0); }
|
||||
|
||||
$query = "INSERT INTO frequency (`device_id`, `freq_oid`, `freq_index`, `freq_type`, `freq_descr`, `freq_precision`, `freq_limit`, `freq_limit_low`, `freq_current`) ";
|
||||
$query .= " VALUES ('".$device['device_id']."', '$oid', '$index', '$type', '$descr', '$precision', '$high_limit', '$low_limit', '$current')";
|
||||
mysql_query($query);
|
||||
if($debug) { echo("$query ". mysql_affected_rows() . " inserted"); }
|
||||
echo("+");
|
||||
}
|
||||
else
|
||||
{
|
||||
$freq_entry = mysql_fetch_array(mysql_query("SELECT * FROM `frequency` WHERE device_id = '".$device['device_id']."' AND freq_type = '$type' AND `freq_index` = '$index'"));
|
||||
if($oid == $freq_entry['freq_oid'] && $descr == $freq_entry['freq_descr'] && $precision == $freq_entry['freq_precision'])
|
||||
{
|
||||
echo(".");
|
||||
}
|
||||
else
|
||||
{
|
||||
mysql_query("UPDATE frequency SET `freq_descr` = '$descr', `freq_oid` = '$oid', `freq_precision` = '$precision' WHERE `device_id` = '" . $device['device_id'] . "' AND freq_type = '$type' AND `freq_index` = '$index' ");
|
||||
echo("U");
|
||||
if($debug) { echo("$query ". mysql_affected_rows() . " updated"); }
|
||||
}
|
||||
}
|
||||
|
||||
$valid[$type][$index] = 1;
|
||||
return $return;
|
||||
}
|
||||
|
||||
function discover_humidity(&$valid, $device, $oid, $index, $type, $descr, $precision = 1, $low_limit = NULL, $low_warn_limit = NULL, $warn_limit = NULL, $high_limit = NULL, $current = NULL)
|
||||
{
|
||||
return discover_sensor($valid, 'humidity', $device, $oid, $index, $type, $descr, $precision, $low_limit, $low_warn_limit, $warn_limit, $high_limit, $current);
|
||||
}
|
||||
|
||||
function discover_current(&$valid, $device, $oid, $index, $type, $descr, $precision = 1, $low_limit = NULL, $warn_limit = NULL, $high_limit = NULL, $current = NULL)
|
||||
{
|
||||
global $config, $debug;
|
||||
|
||||
if($debug) { echo("$oid, $index, $type, $descr, $precision\n"); }
|
||||
if(!$low_limit)
|
||||
{
|
||||
$low_limit = $config['limit']['current'];
|
||||
}
|
||||
|
||||
if (mysql_result(mysql_query("SELECT count(sensor_id) FROM `sensors` WHERE sensor_class='current' AND device_id = '".$device['device_id']."' AND sensor_type = '$type' AND `sensor_index` = '$index'"),0) == '0')
|
||||
{
|
||||
$query = "INSERT INTO sensors (`sensor_class`, `device_id`, `sensor_oid`, `sensor_index`, `sensor_type`, `sensor_descr`, `sensor_precision`, `sensor_limit`, `sensor_limit_warn`, `sensor_limit_low`, `sensor_current`) ";
|
||||
$query .= " VALUES ('current', '".$device['device_id']."', '$oid', '$index', '$type', '$descr', '$precision', '$high_limit', '$warn_limit', '$low_limit', '$current')";
|
||||
mysql_query($query);
|
||||
if($debug) { echo("$query ". mysql_affected_rows() . " inserted"); }
|
||||
echo("+");
|
||||
}
|
||||
else
|
||||
{
|
||||
$current_entry = mysql_fetch_array(mysql_query("SELECT * FROM `sensors` WHERE sensor_class='current' AND device_id = '".$device['device_id']."' AND sensor_type = '$type' AND `sensor_index` = '$index'"));
|
||||
if($oid == $current_entry['sensor_oid'] && $descr == $current_entry['sensor_descr'] && $precision == $current_entry['sensor_precision'])
|
||||
{
|
||||
echo(".");
|
||||
}
|
||||
else
|
||||
{
|
||||
mysql_query("UPDATE sensors SET `sensor_descr` = '$descr', `sensor_oid` = '$oid', `sensor_precision` = '$precision' WHERE `sensor_class`='current' AND `device_id` = '" . $device['device_id'] . "' AND sensor_type = '$type' AND `sensor_index` = '$index' ");
|
||||
echo("U");
|
||||
if($debug) { echo("$query ". mysql_affected_rows() . " updated"); }
|
||||
}
|
||||
}
|
||||
|
||||
$valid[$type][$index] = 1;
|
||||
return $return;
|
||||
}
|
||||
|
||||
function discover_toner(&$valid, $device, $oid, $index, $type, $descr, $capacity = NULL, $current = NULL)
|
||||
{
|
||||
global $config, $debug;
|
||||
|
@@ -7,29 +7,12 @@ $port = $device['port'];
|
||||
|
||||
echo("Humidity : ");
|
||||
|
||||
$valid_humidity = array();
|
||||
|
||||
include_dir("includes/discovery/humidity");
|
||||
|
||||
if($debug) { print_r($valid_humidity); }
|
||||
if($debug) { print_r($valid['humidity']); }
|
||||
|
||||
$sql = "SELECT * FROM sensors AS S, devices AS D WHERE S.sensor_class='humidity' AND S.device_id = D.device_id AND D.device_id = '".$device['device_id']."'";
|
||||
if ($query = mysql_query($sql))
|
||||
{
|
||||
while ($test_humidity = mysql_fetch_array($query))
|
||||
{
|
||||
$humidity_index = $test_humidity['sensor_index'];
|
||||
$humidity_type = $test_humidity['sensor_type'];
|
||||
if($debug) { echo($humidity_index . " -> " . $humidity_type . "\n"); }
|
||||
if(!$valid_humidity[$humidity_type][$humidity_index])
|
||||
{
|
||||
echo("-");
|
||||
mysql_query("DELETE FROM `sensors` WHERE sensor_class='humidity' AND sensor_id = '" . $test_humidity['sensor_id'] . "'");
|
||||
}
|
||||
unset($humidity_oid); unset($humidity_type);
|
||||
}
|
||||
}
|
||||
check_valid_sensors($device, 'humidity', $valid_sensor);
|
||||
|
||||
unset($valid_humidity); echo("\n");
|
||||
echo("\n");
|
||||
|
||||
?>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
global $valid_humidity;
|
||||
global $valid_sensor;
|
||||
|
||||
if ($device['os'] == 'akcp' || $device['os'] == 'minkelsrms')
|
||||
{
|
||||
@@ -17,25 +17,25 @@ if ($device['os'] == 'akcp' || $device['os'] == 'minkelsrms')
|
||||
if ($status == 2) # 2 = normal, 0 = not connected
|
||||
{
|
||||
$split_oid = explode('.',$oid);
|
||||
$humidity_id = $split_oid[count($split_oid)-1];
|
||||
$descr_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.1.$humidity_id";
|
||||
$humidity_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.3.$humidity_id";
|
||||
$warnlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.7.$humidity_id";
|
||||
$limit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.8.$humidity_id";
|
||||
$warnlowlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.9.$humidity_id";
|
||||
$lowlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.10.$humidity_id";
|
||||
$index = $split_oid[count($split_oid)-1];
|
||||
$descr_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.1.$index";
|
||||
$oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.3.$index";
|
||||
$warnlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.7.$index";
|
||||
$limit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.8.$index";
|
||||
$warnlowlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.9.$index";
|
||||
$lowlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.10.$index";
|
||||
|
||||
$descr = trim(snmp_get($device, $descr_oid, "-Oqv", ""),'"');
|
||||
$humidity = snmp_get($device, $humidity_oid, "-Oqv", "");
|
||||
$humidity = snmp_get($device, $oid, "-Oqv", "");
|
||||
$warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", "");
|
||||
$limit = snmp_get($device, $limit_oid, "-Oqv", "");
|
||||
$lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", "");
|
||||
$warnlowlimit = snmp_get($device, $warnlowlimit_oid, "-Oqv", "");
|
||||
|
||||
discover_humidity($valid_humidity, $device, $humidity_oid, $humidity_id, "akcp", $descr, 1, $lowlimit, $warnlowlimit, $limit, $warnlimit, $humidity);
|
||||
discover_sensor($valid_sensor, 'humidity', $device, $oid, $index, 'akcp', $descr, '1', '1', $lowlimit, $warnlowlimit, $limit, $warnlimit, $humidity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
global $valid_mempool;
|
||||
|
||||
if($device['os'] == "ios" || $device['os_group'] == "ios") {
|
||||
|
||||
echo("CISCO-ENHANCED-MEMORY-POOL: ");
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
global $valid_mempool;
|
||||
|
||||
## Ignore this discovery module if we have already discovered things in CISCO-ENHANCED-MEMPOOL-MIB. Dirty duplication.
|
||||
|
||||
$cemp_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `mempools` WHERE `device_id` = '".$device['device_id']."' AND `mempool_type` = 'cemp'"),0);
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
global $valid_mempool;
|
||||
|
||||
$storage_array = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
|
||||
|
||||
if(is_array($storage_array)) {
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
global $valid_mempool;
|
||||
|
||||
if($device['os'] == "ironware" || $device['os_type'] == "ironware") {
|
||||
|
||||
echo("Ironware Dynamic: ");
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
global $valid_mempool;
|
||||
|
||||
## JUNOS mempools
|
||||
if($device['os'] == "junos")
|
||||
{
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
global $valid_mempool;
|
||||
|
||||
if($device['os'] == "screenos") {
|
||||
|
||||
echo("ScreenOS: ");
|
||||
|
@@ -2,29 +2,12 @@
|
||||
|
||||
echo("Temperatures : ");
|
||||
|
||||
$valid_temp = array();
|
||||
|
||||
include_dir("includes/discovery/temperatures");
|
||||
|
||||
if($debug) { print_r($valid_temp); }
|
||||
if($debug) { print_r($valid_sensor['temperature']); }
|
||||
|
||||
$sql = "SELECT * FROM sensors AS S, devices AS D WHERE S.sensor_class='temperature' AND S.device_id = D.device_id AND D.device_id = '".$device['device_id']."'";
|
||||
if ($query = mysql_query($sql))
|
||||
{
|
||||
while ($test_temperature = mysql_fetch_array($query))
|
||||
{
|
||||
$temperature_index = $test_temperature['sensor_index'];
|
||||
$temperature_type = $test_temperature['sensor_type'];
|
||||
if($debug) { echo($temperature_index . " -> " . $temperature_type . "\n"); }
|
||||
if(!$valid_temp[$temperature_type][$temperature_index])
|
||||
{
|
||||
echo("-");
|
||||
mysql_query("DELETE FROM `sensors` WHERE sensor_class='temperature' AND sensor_id = '" . $test_temperature['sensor_id'] . "'");
|
||||
}
|
||||
unset($temperature_oid); unset($temperature_type);
|
||||
}
|
||||
}
|
||||
check_valid_sensors($device, 'temperature', $valid_sensor);
|
||||
|
||||
unset($valid_temp); echo("\n");
|
||||
echo("\n");
|
||||
|
||||
?>
|
||||
|
@@ -16,73 +16,73 @@ Disabled needing rewrite
|
||||
$descr_hss1 = "hss1";
|
||||
$oid_hss2 = "1.3.6.1.4.1.2544.1.9.2.4.1.5.1.1.14";
|
||||
$descr_hss2 = "hss2";
|
||||
$temp_chassis = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_chassis"));
|
||||
$temp_stm16 = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_stm16"));
|
||||
$temp_hss1 = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_hss1"));
|
||||
$temp_hss2 = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_hss2"));
|
||||
$temperature_chassis = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_chassis"));
|
||||
$temperature_stm16 = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_stm16"));
|
||||
$temperature_hss1 = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_hss1"));
|
||||
$temperature_hss2 = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_hss2"));
|
||||
echo("Adva Chassis ");
|
||||
if($temp_chassis != "0")
|
||||
if($temperature_chassis != "0")
|
||||
{
|
||||
if(mysql_result(mysql_query("SELECT count(temp_id) FROM `temperature` WHERE temp_oid = '$oid_chassis' AND temp_host = '$id'"),0) == '0')
|
||||
if(mysql_result(mysql_query("SELECT count(temperature_id) FROM `temperature` WHERE temperature_oid = '$oid_chassis' AND temperature_host = '$id'"),0) == '0')
|
||||
{
|
||||
$query = "INSERT INTO temperature (`temp_host`, `temp_oid`, `temp_descr`, `temp_precision`, `temp_limit`, `temp_current`) values ('$id', '$oid_chassis', '$descr_chassis',1," . ($config['defaults']['temp_limit'] ? $config['defaults']['temp_limit'] : '60') . ", '$temp_chassis')";
|
||||
$query = "INSERT INTO temperature (`temperature_host`, `temperature_oid`, `temperature_descr`, `temperature_precision`, `temperature_limit`, `temperature_current`) values ('$id', '$oid_chassis', '$descr_chassis',1," . ($config['defaults']['temperature_limit'] ? $config['defaults']['temperature_limit'] : '60') . ", '$temperature_chassis')";
|
||||
mysql_query($query);
|
||||
echo("+");
|
||||
} elseif (mysql_result(mysql_query("SELECT `temp_descr` FROM temperature WHERE `temp_host` = '$id' AND `temp_oid` = '$oid_chassis'"), 0) != $descr_chassis) {
|
||||
} elseif (mysql_result(mysql_query("SELECT `temperature_descr` FROM temperature WHERE `temperature_host` = '$id' AND `temperature_oid` = '$oid_chassis'"), 0) != $descr_chassis) {
|
||||
echo("U");
|
||||
mysql_query("UPDATE temperature SET `temp_descr` = '$descr_chassis' WHERE `temp_host` = '$id' AND `temp_oid` = '$oid_chassis'");
|
||||
mysql_query("UPDATE temperature SET `temperature_descr` = '$descr_chassis' WHERE `temperature_host` = '$id' AND `temperature_oid` = '$oid_chassis'");
|
||||
} else {
|
||||
echo(".");
|
||||
}
|
||||
$temp_exists[] = "$id $oid_chassis";
|
||||
$temperature_exists[] = "$id $oid_chassis";
|
||||
}
|
||||
echo("STM16 ");
|
||||
if($temp_stm16 != "0")
|
||||
if($temperature_stm16 != "0")
|
||||
{
|
||||
if(mysql_result(mysql_query("SELECT count(temp_id) FROM `temperature` WHERE temp_oid = '$oid_stm16' AND temp_host = '$id'"),0) == '0')
|
||||
if(mysql_result(mysql_query("SELECT count(temperature_id) FROM `temperature` WHERE temperature_oid = '$oid_stm16' AND temperature_host = '$id'"),0) == '0')
|
||||
{
|
||||
$query = "INSERT INTO temperature (`temp_host`, `temp_oid`, `temp_descr`, `temp_precision`, `temp_limit`, `temp_current`) values ('$id', '$oid_stm16', '$descr_stm16',1," . ($config['defaults']['temp_limit'] ? $config['defaults']['temp_limit'] : '60') . ", '$temp_stm16')";
|
||||
$query = "INSERT INTO temperature (`temperature_host`, `temperature_oid`, `temperature_descr`, `temperature_precision`, `temperature_limit`, `temperature_current`) values ('$id', '$oid_stm16', '$descr_stm16',1," . ($config['defaults']['temperature_limit'] ? $config['defaults']['temperature_limit'] : '60') . ", '$temperature_stm16')";
|
||||
mysql_query($query);
|
||||
echo("+");
|
||||
} elseif (mysql_result(mysql_query("SELECT `temp_descr` FROM temperature WHERE `temp_host` = '$id' AND `temp_oid` = '$oid_stm16'"), 0) != $descr_stm16) {
|
||||
} elseif (mysql_result(mysql_query("SELECT `temperature_descr` FROM temperature WHERE `temperature_host` = '$id' AND `temperature_oid` = '$oid_stm16'"), 0) != $descr_stm16) {
|
||||
echo("U");
|
||||
mysql_query("UPDATE temperature SET `temp_descr` = '$descr_stm16' WHERE `temp_host` = '$id' AND `temp_oid` = '$oid_stm16'");
|
||||
mysql_query("UPDATE temperature SET `temperature_descr` = '$descr_stm16' WHERE `temperature_host` = '$id' AND `temperature_oid` = '$oid_stm16'");
|
||||
} else {
|
||||
echo(".");
|
||||
}
|
||||
$temp_exists[] = "$id $oid_stm16";
|
||||
$temperature_exists[] = "$id $oid_stm16";
|
||||
}
|
||||
echo("HSS1 ");
|
||||
if($temp_hss1 != "0")
|
||||
if($temperature_hss1 != "0")
|
||||
{
|
||||
if(mysql_result(mysql_query("SELECT count(temp_id) FROM `temperature` WHERE temp_oid = '$oid_hss1' AND temp_host = '$id'"),0) == '0')
|
||||
if(mysql_result(mysql_query("SELECT count(temperature_id) FROM `temperature` WHERE temperature_oid = '$oid_hss1' AND temperature_host = '$id'"),0) == '0')
|
||||
{
|
||||
$query = "INSERT INTO temperature (`temp_host`, `temp_oid`, `temp_descr`, `temp_precision`, `temp_limit`, `temp_current`) values ('$id', '$oid_hss1', '$descr_hss1',1," . ($config['defaults']['temp_limit'] ? $config['defaults']['temp_limit'] : '60') . ", '$temp_hss1')";
|
||||
$query = "INSERT INTO temperature (`temperature_host`, `temperature_oid`, `temperature_descr`, `temperature_precision`, `temperature_limit`, `temperature_current`) values ('$id', '$oid_hss1', '$descr_hss1',1," . ($config['defaults']['temperature_limit'] ? $config['defaults']['temperature_limit'] : '60') . ", '$temperature_hss1')";
|
||||
mysql_query($query);
|
||||
echo("+");
|
||||
} elseif (mysql_result(mysql_query("SELECT `temp_descr` FROM temperature WHERE `temp_host` = '$id' AND `temp_oid` = '$oid_hss1'"), 0) != $descr_hss1) {
|
||||
} elseif (mysql_result(mysql_query("SELECT `temperature_descr` FROM temperature WHERE `temperature_host` = '$id' AND `temperature_oid` = '$oid_hss1'"), 0) != $descr_hss1) {
|
||||
echo("U");
|
||||
mysql_query("UPDATE temperature SET `temp_descr` = '$descr_hss1' WHERE `temp_host` = '$id' AND `temp_oid` = '$oid_hss1'");
|
||||
mysql_query("UPDATE temperature SET `temperature_descr` = '$descr_hss1' WHERE `temperature_host` = '$id' AND `temperature_oid` = '$oid_hss1'");
|
||||
} else {
|
||||
echo(".");
|
||||
}
|
||||
$temp_exists[] = "$id $oid_hss1";
|
||||
$temperature_exists[] = "$id $oid_hss1";
|
||||
}
|
||||
echo("HSS2 ");
|
||||
if($temp_hss2 != "0")
|
||||
if($temperature_hss2 != "0")
|
||||
{
|
||||
if(mysql_result(mysql_query("SELECT count(temp_id) FROM `temperature` WHERE temp_oid = '$oid_hss2' AND temp_host = '$id'"),0) == '0')
|
||||
if(mysql_result(mysql_query("SELECT count(temperature_id) FROM `temperature` WHERE temperature_oid = '$oid_hss2' AND temperature_host = '$id'"),0) == '0')
|
||||
{
|
||||
$query = "INSERT INTO temperature (`temp_host`, `temp_oid`, `temp_descr`, `temp_precision`, `temp_limit`, `temp_current`) values ('$id', '$oid_hss2', '$descr_hss2',1," . ($config['defaults']['temp_limit'] ? $config['defaults']['temp_limit'] : '60') . ", '$temp_hss2')";
|
||||
$query = "INSERT INTO temperature (`temperature_host`, `temperature_oid`, `temperature_descr`, `temperature_precision`, `temperature_limit`, `temperature_current`) values ('$id', '$oid_hss2', '$descr_hss2',1," . ($config['defaults']['temperature_limit'] ? $config['defaults']['temperature_limit'] : '60') . ", '$temperature_hss2')";
|
||||
mysql_query($query);
|
||||
echo("+");
|
||||
} elseif (mysql_result(mysql_query("SELECT `temp_descr` FROM temperature WHERE `temp_host` = '$id' AND `temp_oid` = '$oid_hss2'"), 0) != $descr_hss2) {
|
||||
} elseif (mysql_result(mysql_query("SELECT `temperature_descr` FROM temperature WHERE `temperature_host` = '$id' AND `temperature_oid` = '$oid_hss2'"), 0) != $descr_hss2) {
|
||||
echo("U");
|
||||
mysql_query("UPDATE temperature SET `temp_descr` = '$descr_hss2' WHERE `temp_host` = '$id' AND `temp_oid` = '$oid_hss2'");
|
||||
mysql_query("UPDATE temperature SET `temperature_descr` = '$descr_hss2' WHERE `temperature_host` = '$id' AND `temperature_oid` = '$oid_hss2'");
|
||||
} else {
|
||||
echo(".");
|
||||
}
|
||||
$temp_exists[] = "$id $oid_hss2";
|
||||
$temperature_exists[] = "$id $oid_hss2";
|
||||
}
|
||||
*/
|
||||
?>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
global $valid_temp;
|
||||
global $valid_sensor;
|
||||
|
||||
if ($device['os'] == "akcp" || $device['os'] == "minkelsrms")
|
||||
{
|
||||
@@ -17,22 +17,22 @@ if ($device['os'] == "akcp" || $device['os'] == "minkelsrms")
|
||||
if ($status == 2) # 2 = normal, 0 = not connected
|
||||
{
|
||||
$split_oid = explode('.',$oid);
|
||||
$temp_id = $split_oid[count($split_oid)-1];
|
||||
$descr_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.1.$temp_id";
|
||||
$temp_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.3.$temp_id";
|
||||
$warnlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.7.$temp_id";
|
||||
$limit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.8.$temp_id";
|
||||
# .9 = low warn limit
|
||||
$lowlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.10.$temp_id";
|
||||
$temperature_id = $split_oid[count($split_oid)-1];
|
||||
$descr_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.1.$temperature_id";
|
||||
$temperature_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.3.$temperature_id";
|
||||
$warnlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.7.$temperature_id";
|
||||
$limit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.8.$temperature_id";
|
||||
$lowwarnlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.9.$temperature_id";
|
||||
$lowlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.10.$temperature_id";
|
||||
|
||||
$descr = trim(snmp_get($device, $descr_oid, "-Oqv", ""),'"');
|
||||
$temp = snmp_get($device, $temp_oid, "-Oqv", "");
|
||||
$warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", "");
|
||||
$limit = snmp_get($device, $limit_oid, "-Oqv", "");
|
||||
$lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", "");
|
||||
$descr = trim(snmp_get($device, $descr_oid, "-Oqv", ""),'"');
|
||||
$temperature = snmp_get($device, $temperature_oid, "-Oqv", "");
|
||||
$lowwarnlimit = snmp_get($device, $lowwarnlimit_oid, "-Oqv", "");
|
||||
$warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", "");
|
||||
$limit = snmp_get($device, $limit_oid, "-Oqv", "");
|
||||
$lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", "");
|
||||
|
||||
# FIXME no warnlimit in table/discover function yet...
|
||||
discover_temperature($valid_temp, $device, $temp_oid, $temp_id, "akcp", $descr, 1, $lowlimit, $limit, $temp);
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $temperature_oid, $temperature_id, 'akcp', $descr, '1', '1', $lowlimit, $low_warn_limit, $warnlimit, $limit, $temperature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
global $valid_temp;
|
||||
|
||||
global $valid_sensor;
|
||||
|
||||
if ($device['os'] == "apc")
|
||||
{
|
||||
$oids = snmp_get($device, "1.3.6.1.4.1.318.1.1.1.2.2.2.0", "-OsqnU", "");
|
||||
@@ -14,7 +14,7 @@ if ($device['os'] == "apc")
|
||||
$type = "apc";
|
||||
$index = 0;
|
||||
$descr = "Internal Temperature";
|
||||
discover_temperature($valid_temp, $device, $oid, $index, $type, $descr, $precision, NULL, NULL, $current);
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $oid, $index, 'apc', $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
global $valid_temp;
|
||||
|
||||
global $valid_sensor;
|
||||
|
||||
if ($device['os'] == "areca")
|
||||
{
|
||||
$oids = snmp_walk($device, "1.3.6.1.4.1.18928.1.1.2.14.1.2", "-Osqn", "");
|
||||
@@ -15,13 +15,13 @@ if ($device['os'] == "areca")
|
||||
{
|
||||
list($oid,$descr) = explode(" ", $data,2);
|
||||
$split_oid = explode('.',$oid);
|
||||
$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 = snmp_get($device, $temp_oid, "-Oqv", "");
|
||||
$descr = "Hard disk $temp_id";
|
||||
if ($temp != -128) # -128 = not measured/present
|
||||
$temperature_id = $split_oid[count($split_oid)-1];
|
||||
$temperature_oid = "1.3.6.1.4.1.18928.1.1.2.14.1.2.$temperature_id";
|
||||
$temperature = snmp_get($device, $temperature_oid, "-Oqv", "");
|
||||
$descr = "Hard disk $temperature_id";
|
||||
if ($temperature != -128) # -128 = not measured/present
|
||||
{
|
||||
discover_temperature($valid_temp, $device, $temp_oid, zeropad($temp_id), "areca", $descr, 1, NULL, NULL, $temp);
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $temperature_oid, zeropad($temperature_id), 'areca', $descr, '1', '1', NULL, NULL, NULL, NULL, $temperature);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ if ($device['os'] == "areca")
|
||||
$index = $split_oid[count($split_oid)-1];
|
||||
$oid = "1.3.6.1.4.1.18928.1.2.2.1.10.1.3." . $index;
|
||||
$current = snmp_get($device, $oid, "-Oqv", "");
|
||||
discover_temperature($valid_temp, $device, $oid, $index, $type, trim($descr,'"'), $precision, NULL, NULL, $current);
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $oid, $index, 'areca', trim($descr,'"'), '1', '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,7 @@
|
||||
<?php
|
||||
|
||||
global $valid_temp;
|
||||
global $valid_sensor;
|
||||
|
||||
unset($cisco_entity_temp);
|
||||
|
||||
if ($device['os'] == "ios" || $device['os_group'] == "ios")
|
||||
{
|
||||
echo("CISCO-ENTITY-SENSOR");
|
||||
@@ -29,11 +27,12 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios")
|
||||
$oid = ".1.3.6.1.4.1.9.9.91.1.1.1.1.4.".$index;
|
||||
$current = $entry['entSensorValue'];
|
||||
|
||||
## FIXME this sucks
|
||||
if($entry['entSensorScale'] == "milli") { $divisor = "1000"; } else { $divisor = "1"; }
|
||||
|
||||
discover_temperature($valid_temp, $device, $oid, $index, "cisco-entity-sensor", $descr, $divisor, NULL, NULL, $current);
|
||||
|
||||
$cisco_entity_temp = 1;
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $oid, $index, 'cisco-entity-sensor', $descr, '1', '1', NULL, NULL, NULL, NULL, $temperature);
|
||||
|
||||
$cisco_entity_temperature = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
global $valid_temp;
|
||||
global $valid_sensor;
|
||||
|
||||
if (!isset($cisco_entity_temp) && $device['os'] == "ios" || $device['os_group'] == "ios")
|
||||
if (!isset($cisco_entity_temperature) && $device['os'] == "ios" || $device['os_group'] == "ios")
|
||||
{
|
||||
echo("Cisco ");
|
||||
$oids = snmp_walk($device, ".1.3.6.1.4.1.9.9.13.1.3.1.2", "-Osqn", "CISCO-ENVMON-MIB");
|
||||
@@ -17,14 +17,14 @@ if (!isset($cisco_entity_temp) && $device['os'] == "ios" || $device['os_group']
|
||||
$oid = ".1.3.6.1.4.1.9.9.13.1.3.1.3.$index";
|
||||
$descr_oid = ".1.3.6.1.4.1.9.9.13.1.3.1.2.$index";
|
||||
$descr = snmp_get($device, $descr_oid, "-Oqv", "CISCO-ENVMON-MIB");
|
||||
$temp = snmp_get($device, $oid, "-Oqv", "CISCO-ENVMON-MIB");
|
||||
if (!strstr($descr, "No") && !strstr($temp, "No") && $descr != "" )
|
||||
$temperature = snmp_get($device, $oid, "-Oqv", "CISCO-ENVMON-MIB");
|
||||
if (!strstr($descr, "No") && !strstr($temperature, "No") && $descr != "" )
|
||||
{
|
||||
$descr = str_replace("\"", "", $descr);
|
||||
$descr = str_replace("temperature", "", $descr);
|
||||
$descr = str_replace("temp", "", $descr);
|
||||
$descr = str_replace("temperature", "", $descr);
|
||||
$descr = trim($descr);
|
||||
discover_temperature($valid_temp, $device, $oid, $index, "cisco", $descr, "1", NULL, NULL, $temp);
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $oid, $index, 'cisco', $descr, '1', '1', NULL, NULL, NULL, NULL, $temperature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
global $valid_temp;
|
||||
|
||||
global $valid_sensor;
|
||||
|
||||
if (strstr($device['hardware'], "dell"))
|
||||
{
|
||||
$oids = snmp_walk($device, ".1.3.6.1.4.1.674.10892.1.700.20.1.8", "-Osqn", "MIB-Dell-10892");
|
||||
@@ -16,7 +16,8 @@ if (strstr($device['hardware'], "dell"))
|
||||
$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)));
|
||||
$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);
|
||||
### FIXME CURRENT
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $fulloid, $oid, 'dell', $descr, '10', '1', NULL, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
global $valid_temp;
|
||||
|
||||
global $valid_sensor;
|
||||
|
||||
echo("ENTITY-SENSOR ");
|
||||
|
||||
$oids = array();
|
||||
|
||||
$oids = snmpwalk_cache_multi_oid($device, "entPhySensorType", $oids, "ENTITY-SENSOR-MIB");
|
||||
$oids = snmpwalk_cache_multi_oid($device, "entPhySensorScale", $oids, "ENTITY-SENSOR-MIB");
|
||||
|
||||
$oids = snmpwalk_cache_multi_oid($device, "entPhySensorValue", $oids, "ENTITY-SENSOR-MIB");
|
||||
|
||||
if(is_array($oids[$device['device_id']]))
|
||||
@@ -25,16 +26,17 @@ if(is_array($oids[$device['device_id']]))
|
||||
#ENTITY-SENSOR-MIB::entPhySensorUnitsDisplay.11 = STRING: "C"
|
||||
|
||||
$descr = str_replace("temperature", "", $descr);
|
||||
$descr = str_replace("temp", "", $descr);
|
||||
$descr = str_replace("temperature", "", $descr);
|
||||
$descr = str_replace("sensor", "", $descr);
|
||||
|
||||
### FIXME this stuff is foul
|
||||
if($entry['entPhySensorScale'] == "milli") { $divisor = "1000"; } else { $divisor = "1"; }
|
||||
|
||||
if($entry['entPhySensorPrecision'] == "1") { $multiplier = "10"; } else { $multiplier = "1"; }
|
||||
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `sensors` WHERE `device_id` = '".$device['device_id']."' AND `sensor_class` = 'temperature' AND `sensor_type` = 'cisco-entity-sensor' AND `sensor_index` = '".$index."'"),0) == "0")
|
||||
## Check to make sure we've not already seen this sensor via cisco's entity sensor mib
|
||||
{
|
||||
discover_temperature($valid_temp, $device, $oid, $index, "entity-sensor", $descr, $divisor, NULL, NULL, $current);
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $oid, $index, 'entity-sensor', $descr, $divisor, $multiplier, NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
global $valid_sensor;
|
||||
|
||||
### Force10 C-Series
|
||||
|
||||
#F10-C-SERIES-CHASSIS-MIB::chSysCardType.1 = INTEGER: lc4802E48TB(1024)
|
||||
@@ -7,10 +9,6 @@
|
||||
#F10-C-SERIES-CHASSIS-MIB::chSysCardTemp.1 = Gauge32: 25
|
||||
#F10-C-SERIES-CHASSIS-MIB::chSysCardTemp.2 = Gauge32: 26
|
||||
|
||||
|
||||
|
||||
global $valid_temp;
|
||||
|
||||
if ($device['os'] == "ftos" || $device['os_group'] == "ftos")
|
||||
{
|
||||
echo("FTOS C-Series ");
|
||||
@@ -21,12 +19,10 @@ if ($device['os'] == "ftos" || $device['os_group'] == "ftos")
|
||||
{
|
||||
foreach($oids[$device['device_id']] as $index => $entry)
|
||||
{
|
||||
|
||||
$descr = "Slot ".$index;
|
||||
$oid = ".1.3.6.1.4.1.6027.3.8.1.2.1.1.5.".$index;
|
||||
$current = $entry['chSysCardTemp'];
|
||||
|
||||
discover_temperature($valid_temp, $device, $oid, $index, "ftos-cseries", $descr, "1", NULL, NULL, $current);
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $oid, $index, 'ftos-cseries', $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
global $valid_sensor;
|
||||
|
||||
### Force10 E-Series
|
||||
|
||||
#F10-CHASSIS-MIB::chSysCardType.1 = INTEGER: rpmCardEF3(206)
|
||||
@@ -9,8 +11,6 @@
|
||||
#F10-CHASSIS-MIB::chSysCardUpperTemp.3 = Gauge32: 34
|
||||
#F10-CHASSIS-MIB::chSysCardUpperTemp.4 = Gauge32: 34
|
||||
|
||||
global $valid_temp;
|
||||
|
||||
if ($device['os'] == "ftos" || $device['os_group'] == "ftos")
|
||||
{
|
||||
echo("FTOS E-Series ");
|
||||
@@ -21,12 +21,10 @@ if ($device['os'] == "ftos" || $device['os_group'] == "ftos")
|
||||
{
|
||||
foreach($oids[$device['device_id']] as $index => $entry)
|
||||
{
|
||||
|
||||
$descr = "Slot ".$index;
|
||||
$oid = ".1.3.6.1.4.1.6027.3.1.1.2.3.1.8.".$index;
|
||||
$current = $entry['chSysCardUpperTemp'];
|
||||
|
||||
discover_temperature($valid_temp, $device, $oid, $index, "ftos-eseries", $descr, "1", NULL, NULL, $current);
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $oid, $index, 'ftos-eseries', $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
global $valid_sensor;
|
||||
|
||||
### Force10 S-Series
|
||||
|
||||
#F10-S-SERIES-CHASSIS-MIB::chStackUnitTemp.1 = Gauge32: 47
|
||||
#F10-S-SERIES-CHASSIS-MIB::chStackUnitModelID.1 = STRING: S25-01-GE-24V
|
||||
|
||||
global $valid_temp;
|
||||
|
||||
if ($device['os'] == "ftos" || $device['os_group'] == "ftos")
|
||||
{
|
||||
echo("FTOS C-Series ");
|
||||
@@ -19,12 +19,10 @@ if ($device['os'] == "ftos" || $device['os_group'] == "ftos")
|
||||
{
|
||||
foreach($oids[$device['device_id']] as $index => $entry)
|
||||
{
|
||||
|
||||
$descr = "Unit ".$index . " " . $entry['chStackUnitSysType'];
|
||||
$oid = ".1.3.6.1.4.1.6027.3.10.1.2.2.1.14.".$index;
|
||||
$current = $entry['chStackUnitTemp'];
|
||||
|
||||
discover_temperature($valid_temp, $device, $oid, $index, "ftos-sseries", $descr, "1", NULL, NULL, $current);
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $oid, $index, 'ftos-sseries', $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
global $valid_temp;
|
||||
global $valid_sensor;
|
||||
|
||||
if($device['os'] == "ironware")
|
||||
{
|
||||
@@ -14,22 +14,22 @@ if($device['os'] == "ironware")
|
||||
if ($data != "")
|
||||
{
|
||||
list($oid) = explode(" ", $data);
|
||||
$temp_oid = ".1.3.6.1.4.1.1991.1.1.2.13.1.1.4.$oid";
|
||||
$temperature_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 = snmp_get($device,$descr_oid,"-Oqv","");
|
||||
$temp = snmp_get($device,$temp_oid,"-Oqv","");
|
||||
if (!strstr($descr, "No") && !strstr($temp, "No") && $descr != "" && $temp != "0")
|
||||
$temperature = snmp_get($device,$temperature_oid,"-Oqv","");
|
||||
if (!strstr($descr, "No") && !strstr($temperature, "No") && $descr != "" && $temperature != "0")
|
||||
{
|
||||
$descr = str_replace("\"", "", $descr);
|
||||
$descr = str_replace("temperature", "", $descr);
|
||||
$descr = str_replace("temp", "", $descr);
|
||||
$descr = str_replace("temperature", "", $descr);
|
||||
$descr = str_replace("sensor", "Sensor", $descr);
|
||||
$descr = str_replace("Line module", "Slot", $descr);
|
||||
$descr = str_replace("Switch Fabric module", "Fabric", $descr);
|
||||
$descr = str_replace("Active management module", "Mgmt Module", $descr);
|
||||
$descr = str_replace(" ", " ", $descr);
|
||||
$descr = trim($descr);
|
||||
discover_temperature($valid_temp, $device, $temp_oid, $oid, "ironware", $descr, "2", NULL, NULL, $temp);
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $temperature_oid, $oid, 'ironware', $descr, '2', '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
global $valid_temp;
|
||||
|
||||
global $valid_sensor;
|
||||
|
||||
if ($device['os'] == "junos" || $device['os_group'] == "junos")
|
||||
{
|
||||
echo("JunOS ");
|
||||
@@ -14,19 +14,18 @@ if ($device['os'] == "junos" || $device['os_group'] == "junos")
|
||||
if ($data)
|
||||
{
|
||||
list($oid) = explode(" ", $data);
|
||||
$temp_oid = "1.3.6.1.4.1.2636.3.1.13.1.7.$oid";
|
||||
$temperature_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 = snmp_get($device,$descr_oid,"-Oqv","JUNIPER-MIB", '+'.$config['install_dir']."/mibs/junos");
|
||||
$temp = snmp_get($device,$temp_oid,"-Oqv","JUNIPER-MIB", '+'.$config['install_dir']."/mibs/junos");
|
||||
if (!strstr($descr, "No") && !strstr($temp, "No") && $descr != "" && $temp != "0")
|
||||
$temperature = snmp_get($device,$temperature_oid,"-Oqv","JUNIPER-MIB", '+'.$config['install_dir']."/mibs/junos");
|
||||
if (!strstr($descr, "No") && !strstr($temperature, "No") && $descr != "" && $temperature != "0")
|
||||
{
|
||||
$descr = str_replace("\"", "", $descr);
|
||||
$descr = str_replace("temperature", "", $descr);
|
||||
$descr = str_replace("temp", "", $descr);
|
||||
$descr = str_replace("temperature", "", $descr);
|
||||
$descr = str_replace("sensor", "", $descr);
|
||||
$descr = trim($descr);
|
||||
|
||||
discover_temperature($valid_temp, $device, $temp_oid, $oid, "junos", $descr, "1", NULL, NULL, $temp);
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $temperature_oid, $oid, 'junos', $descr, '1', '1', NULL, NULL, NULL, NULL, $temperature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
global $valid_temp;
|
||||
|
||||
global $valid_sensor;
|
||||
|
||||
## JunOSe Temperatures
|
||||
|
||||
if ($device['os'] == "junose")
|
||||
@@ -20,8 +20,7 @@ if ($device['os'] == "junose")
|
||||
$descr = str_replace("temperature sensor on", "", trim($descr));
|
||||
$oid = ".1.3.6.1.4.1.4874.2.2.2.1.9.4.1.3.".$index;
|
||||
$current = $entry['juniSystemTempValue'];
|
||||
discover_temperature($valid_temp, $device, $oid, $index, "junose", $descr, "1", NULL, NULL, $current);
|
||||
$temp_exists[] = $device['device_id'] . " $oid";
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $oid, $index, 'junose', $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
global $valid_temp;
|
||||
global $valid_sensor;
|
||||
|
||||
if ($device['os'] == "linux")
|
||||
{
|
||||
@@ -15,14 +15,14 @@ if ($device['os'] == "linux")
|
||||
{
|
||||
list($oid,$descr) = explode(" ", $data,2);
|
||||
$split_oid = explode('.',$oid);
|
||||
$temp_id = $split_oid[count($split_oid)-1];
|
||||
$temp_oid = "1.3.6.1.4.1.2021.13.16.2.1.3.$temp_id";
|
||||
$temp = snmp_get($device, $temp_oid, "-Ovq") / 1000;
|
||||
$descr = str_ireplace("temp-", "", $descr);
|
||||
$temperature_id = $split_oid[count($split_oid)-1];
|
||||
$temperature_oid = "1.3.6.1.4.1.2021.13.16.2.1.3.$temperature_id";
|
||||
$temperature = snmp_get($device, $temperature_oid, "-Ovq") / 1000;
|
||||
$descr = str_ireplace("temperature-", "", $descr);
|
||||
$descr = trim($descr);
|
||||
if($temp != "0" && $temp <= "1000")
|
||||
if($temperature != "0" && $temperature <= "1000")
|
||||
{
|
||||
discover_temperature($valid_temp, $device, $temp_oid, $temp_id, "lmsensors", $descr, "1000", NULL, NULL, $temp);
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $temperature_oid, $temperature_id, 'lmsensors', $descr, '1000', '1', NULL, NULL, NULL, NULL, $temperature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
global $valid_temp;
|
||||
|
||||
global $valid_sensor;
|
||||
|
||||
if($device['os'] == "netmanplus")
|
||||
{
|
||||
$oids = snmp_walk($device, "1.3.6.1.2.1.33.1.2.7", "-Osqn", "UPS-MIB");
|
||||
@@ -15,11 +15,11 @@ if($device['os'] == "netmanplus")
|
||||
{
|
||||
list($oid,$descr) = explode(" ", $data,2);
|
||||
$split_oid = explode('.',$oid);
|
||||
$temp_id = $split_oid[count($split_oid)-1];
|
||||
$temp_oid = "1.3.6.1.2.1.33.1.2.7.$temp_id";
|
||||
$temp = snmp_get($device, $temp_oid, "-Ovq");
|
||||
$descr = "Battery" . (count(explode("\n",$oids)) == 1 ? '' : ' ' . ($temp_id+1));
|
||||
discover_temperature($valid_temp, $device, $temp_oid, $temp_id, "netmanplus", $descr, 1, NULL, NULL, $temp);
|
||||
$temperature_id = $split_oid[count($split_oid)-1];
|
||||
$temperature_oid = "1.3.6.1.2.1.33.1.2.7.$temperature_id";
|
||||
$temperature = snmp_get($device, $temperature_oid, "-Ovq");
|
||||
$descr = "Battery" . (count(explode("\n",$oids)) == 1 ? '' : ' ' . ($temperature_id+1));
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $temperature_oid, $temperature_id, 'netmanplus', $descr, '1', '1', NULL, NULL, NULL, NULL, $temperature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
global $valid_temp;
|
||||
|
||||
global $valid_sensor;
|
||||
|
||||
if($device['os_group'] == "unix")
|
||||
{
|
||||
# FIXME snmp_walk
|
||||
@@ -18,7 +18,7 @@ if($device['os_group'] == "unix")
|
||||
$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)));
|
||||
$fulloid = ".1.3.6.1.4.1.2021.7891.$oid.101.1";
|
||||
discover_temperature($valid_temp, $device, $fulloid, $oid, "observernms", $descr, "1", NULL, NULL, NULL);
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $fulloid, $oid, 'observium', $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,19 +1,19 @@
|
||||
<?php
|
||||
|
||||
global $valid_temp;
|
||||
|
||||
global $valid_sensor;
|
||||
|
||||
if ($device['os'] == "papouch-tme")
|
||||
{
|
||||
echo("Papouch TME ");
|
||||
|
||||
$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;
|
||||
$temperature = snmp_get($device, "SNMPv2-SMI::enterprises.18248.1.1.1.0", "-Oqv") / 10;
|
||||
|
||||
if ($descr != "" && $temp != "0")
|
||||
if ($descr != "" && $is_numeric($temperature) && $temperature > "0")
|
||||
{
|
||||
$temp_oid = ".1.3.6.1.4.1.18248.1.1.1.0";
|
||||
$temperature_oid = ".1.3.6.1.4.1.18248.1.1.1.0";
|
||||
$descr = trim(str_replace("\"", "", $descr));
|
||||
discover_temperature($valid_temp, $device, $temp_oid, "1", "ironware", $descr, "10", NULL, NULL, $temp);
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $temperature_oid, "1", 'papouch-tme', $descr, '1', '1', NULL, NULL, NULL, NULL, $temperature);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
global $valid_temp;
|
||||
|
||||
global $valid_sensor;
|
||||
|
||||
if ($device['os'] == "powerconnect")
|
||||
{
|
||||
$oids = snmp_get($device, ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.4.0", "-OsqnU", "");
|
||||
@@ -10,11 +10,12 @@ if ($device['os'] == "powerconnect")
|
||||
{
|
||||
echo("Powerconnect ");
|
||||
list($oid,$current) = explode(' ',$oids);
|
||||
$precision = 1;
|
||||
$divisor = "1";
|
||||
$multiplier = "1";
|
||||
$type = "powerconnect";
|
||||
$index = 0;
|
||||
$index = "0";
|
||||
$descr = "Internal Temperature";
|
||||
discover_temperature($valid_temp, $device, $oid, $index, $type, $descr, $precision, NULL, NULL, $current);
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $oid, $index, $type, $descr, $divisor, $multiplier, NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
global $valid_temp;
|
||||
global $valid_sensor;
|
||||
|
||||
if($device['os'] == "linux")
|
||||
{
|
||||
@@ -18,20 +18,20 @@ if($device['os'] == "linux")
|
||||
$index = $oid_ex[count($oid_ex)-1];
|
||||
if ($type == 2)
|
||||
{
|
||||
$temp_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.4.$index";
|
||||
$temperature_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.$index";
|
||||
$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.$index";
|
||||
$monitor_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.10.$index";
|
||||
$descr = snmp_get($device, $descr_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
$temp = snmp_get($device, $temp_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
$temperature = snmp_get($device, $temperature_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
$limit = snmp_get($device, $limit_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
$divisor = snmp_get($device, $divisor_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB") || 1;
|
||||
$monitor = snmp_get($device, $monitor_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
if ($monitor == 'true')
|
||||
{
|
||||
$descr = trim(str_ireplace("temperature", "", $descr));
|
||||
discover_temperature($valid_temp, $device, $temp_oid, trim($index,'.'), "supermicro", $descr, $divisor, $limit, NULL, $temp);
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $temperature_oid, trim($index,'.'), 'supermicro', $descr, $divisor, '1', NULL, NULL, NULL, NULL, $temperature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
global $valid_temp;
|
||||
global $valid_sensor;
|
||||
|
||||
if ($device['os'] == 'ies')
|
||||
{
|
||||
@@ -20,9 +20,8 @@ if ($device['os'] == 'ies')
|
||||
$descr = trim(snmp_get($device, "accessSwitchSysTempDescr.".$index, "-Oqv", "ZYXEL-AS-MIB"),'"');
|
||||
$oid = ".1.3.6.1.4.1.890.1.5.1.1.6.1.2.".$index;
|
||||
$current = $entry['accessSwitchSysTempCurValue'];
|
||||
$divisor = 1;
|
||||
|
||||
discover_temperature($valid_temp, $device, $oid, $index, "entity-sensor", $descr, $divisor, NULL, $entry['accessSwitchSysTempHighThresh'], $current);
|
||||
$divisor = '1';
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $oid, $index, 'zyxel-ies', $descr, '1', '1', NULL, $entry['accessSwitchSysTempHighThresh'], NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,4 @@
|
||||
<?php
|
||||
$id = $device['device_id'];
|
||||
$hostname = $device['hostname'];
|
||||
$community = $device['community'];
|
||||
$snmpver = $device['snmpver'];
|
||||
$port = $device['port'];
|
||||
|
||||
$valid_volt = array();
|
||||
|
||||
echo("Voltages : ");
|
||||
|
||||
@@ -15,7 +8,7 @@ if ($device['os'] == "linux")
|
||||
$oids = snmp_walk($device, "lmVoltSensorsDevice", "-OsqnU", "LM-SENSORS-MIB");
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
if ($oids) echo("LM-SENSORS ");
|
||||
$precision = 1000;
|
||||
$divisor = 1000;
|
||||
$type = "lmsensors";
|
||||
foreach(explode("\n", $oids) as $data)
|
||||
{
|
||||
@@ -26,8 +19,8 @@ if ($device['os'] == "linux")
|
||||
$split_oid = explode('.',$oid);
|
||||
$index = $split_oid[count($split_oid)-1];
|
||||
$oid = "1.3.6.1.4.1.2021.13.16.4.1.3." . $index;
|
||||
$current = snmp_get($device, $oid, "-Oqv", "LM-SENSORS-MIB") / $precision;
|
||||
discover_volt($valid_volt,$device, $oid, $index, $type, $descr, $precision, NULL, NULL, $current);
|
||||
$current = snmp_get($device, $oid, "-Oqv", "LM-SENSORS-MIB") / $divisor;
|
||||
echo discover_sensor($valid_sensor, 'volt', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,7 +31,7 @@ if ($device['os'] == "areca")
|
||||
$oids = snmp_walk($device, "1.3.6.1.4.1.18928.1.2.2.1.8.1.2", "-OsqnU", "");
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
if ($oids) echo("Areca ");
|
||||
$precision = 1000;
|
||||
$divisor = 1000;
|
||||
$type = "areca";
|
||||
foreach(explode("\n", $oids) as $data)
|
||||
{
|
||||
@@ -49,10 +42,10 @@ if ($device['os'] == "areca")
|
||||
$split_oid = explode('.',$oid);
|
||||
$index = $split_oid[count($split_oid)-1];
|
||||
$oid = "1.3.6.1.4.1.18928.1.2.2.1.8.1.3." . $index;
|
||||
$current = snmp_get($device, $oid, "-Oqv", "") / $precision;
|
||||
$current = snmp_get($device, $oid, "-Oqv", "") / $divisor;
|
||||
if ($descr != '"Battery Status"' || $current != 0.255) # FIXME not sure if this is supposed to be a voltage, but without BBU it's 225, then ignore.
|
||||
{
|
||||
discover_volt($valid_volt,$device, $oid, $index, $type, trim($descr,'"'), $precision, NULL, NULL, $current);
|
||||
echo discover_sensor($valid_sensor, 'volt', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,7 +57,7 @@ if ($device['os'] == "apc")
|
||||
$oids = snmp_walk($device, "1.3.6.1.4.1.318.1.1.8.5.3.3.1.3", "-OsqnU", "");
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
if ($oids) echo("APC In ");
|
||||
$precision = 1;
|
||||
$divisor = 1;
|
||||
$type = "apc";
|
||||
foreach(explode("\n", $oids) as $data)
|
||||
{
|
||||
@@ -76,14 +69,15 @@ if ($device['os'] == "apc")
|
||||
$index = $split_oid[count($split_oid)-3];
|
||||
$oid = "1.3.6.1.4.1.318.1.1.8.5.3.3.1.3." . $index . ".1.1";
|
||||
$descr = "Input Feed " . chr(64+$index);
|
||||
discover_volt($valid_volt,$device, $oid, "3.3.1.3.$index", $type, $descr, $precision, NULL, NULL, $current);
|
||||
echo discover_sensor($valid_sensor, 'volt', $device, $oid, "3.3.1.3.$index", $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$oids = snmp_walk($device, "1.3.6.1.4.1.318.1.1.8.5.4.3.1.3", "-OsqnU", "");
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
if ($oids) echo(" APC Out ");
|
||||
$precision = 1;
|
||||
$divisor = 1;
|
||||
$type = "apc";
|
||||
foreach(explode("\n", $oids) as $data)
|
||||
{
|
||||
@@ -95,7 +89,7 @@ if ($device['os'] == "apc")
|
||||
$index = $split_oid[count($split_oid)-3];
|
||||
$oid = "1.3.6.1.4.1.318.1.1.8.5.4.3.1.3." . $index . ".1.1";
|
||||
$descr = "Output Feed"; if (count(explode("\n", $oids)) > 1) { $descr .= " $index"; }
|
||||
discover_volt($valid_volt,$device, $oid, "4.3.1.3.$index", $type, $descr, $precision, NULL, NULL, $current);
|
||||
echo discover_sensor($valid_sensor, 'volt', $device, $oid, "4.3.1.3.$index", $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,11 +99,11 @@ if ($device['os'] == "apc")
|
||||
{
|
||||
echo(" APC In ");
|
||||
list($oid,$current) = explode(" ",$oids);
|
||||
$precision = 1;
|
||||
$divisor = 1;
|
||||
$type = "apc";
|
||||
$index = "3.2.1.0";
|
||||
$descr = "Input";
|
||||
discover_volt($valid_volt, $device, $oid, $index, $type, $descr, $precision, NULL, NULL, $current);
|
||||
echo discover_sensor($valid_sensor, 'volt', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
|
||||
$oids = snmp_get($device, "1.3.6.1.4.1.318.1.1.1.4.2.1.0", "-OsqnU", "");
|
||||
@@ -118,11 +112,11 @@ if ($device['os'] == "apc")
|
||||
{
|
||||
echo(" APC Out ");
|
||||
list($oid,$current) = explode(" ",$oids);
|
||||
$precision = 1;
|
||||
$divisor = 1;
|
||||
$type = "apc";
|
||||
$index = "4.2.1.0";
|
||||
$descr = "Output";
|
||||
discover_volt($valid_volt, $device, $oid, $index, $type, $descr, $precision, NULL, NULL, $current);
|
||||
echo discover_sensor($valid_sensor, 'volt', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +128,7 @@ if ($device['os'] == "linux")
|
||||
$oids = trim($oids);
|
||||
if ($oids) echo("Supermicro ");
|
||||
$type = "supermicro";
|
||||
$precision = "1000";
|
||||
$divisor = "1000";
|
||||
foreach(explode("\n", $oids) as $data)
|
||||
{
|
||||
$data = trim($data);
|
||||
@@ -152,15 +146,15 @@ if ($device['os'] == "linux")
|
||||
$lowlimit_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.6.".$index;
|
||||
|
||||
$descr = snmp_get($device, $descr_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
$current = snmp_get($device, $volt_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB") / $precision;
|
||||
$limit = snmp_get($device, $limit_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB") / $precision;
|
||||
$lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB") / $precision;
|
||||
$current = snmp_get($device, $volt_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB") / $divisor;
|
||||
$limit = snmp_get($device, $limit_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB") / $divisor;
|
||||
$lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB") / $divisor;
|
||||
$monitor = snmp_get($device, $monitor_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
$descr = trim(str_ireplace("Voltage", "", $descr));
|
||||
|
||||
if ($monitor == 'true')
|
||||
{
|
||||
echo discover_volt($valid_volt,$device, $volt_oid, $index, $type, $descr, $precision, $lowlimit, $limit, $current);
|
||||
echo discover_sensor($valid_sensor, 'volt', $device, $volt_oid, $index, $type, $descr, $divisor, '1', $lowlimit, NULL, $limit, NULL, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,9 +180,9 @@ if ($device['os'] == "mgeups")
|
||||
}
|
||||
$current /= 10;
|
||||
$type = "mge-ups";
|
||||
$precision = 10;
|
||||
$divisor = 10;
|
||||
$index = $i;
|
||||
echo discover_volt($valid_volt,$device, $volt_oid, $index, $type, $descr, $precision, $lowlimit, $limit, $current);
|
||||
echo discover_sensor($valid_sensor, 'volt', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
$oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.6.1", "-OsqnU"));
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
@@ -205,9 +199,9 @@ if ($device['os'] == "mgeups")
|
||||
}
|
||||
$current /= 10;
|
||||
$type = "mge-ups";
|
||||
$precision = 10;
|
||||
$divisor = 10;
|
||||
$index = 100+$i;
|
||||
echo discover_volt($valid_volt,$device, $volt_oid, $index, $type, $descr, $precision, $lowlimit, $limit, $current);
|
||||
echo discover_sensor($valid_sensor, 'volt', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,13 +222,13 @@ if ($device['os'] == "netmanplus")
|
||||
$split_oid = explode('.',$oid);
|
||||
$volt_id = $split_oid[count($split_oid)-1];
|
||||
$volt_oid = "1.3.6.1.2.1.33.1.2.5.$volt_id";
|
||||
$precision = 10;
|
||||
$volt = snmp_get($device, $volt_oid, "-O vq") / $precision;
|
||||
#$volt = trim(shell_exec($config['snmpget'] . " -O qv -$snmpver -c $community $hostname:$port $volt_oid")) / $precision;
|
||||
$divisor = 10;
|
||||
$volt = snmp_get($device, $volt_oid, "-O vq") / $divisor;
|
||||
#$volt = trim(shell_exec($config['snmpget'] . " -O qv -$snmpver -c $community $hostname:$port $volt_oid")) / $divisor;
|
||||
$descr = "Battery" . (count(explode("\n",$oids)) == 1 ? '' : ' ' . ($volt_id+1));
|
||||
$type = "netmanplus";
|
||||
$index = 500+$volt_id;
|
||||
discover_volt($valid_volt,$device, $volt_oid, $index, $type, $descr, $precision, NULL, NULL, $volt);
|
||||
echo discover_sensor($valid_sensor, 'volt', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $volt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,9 +241,9 @@ if ($device['os'] == "netmanplus")
|
||||
$descr = "Output"; if ($numPhase > 1) $descr .= " Phase $i";
|
||||
$current = snmp_get($device, $volt_oid, "-Oqv");
|
||||
$type = "netmanplus";
|
||||
$precision = 1;
|
||||
$divisor = 1;
|
||||
$index = $i;
|
||||
echo discover_volt($valid_volt,$device, $volt_oid, $index, $type, $descr, $precision, NULL, NULL, $current);
|
||||
echo discover_sensor($valid_sensor, 'volt', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
|
||||
$oids = trim(snmp_walk($device, "1.3.6.1.2.1.33.1.3.2.0", "-OsqnU"));
|
||||
@@ -261,9 +255,9 @@ if ($device['os'] == "netmanplus")
|
||||
$descr = "Input"; if ($numPhase > 1) $descr .= " Phase $i";
|
||||
$current = snmp_get($device, $volt_oid, "-Oqv");
|
||||
$type = "netmanplus";
|
||||
$precision = 1;
|
||||
$divisor = 1;
|
||||
$index = 100+$i;
|
||||
echo discover_volt($valid_volt,$device, $volt_oid, $index, $type, $descr, $precision, NULL, NULL, $current);
|
||||
echo discover_sensor($valid_sensor, 'volt', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
|
||||
$oids = trim(snmp_walk($device, "1.3.6.1.2.1.33.1.5.2.0", "-OsqnU"));
|
||||
@@ -275,9 +269,9 @@ if ($device['os'] == "netmanplus")
|
||||
$descr = "Bypass"; if ($numPhase > 1) $descr .= " Phase $i";
|
||||
$current = snmp_get($device, $volt_oid, "-Oqv");
|
||||
$type = "netmanplus";
|
||||
$precision = 1;
|
||||
$divisor = 1;
|
||||
$index = 200+$i;
|
||||
echo discover_volt($valid_volt,$device, $volt_oid, $index, $type, $descr, $precision, NULL, NULL, $current);
|
||||
echo discover_sensor($valid_sensor, 'volt', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,12 +283,11 @@ if ($device['os'] == "gamatronicups")
|
||||
$descr = "Input Phase $i";
|
||||
$volt = snmp_get($device, $volt_oid, "-Oqv");
|
||||
$type = "gamatronicups";
|
||||
$precision = 1;
|
||||
$divisor = 1;
|
||||
$index = $i;
|
||||
$lowlimit = 0;
|
||||
$limit = NULL;
|
||||
|
||||
echo discover_volt($valid_volt,$device, $volt_oid, $index, $type, $descr, $precision, $lowlimit, $limit, $volt);
|
||||
echo discover_sensor($valid_sensor, 'volt', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $volt);
|
||||
}
|
||||
|
||||
for($i = 1; $i <= 3 ;$i++)
|
||||
@@ -303,36 +296,19 @@ if ($device['os'] == "gamatronicups")
|
||||
$descr = "Output Phase $i";
|
||||
$volt = snmp_get($device, $volt_oid, "-Oqv");
|
||||
$type = "gamatronicups";
|
||||
$precision = 1;
|
||||
$divisor = 1;
|
||||
$index = 100+$i;
|
||||
$lowlimit = 0;
|
||||
$limit = NULL;
|
||||
|
||||
echo discover_volt($valid_volt,$device, $volt_oid, $index, $type, $descr, $precision, $lowlimit, $limit, $volt);
|
||||
echo discover_sensor($valid_sensor, 'volt', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $volt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($debug) { print_r($valid['volt']); }
|
||||
|
||||
## Delete removed sensors
|
||||
check_valid_sensors($device, 'volt', $valid_sensor);
|
||||
|
||||
if($debug) { print_r($valid_volt); }
|
||||
|
||||
$sql = "SELECT * FROM voltage WHERE device_id = '".$device['device_id']."'";
|
||||
if ($query = mysql_query($sql))
|
||||
{
|
||||
while ($test_volt = mysql_fetch_array($query))
|
||||
{
|
||||
$index = $test_volt['volt_index'];
|
||||
$type = $test_volt['volt_type'];
|
||||
if($debug) { echo("$type -> $index\n"); }
|
||||
if(!$valid_volt[$type][$index]) {
|
||||
echo("-");
|
||||
mysql_query("DELETE FROM `voltage` WHERE volt_id = '" . $test_volt['volt_id'] . "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($valid_volt); echo("\n");
|
||||
echo("\n");
|
||||
|
||||
?>
|
||||
|
@@ -8,10 +8,9 @@ while($dbcurrent = mysql_fetch_array($current_data)) {
|
||||
|
||||
$current = snmp_get($device, $dbcurrent['sensor_oid'], "-OUqnv", "SNMPv2-MIB");
|
||||
|
||||
if ($dbcurrent['sensor_precision'])
|
||||
{
|
||||
$current = $current / $dbcurrent['sensor_precision'];
|
||||
}
|
||||
if ($dbcurrent['sensor_divisor']) { $current = $current / $dbcurrent['sensor_divisor']; }
|
||||
if ($dbcurrent['sensor_multplier']) { $current = $current * $dbcurrent['sensor_multiplier']; }
|
||||
|
||||
|
||||
$currentrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("current-" . $dbcurrent['sensor_descr'] . ".rrd");
|
||||
|
||||
|
@@ -8,7 +8,9 @@ while($fanspeed = mysql_fetch_array($fan_data)) {
|
||||
|
||||
$fan = snmp_get($device, $fanspeed['sensor_oid'], "-OUqnv", "SNMPv2-MIB");
|
||||
|
||||
if ($fanspeed['sensor_precision']) { $fan = $fan / $fanspeed['sensor_precision']; }
|
||||
if ($fanspeed['sensor_divisor']) { $fan = $fan / $fanspeed['sensor_divisor']; }
|
||||
if ($fanspeed['sensor_multiplier']) { $fan = $fan * $fanspeed['sensor_multiplier']; }
|
||||
|
||||
|
||||
$fanrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("fan-" . $fanspeed['sensor_descr'] . ".rrd");
|
||||
|
||||
|
@@ -11,10 +11,9 @@ while($humidity = mysql_fetch_array($hum_data)) {
|
||||
|
||||
## fixme snmp_get()
|
||||
|
||||
if ($humidity['sensor_precision'])
|
||||
{
|
||||
$hum = $hum / $humidity['sensor_precision'];
|
||||
}
|
||||
if ($humidity['sensor_divisor']) { $hum = $hum / $humidity['sensor_divisor']; }
|
||||
if ($humidity['sensor_multiplier']) { $hum = $hum / $humidity['sensor_multiplier']; }
|
||||
|
||||
|
||||
$humrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("humidity-" . $humidity['sensor_descr'] . ".rrd");
|
||||
|
||||
|
@@ -16,7 +16,8 @@ while($temperature = mysql_fetch_array($temp_data)) {
|
||||
sleep(1); # Give the TME some time to reset
|
||||
}
|
||||
|
||||
if ($temperature['sensor_precision']) { $temp = $temp / $temperature['sensor_precision']; }
|
||||
if ($temperature['sensor_divisor']) { $temp = $temp / $temperature['sensor_divisor']; }
|
||||
if ($temperature['sensor_multiplier']) { $temp = $temp * $temperature['sensor_multiplier']; }
|
||||
|
||||
$temprrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("temp-" . $temperature['sensor_descr'] . ".rrd");
|
||||
|
||||
|
@@ -8,10 +8,8 @@ while($voltage = mysql_fetch_array($volt_data)) {
|
||||
|
||||
$volt = snmp_get($device, $voltage['sensor_oid'], "-OUqnv", "SNMPv2-MIB");
|
||||
|
||||
if ($voltage['sensor_precision'])
|
||||
{
|
||||
$volt = $volt / $voltage['sensor_precision'];
|
||||
}
|
||||
if ($voltage['sensor_divisor']) { $volt = $volt / $voltage['sensor_divisor']; }
|
||||
if ($voltage['sensor_multiplier']) { $volt = $volt * $voltage['sensor_multiplier']; }
|
||||
|
||||
$voltrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("volt-" . $voltage['sensor_descr'] . ".rrd");
|
||||
|
||||
|
Reference in New Issue
Block a user