Commit 3adbaf3a authored by Franco Fichtner's avatar Franco Fichtner

gateways: only force apinger status if running

(cherry picked from commit 89d73f69)
parent 977e6e1a
......@@ -393,16 +393,16 @@ function return_gateways_status($byname = false)
{
global $config;
$apingerstatus = array();
$status = array();
/* Always get the latest status from apinger */
if (isvalidpid('/var/run/apinger.pid')) {
/* always get the latest status from apinger */
killbypid('/var/run/apinger.pid', 'USR1');
/* we may read the wrong file here as it's async: */
if (file_exists('/var/run/apinger.status')) {
$apingerstatus = file('/var/run/apinger.status');
}
$status = array();
foreach ($apingerstatus as $line) {
$info = explode('|', $line);
if ($byname == false) {
......@@ -419,6 +419,8 @@ function return_gateways_status($byname = false)
$status[$target]['loss'] = sprintf('%0.1f %%', empty($info[7]) ? 0.0 : round($info[7], 1));
$status[$target]['status'] = trim($info[8]);
}
}
}
/* tack on any gateways that have monitoring disabled
* or are down, which could cause gateway groups to fail */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment