mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
more memcached
git-svn-id: http://www.observium.org/svn/observer/trunk@3114 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -9,8 +9,17 @@ if (count($sensors))
|
||||
echo('<table width="100%" valign="top">');
|
||||
foreach ($sensors as $sensor)
|
||||
{
|
||||
### FIXME - make this "four graphs in popup" a function/include and "small graph" a function.
|
||||
if ($config['memcached']['enable'])
|
||||
{
|
||||
$sensor['sensor_current'] = $memcache->get('sensor-'.$sensor['sensor_id'].'-value');
|
||||
}
|
||||
|
||||
if(empty($sensor['sensor_current']))
|
||||
{
|
||||
$sensor['sensor_current'] = "NaN";
|
||||
}
|
||||
|
||||
### FIXME - make this "four graphs in popup" a function/include and "small graph" a function.
|
||||
### FIXME - So now we need to clean this up and move it into a function. Isn't it just "print-graphrow"?
|
||||
|
||||
$graph_colour = str_replace("#", "", $row_colour);
|
||||
|
@@ -4,6 +4,17 @@ if (!isset($vars['view']) ) { $vars['view'] = "graphs"; }
|
||||
|
||||
$port = dbFetchRow("SELECT * FROM `ports` WHERE `interface_id` = ?", array($vars['port']));
|
||||
|
||||
if ($config['memcached']['enable'])
|
||||
{
|
||||
$oids = array('ifInOctets', 'ifOutOctets', 'ifInUcastPkts', 'ifOutUcastPkts', 'ifInErrors', 'ifOutErrors');
|
||||
foreach($oids as $oid)
|
||||
{
|
||||
$port[$oid.'_rate'] = $memcache->get('port-'.$port['interface_id'].'-'.$oid.'_rate');
|
||||
if($debug) { echo("MC[".$oid."->".$port[$oid.'_rate']."]"); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$port_details = 1;
|
||||
|
||||
$hostname = $device['hostname'];
|
||||
|
@@ -107,8 +107,19 @@ if ($vars['view'] == 'minigraphs')
|
||||
|
||||
foreach ($ports as $port)
|
||||
{
|
||||
include("includes/print-interface.inc.php");
|
||||
|
||||
if ($config['memcached']['enable'])
|
||||
{
|
||||
$oids = array('ifInOctets', 'ifOutOctets', 'ifInUcastPkts', 'ifOutUcastPkts', 'ifInErrors', 'ifOutErrors');
|
||||
foreach($oids as $oid)
|
||||
{
|
||||
$port[$oid.'_rate'] = $memcache->get('port-'.$port['interface_id'].'-'.$oid.'_rate');
|
||||
if($debug) { echo("MC[".$oid."->".$port[$oid.'_rate']."]"); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
include("includes/print-interface.inc.php");
|
||||
$i++;
|
||||
}
|
||||
echo("</table></div>");
|
||||
|
@@ -25,12 +25,23 @@ echo('<tr class=tablehead>
|
||||
|
||||
foreach (dbFetchRows($sql, $param) as $sensor)
|
||||
{
|
||||
|
||||
if ($config['memcached']['enable'])
|
||||
{
|
||||
$sensor['sensor_current'] = $memcache->get('sensor-'.$sensor['sensor_id'].'-value');
|
||||
}
|
||||
|
||||
if(empty($sensor['sensor_current']))
|
||||
{
|
||||
$sensor['sensor_current'] = "NaN";
|
||||
} else {
|
||||
if ($sensor['sensor_current'] >= $sensor['sensor_limit']) { $alert = '<img src="images/16/flag_red.png" alt="alert" />'; } else { $alert = ""; }
|
||||
}
|
||||
|
||||
$weekly_sensor = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150";
|
||||
$sensor_popup = "<a href=\"graphs/id=" . $sensor['sensor_id'] . "/type=".$graph_type."/\" onmouseover=\"return overlib('<img src=\'$weekly_sensor\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
" . $sensor['sensor_descr'] . "</a>";
|
||||
|
||||
if ($sensor['sensor_current'] >= $sensor['sensor_limit']) { $alert = '<img src="images/16/flag_red.png" alt="alert" />'; } else { $alert = ""; }
|
||||
|
||||
$sensor_day = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$sensor_week = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$sensor_month = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
|
Reference in New Issue
Block a user