Merge pull request #2344 from annando/1602-poller-processlist
Poller: Use the processlist
This commit is contained in:
commit
82ffd0f596
1 changed files with 15 additions and 8 deletions
|
@ -131,22 +131,29 @@ function poller_max_connections_reached() {
|
|||
return false;
|
||||
|
||||
// Fetch the max value from the config. This is needed when the system cannot detect the correct value by itself.
|
||||
// In that case we use the processlist to determine the current number of connections
|
||||
$max = get_config("system", "max_connections");
|
||||
|
||||
if ($max == 0) {
|
||||
$max = intval($r[0]["Value"]);
|
||||
if ($max == 0)
|
||||
return false;
|
||||
|
||||
$r = q("SHOW STATUS WHERE `variable_name` = 'Threads_connected'");
|
||||
if (!$r)
|
||||
return false;
|
||||
|
||||
$connected = intval($r[0]["Value"]);
|
||||
if ($connected == 0)
|
||||
return false;
|
||||
} else {
|
||||
$r = q("SHOW PROCESSLIST");
|
||||
if (!$r)
|
||||
return false;
|
||||
|
||||
$connected = count($r);
|
||||
}
|
||||
|
||||
$r = q("SHOW STATUS WHERE `variable_name` = 'Threads_connected'");
|
||||
if (!$r)
|
||||
return false;
|
||||
|
||||
$connected = intval($r[0]["Value"]);
|
||||
if ($connected == 0)
|
||||
return false;
|
||||
|
||||
$level = $connected / $max;
|
||||
|
||||
logger("Connection usage: ".$connected."/".$max, LOGGER_DEBUG);
|
||||
|
|
Loading…
Reference in a new issue