mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
shorter interface names on graphs. shorter host names on graphs.
git-svn-id: http://www.observium.org/svn/observer/trunk@2543 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -7,7 +7,7 @@ if (is_numeric($id) && ($config['allow_unauth_graphs'] || port_permitted($id)))
|
|||||||
$title = generate_device_link($device);
|
$title = generate_device_link($device);
|
||||||
$title .= " :: Port ".generate_port_link($port);
|
$title .= " :: Port ".generate_port_link($port);
|
||||||
|
|
||||||
$graph_title = $device['hostname'] . "::" . $port['ifDescr'];
|
$graph_title = shorthost($device['hostname']) . "::" . strtolower(makeshortif($port['ifDescr']));
|
||||||
|
|
||||||
$auth = TRUE;
|
$auth = TRUE;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ if (count($sensors))
|
|||||||
{
|
{
|
||||||
echo('<div style="background-color: #eeeeee; margin: 5px; padding: 5px;">');
|
echo('<div style="background-color: #eeeeee; margin: 5px; padding: 5px;">');
|
||||||
echo('<p style="padding: 0px 5px 5px;" class="sectionhead"><a class="sectionhead" href="device/device='.$device['device_id'].'/tab=health/metric=' . strtolower($sensor_type) . '/"><img align="absmiddle" src="'.$config['base_url'].'/images/icons/' . strtolower($sensor_type) . '.png"> ' . $sensor_type . '</a></p>');
|
echo('<p style="padding: 0px 5px 5px;" class="sectionhead"><a class="sectionhead" href="device/device='.$device['device_id'].'/tab=health/metric=' . strtolower($sensor_type) . '/"><img align="absmiddle" src="'.$config['base_url'].'/images/icons/' . strtolower($sensor_type) . '.png"> ' . $sensor_type . '</a></p>');
|
||||||
$i = '1';
|
$i = '0';
|
||||||
echo('<table width="100%" valign="top">');
|
echo('<table width="100%" valign="top">');
|
||||||
foreach ($sensors as $sensor)
|
foreach ($sensors as $sensor)
|
||||||
{
|
{
|
||||||
@@ -45,7 +45,7 @@ if (count($sensors))
|
|||||||
|
|
||||||
$sensor['sensor_descr'] = truncate($sensor['sensor_descr'], 25, '');
|
$sensor['sensor_descr'] = truncate($sensor['sensor_descr'], 25, '');
|
||||||
echo("<tr bgcolor='$row_colour'>
|
echo("<tr bgcolor='$row_colour'>
|
||||||
<td class=tablehead><strong>".overlib_link($link, $sensor['sensor_descr'], $overlib_content)."</strong></td>
|
<td class=tablehead style='padding-left:5px;'><strong>".overlib_link($link, $sensor['sensor_descr'], $overlib_content)."</strong></td>
|
||||||
<td width=80 align=right class=tablehead>".overlib_link($link, $sensor_minigraph, $overlib_content)."</td>
|
<td width=80 align=right class=tablehead>".overlib_link($link, $sensor_minigraph, $overlib_content)."</td>
|
||||||
<td width=80 align=right class=tablehead>".overlib_link($link, "<span " . ($sensor['sensor_current'] < $sensor['sensor_limit_low'] || $sensor['sensor_current'] > $sensor['sensor_limit'] ? "style='color: red'" : '') . '>' . $sensor['sensor_current'] . $sensor_unit . "</span>", $overlib_content)."</td>
|
<td width=80 align=right class=tablehead>".overlib_link($link, "<span " . ($sensor['sensor_current'] < $sensor['sensor_limit_low'] || $sensor['sensor_current'] > $sensor['sensor_limit'] ? "style='color: red'" : '') . '>' . $sensor['sensor_current'] . $sensor_unit . "</span>", $overlib_content)."</td>
|
||||||
</tr>");
|
</tr>");
|
||||||
|
|||||||
@@ -2,6 +2,19 @@
|
|||||||
|
|
||||||
## Common Functions
|
## Common Functions
|
||||||
|
|
||||||
|
function shorthost($hostname, $len=12)
|
||||||
|
{
|
||||||
|
$parts = explode(".", $hostname);
|
||||||
|
$shorthost = $parts[0];
|
||||||
|
$i = 1;
|
||||||
|
while ($i < count($parts) && strlen($shorthost.'.'.$parts[$i]) < $len)
|
||||||
|
{
|
||||||
|
$shorthost = $shorthost.'.'.$parts[$i];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
return ($shorthost);
|
||||||
|
}
|
||||||
|
|
||||||
function isCli() {
|
function isCli() {
|
||||||
|
|
||||||
if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
|
if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
|
||||||
|
|||||||
+1
-14
@@ -56,19 +56,6 @@ function logfile($string)
|
|||||||
fclose($fd);
|
fclose($fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
function shorthost($hostname, $len=16)
|
|
||||||
{
|
|
||||||
$parts = explode(".", $hostname);
|
|
||||||
$shorthost = $parts[0];
|
|
||||||
$i = 1;
|
|
||||||
while ($i < count($parts) && strlen($shorthost.'.'.$parts[$i]) < $len)
|
|
||||||
{
|
|
||||||
$shorthost = $shorthost.'.'.$parts[$i];
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
return ($shorthost);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getHostOS($device)
|
function getHostOS($device)
|
||||||
{
|
{
|
||||||
global $config, $debug;
|
global $config, $debug;
|
||||||
@@ -669,4 +656,4 @@ function is_port_valid($port, $device)
|
|||||||
return $valid;
|
return $valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user