From eb9281ff10497084f219dd41a12caa440e14aa60 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Wed, 9 Mar 2016 12:34:29 -0600 Subject: [PATCH] Fixes for Avtech Trim quotes from description Correct sensor type Allow sensor id of 0 Correct indexes for sensors --- includes/discovery/functions.inc.php | 6 +++--- .../sensors/temperatures/avtech.inc.php | 20 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index 7845d70a39..6329886292 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -725,7 +725,7 @@ function avtech_add_sensor($device, $sensor) { global $valid; // set the id, must be unique - if ($sensor['id']) { + if (isset($sensor['id'])) { $id = $sensor['id']; } else { @@ -755,13 +755,13 @@ function avtech_add_sensor($device, $sensor) { d_echo('Sensor value: ' . $value . "\n"); // get the type - $type = $device['type'] ? $device['type'] : 'temperature'; + $type = $sensor['type'] ? $sensor['type'] : 'temperature'; d_echo('Sensor type: ' . $type . "\n"); // set the description if ($sensor['descr_oid']) { - $descr = snmp_get($device, $sensor['descr_oid'], '-OvQ'); + $descr = trim(snmp_get($device, $sensor['descr_oid'], '-OvQ'), '"'); } elseif ($sensor['descr']) { $descr = $sensor['descr']; diff --git a/includes/discovery/sensors/temperatures/avtech.inc.php b/includes/discovery/sensors/temperatures/avtech.inc.php index a9f907fc10..956fed49a4 100644 --- a/includes/discovery/sensors/temperatures/avtech.inc.php +++ b/includes/discovery/sensors/temperatures/avtech.inc.php @@ -8,21 +8,21 @@ if ($device['os'] == 'avtech') { $device_oid = '.1.3.6.1.4.1.20916.1.7.'; $internal = array( - 'id' => 1, + 'id' => 0, 'oid' => $device_oid.'1.1.1.1.0', 'descr_oid' => $device_oid.'1.1.2.0', ); avtech_add_sensor($device, $internal); $sen1 = array( - 'id' => 2, + 'id' => 1, 'oid' => $device_oid.'1.2.1.1.0', 'descr_oid' => $device_oid.'1.2.1.3.0', ); avtech_add_sensor($device, $sen1); $sen2 = array( - 'id' => 3, + 'id' => 2, 'oid' => $device_oid.'1.2.2.1.0', 'descr_oid' => $device_oid.'1.2.2.3.0', ); @@ -33,7 +33,7 @@ if ($device['os'] == 'avtech') { $device_oid = '.1.3.6.1.4.1.20916.1.1.'; $internal = array( - 'id' => 1, + 'id' => 0, 'oid' => $device_oid.'1.1.1.0', 'descr' => 'Internal', 'max_oid' => $device_oid.'3.1.0', @@ -42,7 +42,7 @@ if ($device['os'] == 'avtech') { avtech_add_sensor($device, $internal); $sen1 = array( - 'id' => 2, + 'id' => 1, 'oid' => $device_oid.'1.1.2.0', 'descr' => 'Sensor 1', 'max_oid' => $device_oid.'3.3.0', @@ -51,7 +51,7 @@ if ($device['os'] == 'avtech') { avtech_add_sensor($device, $sen1); $sen2 = array( - 'id' => 3, + 'id' => 2, 'oid' => $device_oid.'1.1.3.0', 'descr' => 'Sensor 2', 'max_oid' => $device_oid.'3.5.0', @@ -60,7 +60,7 @@ if ($device['os'] == 'avtech') { avtech_add_sensor($device, $sen2); $sen3 = array( - 'id' => 4, + 'id' => 3, 'oid' => $device_oid.'1.1.4.0', 'descr' => 'Sensor 3', 'max_oid' => $device_oid.'3.7.0', @@ -74,7 +74,7 @@ if ($device['os'] == 'avtech') { $divisor = 1; $internal = array( - 'id' => 1, + 'id' => 0, 'oid' => $device_oid.'1.1.1.2.0', 'descr_oid' => $device_oid.'1.1.2.1.0', 'divisor' => $divisor, @@ -82,7 +82,7 @@ if ($device['os'] == 'avtech') { avtech_add_sensor($device, $internal); $sen1 = array( - 'id' => 2, + 'id' => 1, 'oid' => $device_oid.'1.2.2.1.0', 'descr_oid' => $device_oid.'1.2.1.6.0', 'divisor' => $divisor, @@ -90,7 +90,7 @@ if ($device['os'] == 'avtech') { avtech_add_sensor($device, $sen1); $sen2 = array( - 'id' => 3, + 'id' => 2, 'oid' => $device_oid.'1.2.2.1.0', 'descr_oid' => $device_oid.'1.2.2.6.0', 'divisor' => $divisor,