mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
- Added a utility function formatCiscoHardware()
Params: - A reference to the $device array. - An optional (true) if you want the platform only (and not the part number) - In device overview place Hardware before Operating System (makes more sence) - Added virtual $device['hardware'] for Cisco platforms without an hardware tag (like Cisco 3750) git-svn-id: http://www.observium.org/svn/observer/trunk@925 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@ -7,7 +7,6 @@
|
|||||||
# $uptime = @mysql_result(mysql_query("SELECT `attrib_value` FROM `devices_attribs` WHERE `device_id` = '" . $device['device_id'] . "' AND `attrib_type` = 'uptime'"), 0);
|
# $uptime = @mysql_result(mysql_query("SELECT `attrib_value` FROM `devices_attribs` WHERE `device_id` = '" . $device['device_id'] . "' AND `attrib_type` = 'uptime'"), 0);
|
||||||
$uptime = $device['uptime'];
|
$uptime = $device['uptime'];
|
||||||
|
|
||||||
|
|
||||||
if(is_file("images/devices/" . $device['hardware'] . ".gif")) {
|
if(is_file("images/devices/" . $device['hardware'] . ".gif")) {
|
||||||
$dev_img = "<div style='float: left;'><img src='images/devices/" . $device['hardware'] . ".gif' align=absmiddle></img></div>";
|
$dev_img = "<div style='float: left;'><img src='images/devices/" . $device['hardware'] . ".gif' align=absmiddle></img></div>";
|
||||||
} elseif (is_file("images/devices/" . $device['hardware'] . ".jpg")) {
|
} elseif (is_file("images/devices/" . $device['hardware'] . ".jpg")) {
|
||||||
@ -15,22 +14,23 @@
|
|||||||
} else { unset($dev_img); }
|
} else { unset($dev_img); }
|
||||||
|
|
||||||
|
|
||||||
|
if ($device['os'] == "ios") { formatCiscoHardware($device); }
|
||||||
if ($device['features']) { $device['features'] = "(".$device['features'].")"; }
|
if ($device['features']) { $device['features'] = "(".$device['features'].")"; }
|
||||||
$device['os_text'] = $os_text[$device[os]];
|
$device['os_text'] = $os_text[$device[os]];
|
||||||
|
|
||||||
echo("$ddev_img
|
echo("$ddev_img
|
||||||
<table width=100%>
|
<table width=100%>");
|
||||||
<tr>
|
|
||||||
<td class=list-bold>Operating System</td>
|
|
||||||
<td>" . $device['os_text'] . " " . $device['version'] . " " . $device['features'] . " </td>
|
|
||||||
</tr>");
|
|
||||||
|
|
||||||
if($device['hardware']) {echo("<tr>
|
if($device['hardware']) {echo("<tr>
|
||||||
<td class=list-bold>Hardware</td>
|
<td class=list-bold>Hardware</td>
|
||||||
<td>" . $device['hardware']. "</td>
|
<td>" . $device['hardware']. "</td>
|
||||||
</tr>"); }
|
</tr>"); }
|
||||||
|
|
||||||
|
echo("<tr>
|
||||||
|
<td class=list-bold>Operating System</td>
|
||||||
|
<td>" . $device['os_text'] . " " . $device['version'] . " " . $device['features'] . " </td>
|
||||||
|
</tr>");
|
||||||
|
|
||||||
if($device['sysContact']) {echo("<tr>
|
if($device['sysContact']) {echo("<tr>
|
||||||
<td class=list-bold>Contact</td>
|
<td class=list-bold>Contact</td>
|
||||||
<td>" . htmlspecialchars($device['sysContact']). "</td>
|
<td>" . htmlspecialchars($device['sysContact']). "</td>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
unset($image);
|
unset($image);
|
||||||
|
|
||||||
$image = getImage($device['device_id']);
|
$image = getImage($device['device_id']);
|
||||||
|
if ($device['os'] == "ios") { formatCiscoHardware($device, true); }
|
||||||
$device['os_text'] = $os_text[$device['os']];
|
$device['os_text'] = $os_text[$device['os']];
|
||||||
|
|
||||||
echo(' <tr background="'.$bg_image.'" bgcolor="' . $bg . '" onmouseover="this.style.backgroundColor=\'#fdd\';" onmouseout="this.style.backgroundColor=\'' . $bg . '\';"
|
echo(' <tr background="'.$bg_image.'" bgcolor="' . $bg . '" onmouseover="this.style.backgroundColor=\'#fdd\';" onmouseout="this.style.backgroundColor=\'' . $bg . '\';"
|
||||||
|
@ -50,6 +50,8 @@ $config['graph_colours']['blues'] = array('A0A0E5','8080BD','606096','40406F',
|
|||||||
$config['graph_colours']['purples'] = array('CC7CCC','AF63AF','934A93','773177','5B185B','3F003F');
|
$config['graph_colours']['purples'] = array('CC7CCC','AF63AF','934A93','773177','5B185B','3F003F');
|
||||||
$config['graph_colours']['default'] = $config['graph_colours']['blues'];
|
$config['graph_colours']['default'] = $config['graph_colours']['blues'];
|
||||||
|
|
||||||
|
### The device overview page options
|
||||||
|
|
||||||
$config['overview_show_sysDescr'] = true;
|
$config['overview_show_sysDescr'] = true;
|
||||||
|
|
||||||
### Ignores & Allows
|
### Ignores & Allows
|
||||||
|
@ -836,4 +836,24 @@ function notify($device,$title,$message)
|
|||||||
mail($email, $title, $message, $config['email_headers']);
|
mail($email, $title, $message, $config['email_headers']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function formatCiscoHardware(&$device, $short = false)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($device['os'] == "ios") {
|
||||||
|
if ($device['hardware']) {
|
||||||
|
if (preg_match("/^WS-C([A-Za-z0-9]+).*/", $device['hardware'], $matches)) {
|
||||||
|
if (!$short) {
|
||||||
|
$device['hardware'] = "Cisco " . $matches[1] . " (" . $device['hardware'] . ")";
|
||||||
|
} else {
|
||||||
|
$device['hardware'] = "Cisco " . $matches[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (preg_match("/Cisco IOS Software, C([A-Za-z0-9]+) Software.*/", $device['sysDescr'], $matches)) {
|
||||||
|
$device['hardware'] = "Cisco " . $matches[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
Reference in New Issue
Block a user