diff --git a/html/includes/device-header.inc.php b/html/includes/device-header.inc.php index 19bb78bf7..931354dfb 100644 --- a/html/includes/device-header.inc.php +++ b/html/includes/device-header.inc.php @@ -15,9 +15,8 @@ if ($device['disabled'] == '1') } $type = strtolower($device['os']); -unset($image); -$image = getImage($device['device_id']); +$image = getImage($device); echo(' diff --git a/html/includes/hostbox.inc.php b/html/includes/hostbox.inc.php index c48bc3557..52756a362 100644 --- a/html/includes/hostbox.inc.php +++ b/html/includes/hostbox.inc.php @@ -27,9 +27,8 @@ if ($device['disabled'] == '1') } $type = strtolower($device['os']); -unset($image); -$image = getImage($device['device_id']); +$image = getImage($device); if ($device['os'] == "ios") { formatCiscoHardware($device, true); } $device['os_text'] = $config['os'][$device['os']]['text']; diff --git a/includes/functions.php b/includes/functions.php index 9e402bdb1..37e213539 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -101,28 +101,32 @@ function interface_errors($rrd_file, $period = '-1d') // Returns the last in/out return $errors; } -function getImage($host) +function getImage($device) { - ## FIXME why not pass $device? (my shitty ancient code here!) global $config; - $data = dbFetchRow("SELECT * FROM `devices` WHERE `device_id` = ?", array($host)); - $type = strtolower($data['os']); - if ($config['os'][$type]['icon'] && file_exists($config['html_dir'] . "/images/os/" . $config['os'][$type]['icon'] . ".png")) + $device['os'] = strtolower($device['os']); + + if ($device['icon'] && file_exists($config['html_dir'] . "/images/os/" . $device['icon'] . ".png")) { - $image = ''; - } elseif ($config['os'][$type]['icon'] && file_exists($config['html_dir'] . "/images/os/". $config['os'][$type]['icon'] . ".gif")) + $image = ''; + } + elseif ($config['os'][$device['os']]['icon'] && file_exists($config['html_dir'] . "/images/os/" . $config['os'][$device['os']]['icon'] . ".png")) { - $image = ''; + $image = ''; } else { - if (file_exists($config['html_dir'] . "/images/os/$type" . ".png")) { $image = ''; - } elseif (file_exists($config['html_dir'] . "/images/os/$type" . ".gif")) { $image = ''; } - if ($type == "linux") + if (file_exists($config['html_dir'] . '/images/os/' . $device['os'] . '.png')) { - $features = strtolower(trim($data['features'])); + $image = ''; + } + if ($device['os'] == "linux") + { + $features = strtolower(trim($device['features'])); list($distro) = explode(" ", $features); - if (file_exists($config['html_dir'] . "/images/os/$distro" . ".png")) { $image = ''; - } elseif (file_exists($config['html_dir'] . "/images/os/$distro" . ".gif")) { $image = ''; } + if (file_exists($config['html_dir'] . "/images/os/$distro" . ".png")) + { + $image = ''; + } } } diff --git a/includes/polling/os.inc.php b/includes/polling/os.inc.php index 889f6ef5d..4c99a6357 100644 --- a/includes/polling/os.inc.php +++ b/includes/polling/os.inc.php @@ -39,6 +39,12 @@ if ($serial && $serial != $device['serial']) log_event("Serial -> ".$serial, $device, 'system'); } +if ($icon && $icon != $device['icon']) +{ + $update_array['icon'] = $icon; + log_event("Icon -> ".nicecase($icon), $device, 'system'); +} + echo("\nHardware: ".$hardware." Version: ".$version." Features: ".$features." Serial: ".$serial."\n"); ?> diff --git a/includes/polling/os/radlan.inc.php b/includes/polling/os/radlan.inc.php index 50b618ecc..ade5a8893 100644 --- a/includes/polling/os/radlan.inc.php +++ b/includes/polling/os/radlan.inc.php @@ -5,11 +5,13 @@ if ($poll_device['sysDescr'] == "Neyland 24T") #$hardware = snmp_get($device, "productIdentificationVendor.0", "-Ovq", "Dell-Vendor-MIB"); $hardware = "Dell ".snmp_get($device, "productIdentificationDisplayName.0", "-Ovq", "Dell-Vendor-MIB"); $version = snmp_get($device, "productIdentificationVersion.0", "-Ovq", "Dell-Vendor-MIB"); + $icon = 'dell'; } else { $version = snmp_get($device, "rndBrgVersion.0", "-Ovq", "RADLAN-MIB"); $hardware = str_replace("ATI", "Allied Telesis", $poll_device['sysDescr']); + $icon = 'allied'; } $features = snmp_get($device, "rndBaseBootVersion.00", "-Ovq", "RADLAN-MIB");