diff --git a/database-update.sql b/database-update.sql index 73fd9a1f57..bb7e8a44a5 100644 --- a/database-update.sql +++ b/database-update.sql @@ -19,3 +19,6 @@ CREATE TABLE IF NOT EXISTS `applications` ( `app_id` int(11) NOT NULL AUTO_INCR ## 0.10.6 CREATE TABLE IF NOT EXISTS `sensors` ( `sensor_id` int(11) NOT NULL auto_increment, `sensor_class` varchar(64) NOT NULL, `device_id` int(11) NOT NULL default '0', `sensor_oid` varchar(64) NOT NULL, `sensor_index` varchar(8) NOT NULL, `sensor_type` varchar(32) NOT NULL, `sensor_descr` varchar(32) NOT NULL default '', `sensor_precision` int(11) NOT NULL default '1', `sensor_current` float default NULL, `sensor_limit` float default NULL, `sensor_limit_warn` float default NULL, `sensor_limit_low` float default NULL, `sensor_limit_low_warn` float default NULL, PRIMARY KEY (`sensor_id`), KEY `sensor_host` (`device_id`)) ENGINE=MyISAM AUTO_INCREMENT=189 DEFAULT CHARSET=latin1; ALTER TABLE `devices` CHANGE `type` `type` VARCHAR(20) NOT NULL; +ALTER TABLE `voltage` CHANGE `volt_index` `volt_index` VARCHAR(10) NOT NULL; +ALTER TABLE `frequency` CHANGE `freq_index` `freq_index` VARCHAR(10) NOT NULL; +ALTER TABLE `sensors` CHANGE `sensor_index` `sensor_index` VARCHAR(10) NOT NULL; diff --git a/includes/discovery/current.inc.php b/includes/discovery/current.inc.php index 6db23adbfb..bb6f2255d7 100644 --- a/includes/discovery/current.inc.php +++ b/includes/discovery/current.inc.php @@ -9,9 +9,10 @@ $valid_current = array(); echo("Current : "); -## APC PDU +## APC if ($device['os'] == "apc") { + # PDU $oids = snmp_walk($device, ".1.3.6.1.4.1.318.1.1.12.2.3.1.1.2", "-OsqnU", ""); if ($debug) { echo($oids."\n"); } $oids = trim($oids); @@ -43,6 +44,25 @@ if ($device['os'] == "apc") echo discover_current($valid_current,$device, $current_oid, $index, $type, $descr, $precision, $lowlimit, $warnlimit, $limit, $current); } } + + # ATS + $atsCurrent = snmp_get($device, "1.3.6.1.4.1.318.1.1.8.5.4.3.1.4.1.1.1", "-OsqnU", ""); + if ($atsCurrent) + { + $current_oid = "1.3.6.1.4.1.318.1.1.8.5.4.3.1.4.1.1.1"; + $limit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.5.1"; + $lowlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.3.1"; + $warnlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.4.1"; + $index = 1; + + $current = snmp_get($device, $current_oid, "-Oqv", "") / $precision; + $limit = snmp_get($device, $limit_oid, "-Oqv", ""); # No / $precision here! Nice, APC! + $lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", ""); # No / $precision here! Nice, 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); + } } ## MGE UPS diff --git a/includes/discovery/frequencies.inc.php b/includes/discovery/frequencies.inc.php index c9aeea5bd6..1c1cbe53e7 100644 --- a/includes/discovery/frequencies.inc.php +++ b/includes/discovery/frequencies.inc.php @@ -89,6 +89,48 @@ if ($device['os'] == "netmanplus") echo discover_freq($valid_freq, $device, $freq_oid, $index, $type, $descr, $precision, NULL, NULL, $current); } +## APC +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; + $type = "apc"; + foreach(explode("\n", $oids) as $data) + { + $data = trim($data); + if ($data) + { + list($oid,$current) = explode(" ", $data,2); + $split_oid = explode('.',$oid); + $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); + } + } + + $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; + $type = "apc"; + foreach(explode("\n", $oids) as $data) + { + $data = trim($data); + if ($data) + { + list($oid,$current) = explode(" ", $data,2); + $split_oid = explode('.',$oid); + $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); + } + } +} + ## Delete removed sensors diff --git a/includes/discovery/voltages.inc.php b/includes/discovery/voltages.inc.php index 8bf4165515..b4d255306b 100755 --- a/includes/discovery/voltages.inc.php +++ b/includes/discovery/voltages.inc.php @@ -58,6 +58,48 @@ if ($device['os'] == "areca") } } +## APC Voltages +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; + $type = "apc"; + foreach(explode("\n", $oids) as $data) + { + $data = trim($data); + if ($data) + { + list($oid,$current) = explode(" ", $data,2); + $split_oid = explode('.',$oid); + $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); + } + } + + $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; + $type = "apc"; + foreach(explode("\n", $oids) as $data) + { + $data = trim($data); + if ($data) + { + list($oid,$current) = explode(" ", $data,2); + $split_oid = explode('.',$oid); + $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); + } + } +} + ## Supermicro Voltages if ($device['os'] == "linux") { diff --git a/includes/polling/device-apc.inc.php b/includes/polling/device-apc.inc.php index 50fef197e0..a85398fc2d 100755 --- a/includes/polling/device-apc.inc.php +++ b/includes/polling/device-apc.inc.php @@ -1,11 +1,36 @@