From ad1ca375e237a7ab67afb372fa3436a4e1441df1 Mon Sep 17 00:00:00 2001 From: Geert Hauwaerts Date: Fri, 13 May 2011 12:28:57 +0000 Subject: [PATCH] - BUGFIX: getidbyname() did not pass parameters to MySQL correctly. - Restructured sysContact and sysLocation "not set" code. - Do not display "SNMP Location" when empty or unset. git-svn-id: http://www.observium.org/svn/observer/trunk@2299 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/includes/dev-overview-data.inc.php | 2 +- includes/common.php | 2 +- includes/polling/os/vmware.inc.php | 14 -------------- includes/polling/system.inc.php | 10 ++++++++++ 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/html/includes/dev-overview-data.inc.php b/html/includes/dev-overview-data.inc.php index 7028e816b..b83b8c311 100644 --- a/html/includes/dev-overview-data.inc.php +++ b/html/includes/dev-overview-data.inc.php @@ -57,7 +57,7 @@ if ($device['location']) Location ' . $device['location']. ' '); - if (get_dev_attrib($device,'override_sysLocation_bool')) + if (get_dev_attrib($device,'override_sysLocation_bool') && !empty($device['real_location'])) { echo(' SNMP Location diff --git a/includes/common.php b/includes/common.php index d36a0abfd..dac3d5611 100644 --- a/includes/common.php +++ b/includes/common.php @@ -182,7 +182,7 @@ function getifdescrbyid($id) function getidbyname($domain) { - return dbFetchCell("SELECT `device_id` FROM `devices` WHERE `hostname` = ?", mres($domain)); + return dbFetchCell("SELECT `device_id` FROM `devices` WHERE `hostname` = ?", array($domain)); } function gethostosbyid($id) diff --git a/includes/polling/os/vmware.inc.php b/includes/polling/os/vmware.inc.php index f693e832b..57a9d16f5 100644 --- a/includes/polling/os/vmware.inc.php +++ b/includes/polling/os/vmware.inc.php @@ -15,20 +15,6 @@ $data = snmp_get_multi($device, "VMWARE-SYSTEM-MIB::vmwProdName.0 VMWARE-SYSTE $version = preg_replace("/^VMware /", "", $data[0]["vmwProdName"]) . " " . $data[0]["vmwProdVersion"]; $features = "build-" . $data[0]["vmwProdBuild"]; -/* - * VMware ESXi returns "not set" instead of a NULL value. - */ - -if ($sysLocation == "not set") -{ - $sysLocation = ""; -} - -if ($sysContact == "not set") -{ - $sysContact = ""; -} - /* * CONSOLE: Start the VMware discovery process. */ diff --git a/includes/polling/system.inc.php b/includes/polling/system.inc.php index 21a16bd78..778b1ad67 100755 --- a/includes/polling/system.inc.php +++ b/includes/polling/system.inc.php @@ -75,6 +75,16 @@ $poll_device['sysLocation'] = str_replace("\"","", $poll_device['sysLocation']); $poll_device['sysContact'] = str_replace("\"","", $poll_device['sysContact']); + if ($poll_device['sysLocation'] == "not set") + { + $poll_device['sysLocation'] = ""; + } + + if ($poll_device['sysContact'] == "not set") + { + $poll_device['sysContact'] = ""; + } + if ($poll_device['sysContact'] && $poll_device['sysContact'] != $device['sysContact']) { $update_array['sysContact'] = $poll_device['sysContact'];