mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 10:28:13 +00:00
make poller more fair. from lenwe.
git-svn-id: http://www.observium.org/svn/observer/trunk@2219 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
parent
f2890e2de0
commit
f2eb8f0f24
16
poller.php
16
poller.php
@ -41,7 +41,15 @@ elseif ($options['h'])
|
||||
|
||||
if (isset($options['i']) && $options['i'] && isset($options['n']))
|
||||
{
|
||||
$where = "AND MOD(device_id,".$options['i'].") = '" . $options['n'] . "'";
|
||||
$where = true; // FIXME
|
||||
$query = 'SELECT `device_id` FROM (SELECT @rownum :=0) r,
|
||||
(
|
||||
SELECT @rownum := @rownum +1 AS rownum, `device_id`
|
||||
FROM `devices`
|
||||
WHERE `disabled` = 0
|
||||
ORDER BY `device_id` ASC
|
||||
) temp
|
||||
WHERE MOD(temp.rownum, '.$options['i'].') = '.$options['n'].';';
|
||||
$doing = $options['n'] ."/".$options['i'];
|
||||
}
|
||||
|
||||
@ -79,7 +87,11 @@ if (isset($options['d']))
|
||||
|
||||
echo("Starting polling run:\n\n");
|
||||
$polled_devices = 0;
|
||||
$device_query = mysql_query("SELECT `device_id` FROM `devices` WHERE `disabled` = 0 $where ORDER BY `device_id` ASC");
|
||||
if(!isset($query))
|
||||
$device_query = mysql_query("SELECT `device_id` FROM `devices` WHERE `disabled` = 0 $where ORDER BY `device_id` ASC");
|
||||
else
|
||||
$device_query = mysql_query($query);
|
||||
print mysql_error();
|
||||
|
||||
while ($device = mysql_fetch_assoc($device_query))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user