mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
remove support for GIF OS-icons, but add support to override OS icon through database, suitable for radlan devices and probably/possibly other OEMables
git-svn-id: http://www.observium.org/svn/observer/trunk@3087 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -15,9 +15,8 @@ if ($device['disabled'] == '1')
|
||||
}
|
||||
|
||||
$type = strtolower($device['os']);
|
||||
unset($image);
|
||||
|
||||
$image = getImage($device['device_id']);
|
||||
$image = getImage($device);
|
||||
|
||||
echo('
|
||||
<tr bgcolor="'.$device_colour.'" class="'.$class.'">
|
||||
|
@@ -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'];
|
||||
|
||||
|
@@ -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 = '<img src="'.$config['base_url'].'/images/os/'.$config['os'][$type]['icon'].'.png" />';
|
||||
} elseif ($config['os'][$type]['icon'] && file_exists($config['html_dir'] . "/images/os/". $config['os'][$type]['icon'] . ".gif"))
|
||||
$image = '<img src="' . $config['base_url'] . '/images/os/' . $device['icon'] . '.png" />';
|
||||
}
|
||||
elseif ($config['os'][$device['os']]['icon'] && file_exists($config['html_dir'] . "/images/os/" . $config['os'][$device['os']]['icon'] . ".png"))
|
||||
{
|
||||
$image = '<img src="'.$config['base_url'].'/images/os/'.$config['os'][$type]['icon'].'.gif" />';
|
||||
$image = '<img src="' . $config['base_url'] . '/images/os/' . $config['os'][$device['os']]['icon'] . '.png" />';
|
||||
} else {
|
||||
if (file_exists($config['html_dir'] . "/images/os/$type" . ".png")) { $image = '<img src="'.$config['base_url'].'/images/os/'.$type.'.png" />';
|
||||
} elseif (file_exists($config['html_dir'] . "/images/os/$type" . ".gif")) { $image = '<img src="'.$config['base_url'].'/images/os/'.$type.'.gif" />'; }
|
||||
if ($type == "linux")
|
||||
if (file_exists($config['html_dir'] . '/images/os/' . $device['os'] . '.png'))
|
||||
{
|
||||
$features = strtolower(trim($data['features']));
|
||||
$image = '<img src="' . $config['base_url'] . '/images/os/' . $device['os'] . '.png" />';
|
||||
}
|
||||
if ($device['os'] == "linux")
|
||||
{
|
||||
$features = strtolower(trim($device['features']));
|
||||
list($distro) = explode(" ", $features);
|
||||
if (file_exists($config['html_dir'] . "/images/os/$distro" . ".png")) { $image = '<img src="'.$config['base_url'].'/images/os/'.$distro.'.png" />';
|
||||
} elseif (file_exists($config['html_dir'] . "/images/os/$distro" . ".gif")) { $image = '<img src="'.$config['base_url'].'/images/os/'.$distro.'.gif" />'; }
|
||||
if (file_exists($config['html_dir'] . "/images/os/$distro" . ".png"))
|
||||
{
|
||||
$image = '<img src="' . $config['base_url'] . '/images/os/' . $distro . '.png" />';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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");
|
||||
|
||||
?>
|
||||
|
@@ -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");
|
||||
|
||||
|
Reference in New Issue
Block a user