push more state to memcached fix sensors poller to not retry all temperature sensors where return >9000 5 times (lmsensors returns milliC, so 30000 for 30C)

git-svn-id: http://www.observium.org/svn/observer/trunk@3244 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2012-05-25 18:35:17 +00:00
parent 08bb2d16ec
commit 1d4b392876
9 changed files with 82 additions and 33 deletions

View File

@@ -13,6 +13,14 @@ foreach (dbFetchRows("SELECT * FROM `mempools` WHERE device_id = ?", array($devi
{
if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
if ($config['memcached']['enable'])
{
$state = $memcache->get('mempool-'.$mempool['mempool_id'].'-state');
if($debug) { print_r($state); }
if(is_array($state)) { $mempool = array_merge($mempool, $state); }
unset($state);
}
$text_descr = rewrite_entity_descr($mempool['mempool_descr']);
$mempool_url = "device/".$device['device_id']."/health/mempool/";

View File

@@ -14,6 +14,15 @@ if (count($mempools))
foreach ($mempools as $mempool)
{
if ($config['memcached']['enable'])
{
$state = $memcache->get('mempool-'.$mempool['mempool_id'].'-state');
if($debug) { print_r($state); }
if(is_array($state)) { $mempool = array_merge($mempool, $state); }
unset($state);
}
$percent= round($mempool['mempool_perc'],0);
$text_descr = rewrite_entity_descr($mempool['mempool_descr']);
$total = formatStorage($mempool['mempool_total']);

View File

@@ -6,12 +6,10 @@ $port = dbFetchRow("SELECT * FROM `ports` WHERE `port_id` = ?", array($vars['por
if ($config['memcached']['enable'])
{
$oids = array('ifInOctets', 'ifOutOctets', 'ifInUcastPkts', 'ifOutUcastPkts', 'ifInErrors', 'ifOutErrors');
foreach ($oids as $oid)
{
$port[$oid.'_rate'] = $memcache->get('port-'.$port['port_id'].'-'.$oid.'_rate');
if ($debug) { echo("MC[".$oid."->".$port[$oid.'_rate']."]"); }
}
$state = $memcache->get('port-'.$port['port_id'].'-state');
if($debug) { print_r($state); }
if(is_array($state)) { $port = array_merge($port, $state); }
unset($state);
}
$port_details = 1;

View File

@@ -108,12 +108,10 @@ if ($vars['view'] == 'minigraphs')
{
if ($config['memcached']['enable'])
{
$oids = array('ifInOctets', 'ifOutOctets', 'ifInUcastPkts', 'ifOutUcastPkts', 'ifInErrors', 'ifOutErrors');
foreach ($oids as $oid)
{
$port[$oid.'_rate'] = $memcache->get('port-'.$port['port_id'].'-'.$oid.'_rate');
if ($debug) { echo("MC[".$oid."->".$port[$oid.'_rate']."]"); }
}
$state = $memcache->get('port-'.$port['port_id'].'-state');
if($debug) { print_r($state); }
if(is_array($state)) { $port = array_merge($port, $state); }
unset($state);
}
include("includes/print-interface.inc.php");

View File

@@ -19,6 +19,15 @@ foreach (dbFetchRows("SELECT * FROM `mempools` AS M, `devices` as D WHERE D.devi
{
$text_descr = $mempool['mempool_descr'];
if ($config['memcached']['enable'])
{
$state = $memcache->get('mempool-'.$mempool['mempool_id'].'-state');
if($debug) { print_r($state); }
if(is_array($state)) { $port = array_merge($mempool, $state); }
unset($state);
}
$mempool_url = "device/device=".$mempool['device_id']."/tab=health/metric=mempool/";
$mini_url = "graph.php?id=".$mempool['mempool_id']."&type=".$graph_type."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=80&height=20&bg=f4f4f4";

View File

@@ -308,15 +308,15 @@ $ports = dbFetchRows($query, $param);
// FIXME - only populate what we need to search at this point, because we shouldn't show *all* ports, as it's silly.
foreach ($ports as $p)
foreach ($ports as $port)
{
if ($config['memcached']['enable'])
{
$oids = array('ifInOctets', 'ifOutOctets', 'ifInUcastPkts', 'ifOutUcastPkts', 'ifInErrors', 'ifOutErrors');
foreach ($oids as $oid)
if ($config['memcached']['enable'])
{
$ports[$port['port_id']][$oid.'_rate'] = $memcache->get('port-'.$port['port_id'].'-'.$oid.'_rate');
if ($debug) { echo("MC[".$oid."->".$port[$oid.'_rate']."]"); }
$state = $memcache->get('port-'.$port['port_id'].'-state');
if(is_array($state)) { $ports[$port['port_id']] = array_merge($port, $state); }
unset($state);
}
}
}