mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
start cleanup of overlib into functions. create defaults.inc.php for new settings (why not before? because i suck. duh.)
git-svn-id: http://www.observium.org/svn/observer/trunk@796 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
## Have a look in defaults.php for examples of settinsg you can set here. DO NOT defaults.php!
|
||||
include("includes/defaults.php");
|
||||
|
||||
### Database config
|
||||
$config['db_host'] = "localhost";
|
||||
$config['db_user'] = "USERNAME";
|
||||
@@ -39,15 +42,6 @@ $config['snmpget'] = "/usr/bin/snmpget";
|
||||
$config['snmpbulkwalk'] = "/usr/bin/snmpbulkwalk";
|
||||
$config['snmpset'] = "/usr/bin/snmpset";
|
||||
|
||||
|
||||
### RRDGraph Settings
|
||||
|
||||
# Set the general colours and other settings for rrdtool graphs
|
||||
|
||||
$config['rrdgraph_def_text'] = " -c BACK#EEEEEE00 -c SHADEA#EEEEEE00 -c SHADEB#EEEEEE00 -c FONT#000000 -c CANVAS#FFFFFF -c GRID#a5a5a5";
|
||||
$config['rrdgraph_def_text'] .= " -c MGRID#FF9999 -c FRAME#5e5e5e -c ARROW#5e5e5e -R normal";
|
||||
$config['overlib_defaults'] = ",FGCOLOR,'#ffffff', BGCOLOR, '#e5e5e5', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#555555'";
|
||||
|
||||
### List of networks to allow scanning-based discovery
|
||||
$config['nets'] = array ("89.21.224.0/19", "212.9.12.0/24", "212.9.13.0/24");
|
||||
|
||||
|
7
includes/defaults.inc.php
Normal file
7
includes/defaults.inc.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$config['rrdgraph_def_text'] = " -c BACK#EEEEEE00 -c SHADEA#EEEEEE00 -c SHADEB#EEEEEE00 -c FONT#000000 -c CANVAS#FFFFFF -c GRID#a5a5a5";
|
||||
$config['rrdgraph_def_text'] .= " -c MGRID#FF9999 -c FRAME#5e5e5e -c ARROW#5e5e5e -R normal";
|
||||
$config['overlib_defaults'] = ",FGCOLOR,'#ffffff', BGCOLOR, '#e5e5e5', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#555555', TEXTCOLOR, '#3e3e3e'";
|
||||
|
||||
?>
|
@@ -311,27 +311,33 @@ function geteventicon ($message)
|
||||
if ($icon) { return $icon; } else { return false; }
|
||||
}
|
||||
|
||||
function generateiflink($interface, $text=0, $type = '')
|
||||
function generateiflink($interface, $text=0, $type = NULL)
|
||||
{
|
||||
global $twoday; global $now; global $config; global $day; global $month;
|
||||
$interface = ifNameDescr($interface);
|
||||
if (!$text) { $text = fixIfName($interface['label']); }
|
||||
if (isset($type)) { $interface['graph_type'] = $type; }
|
||||
if (!$interface['graph_type']) { $interface['graph_type'] = 'port_bits'; }
|
||||
if (isset($type)) { $interface['graph_type'] = $type; } else { $interface['graph_type'] = 'port_bits'; }
|
||||
$class = ifclass($interface['ifOperStatus'], $interface['ifAdminStatus']);
|
||||
$graph_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&from=$day&to=$now&width=400&height=100&type=" . $interface['graph_type'];
|
||||
$graph_url_month = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&from=$month&to=$now&width=400&height=100&type=" . $interface['graph_type'];
|
||||
$device_id = getifhost($interface['interface_id']);
|
||||
$link = "<a class=$class href='".$config['base_url']."/device/$device_id/interface/" . $interface['interface_id'] . "/' ";
|
||||
$link .= "onmouseover=\" return overlib('";
|
||||
$link .= "<img src=\'$graph_url\'><br /><img src=\'$graph_url_month\'>', CAPTION, '<span class=list-large>" . $interface['hostname'] . " - " . fixifName($interface['label']) . "</span>";
|
||||
if ($interface['ifAlias']) { $link .= "<br />" . htmlentities($interface['ifAlias']); }
|
||||
$link .= "' ";
|
||||
$link .= $config['overlib_defaults'].");\" onmouseout=\"return nd();\" >$text</a>";
|
||||
$url = $config['base_url']."/device/$device_id/interface/" . $interface['interface_id'] . "/";
|
||||
|
||||
$contents = "<div class=list-large>" . $interface['hostname'] . " - " . fixifName($interface['label']) . "</div>";
|
||||
if ($interface['ifAlias']) { $contents .= htmlentities($interface['ifAlias'] ."<br />" ); }
|
||||
$contents .= "<img src=\'$graph_url\'><br /><img src=\'$graph_url_month\'>";
|
||||
$link = overlib_link($url, $text, $contents, $class);
|
||||
return $link;
|
||||
}
|
||||
|
||||
function overlib_link($url, $text, $contents, $class) {
|
||||
global $config;
|
||||
$output = "<a class='".$class."' href='".$url."'";
|
||||
$output .= " onmouseover=\"return overlib('".$contents."'".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">";
|
||||
$output .= $text."</a>";
|
||||
return $output;
|
||||
}
|
||||
|
||||
function generatedevicelink($device, $text=0, $start=0, $end=0)
|
||||
{
|
||||
global $twoday; global $day; global $now; global $config;
|
||||
@@ -341,9 +347,13 @@ function generatedevicelink($device, $text=0, $start=0, $end=0)
|
||||
if (!$text) { $text = $device['hostname']; }
|
||||
$graph_url = $config['base_url'] . "/graph.php?device=" . $device['device_id'] . "&from=$start&to=$end&width=400&height=120&type=device_cpu";
|
||||
$graph_url_b = $config['base_url'] . "/graph.php?device=" . $device['device_id'] . "&from=$start&to=$end&width=400&height=120&type=device_memory";
|
||||
$link = "<a class=$class href='".$config['base_url']."/device/" . $device['device_id'] . "/' ";
|
||||
$link .= "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - CPU & Memory Usage</div>";
|
||||
$link .= "<img src=\'$graph_url\'><br /><img src=\'$graph_url_b\'>'".$config['overlib_defaults'].", LEFT);\" onmouseout=\"return nd();\">" . htmlentities($text) . "</a>";
|
||||
|
||||
$url = $config['base_url']."/device/" . $device['device_id'] . "/";
|
||||
$contents = "<div class=list-large>".$device['hostname']." - CPU & Memory Usage</div>";
|
||||
if ($device['location']) { $contents .= "" . htmlentities($device['location']."<br />"); }
|
||||
$contents .= "<img src=\'$graph_url\'><br /><img src=\'$graph_url_b\'";
|
||||
$text = htmlentities($text);
|
||||
$link = overlib_link($url, $text, $contents, $class);
|
||||
return $link;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user