mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 00:07:26 +00:00
system: remove apinger, dpinger takes over
This commit is contained in:
parent
06c413fa85
commit
cae5ec3f69
1
Makefile
1
Makefile
@ -73,7 +73,6 @@ CORE_DEPENDS_amd64?= beep bsdinstaller
|
||||
CORE_DEPENDS_i386?= ${CORE_DEPENDS_amd64}
|
||||
|
||||
CORE_DEPENDS?= ${CORE_DEPENDS_${CORE_ARCH}} \
|
||||
apinger \
|
||||
ca_root_nss \
|
||||
choparp \
|
||||
cpustats \
|
||||
|
||||
@ -30,34 +30,18 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
function return_apinger_defaults()
|
||||
{
|
||||
return array(
|
||||
'avg_delay_samples' => '10',
|
||||
'avg_loss_delay_samples' => '20',
|
||||
'avg_loss_samples' => '50',
|
||||
'down' => '10',
|
||||
'interval' => '1',
|
||||
'latencyhigh' => '500',
|
||||
'latencylow' => '200',
|
||||
'losshigh' => '20',
|
||||
'losslow' => '10',
|
||||
);
|
||||
}
|
||||
|
||||
function return_dpinger_defaults()
|
||||
{
|
||||
return array(
|
||||
'alert_interval' => '1',
|
||||
'data_payload' => '0',
|
||||
'down' => '10', /* unused, only for validation */
|
||||
'alert_interval' => '1', /* XXX not implemented in GUI */
|
||||
'data_payload' => '0', /* XXX not implemented in GUI */
|
||||
'interval' => '1',
|
||||
'latencyhigh' => '500',
|
||||
'latencylow' => '200',
|
||||
'loss_interval' => '2',
|
||||
'loss_interval' => '2', /* XXX not implemented in GUI */
|
||||
'losshigh' => '20',
|
||||
'losslow' => '10',
|
||||
'time_period' => '60',
|
||||
'time_period' => '60', /* XXX not implemented in GUI */
|
||||
);
|
||||
}
|
||||
|
||||
@ -70,9 +54,6 @@ function setup_gateways_monitor($verbose = false, $gwname = null)
|
||||
flush();
|
||||
}
|
||||
|
||||
killbypid('/var/run/apinger.pid', 'TERM', true);
|
||||
@unlink('/var/run/apinger.status');
|
||||
|
||||
$running_processes = running_dpinger_processes();
|
||||
foreach ($running_processes as $running_gwname => $process) {
|
||||
if (!empty($gwname) && $running_gwname != $gwname) {
|
||||
@ -90,92 +71,8 @@ function setup_gateways_monitor($verbose = false, $gwname = null)
|
||||
$monitor_ips = array();
|
||||
|
||||
$dpinger_default = return_dpinger_defaults();
|
||||
$apinger_default = return_apinger_defaults();
|
||||
$apingerconfig = <<<EOD
|
||||
|
||||
# OPNsense apinger configuration file. Automatically Generated!
|
||||
|
||||
## User and group the pinger should run as
|
||||
user "root"
|
||||
group "wheel"
|
||||
|
||||
## Mailer to use (default: "/usr/lib/sendmail -t")
|
||||
#mailer "/var/qmail/bin/qmail-inject"
|
||||
|
||||
## Location of the pid-file (default: "/var/run/apinger.pid")
|
||||
pid_file "/var/run/apinger.pid"
|
||||
|
||||
## Format of timestamp (%s macro) (default: "%b %d %H:%M:%S")
|
||||
#timestamp_format "%Y%m%d%H%M%S"
|
||||
|
||||
status {
|
||||
## File where the status information should be written to
|
||||
file "/var/run/apinger.status"
|
||||
## Interval between file updates
|
||||
## when 0 or not set, file is written only when SIGUSR1 is received
|
||||
interval 5s
|
||||
}
|
||||
|
||||
########################################
|
||||
# RRDTool status gathering configuration
|
||||
# Interval between RRD updates
|
||||
rrd interval 60s;
|
||||
|
||||
## These parameters can be overridden in a specific alarm configuration
|
||||
alarm default {
|
||||
command on "/usr/local/etc/rc.monitor %T"
|
||||
command off "/usr/local/etc/rc.monitor %T"
|
||||
combine 10s
|
||||
}
|
||||
|
||||
## "Down" alarm definition.
|
||||
## This alarm will be fired when target doesn't respond for 30 seconds.
|
||||
alarm down "down" {
|
||||
time {$apinger_default['down']}s
|
||||
}
|
||||
|
||||
## "Delay" alarm definition.
|
||||
## This alarm will be fired when responses are delayed more than 200ms
|
||||
## it will be canceled, when the delay drops below 100ms
|
||||
alarm delay "delay" {
|
||||
delay_low {$apinger_default['latencylow']}ms
|
||||
delay_high {$apinger_default['latencyhigh']}ms
|
||||
}
|
||||
|
||||
## "Loss" alarm definition.
|
||||
## This alarm will be fired when packet loss goes over 20%
|
||||
## it will be canceled, when the loss drops below 10%
|
||||
alarm loss "loss" {
|
||||
percent_low {$apinger_default['losslow']}
|
||||
percent_high {$apinger_default['losshigh']}
|
||||
}
|
||||
|
||||
target default {
|
||||
## How often the probe should be sent
|
||||
interval {$apinger_default['interval']}s
|
||||
|
||||
## How many replies should be used to compute average delay
|
||||
## for controlling "delay" alarms
|
||||
avg_delay_samples {$apinger_default['avg_delay_samples']}
|
||||
|
||||
## How many probes should be used to compute average loss
|
||||
avg_loss_samples {$apinger_default['avg_loss_samples']}
|
||||
|
||||
## The delay (in samples) after which loss is computed
|
||||
## without this delays larger than interval would be treated as loss
|
||||
avg_loss_delay_samples {$apinger_default['avg_loss_delay_samples']}
|
||||
|
||||
## Names of the alarms that may be generated for the target
|
||||
alarms "down","delay","loss"
|
||||
|
||||
## Location of the RRD
|
||||
#rrd file "/var/db/rrd/apinger-%t.rrd"
|
||||
}
|
||||
|
||||
EOD;
|
||||
|
||||
foreach ($gateways_arr_all as $name => $gateway) {
|
||||
if (isset($config['system']['prefer_dpinger']) && !empty($gwname) && $gwname != $name) {
|
||||
if (!empty($gwname) && $gwname != $name) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -194,12 +91,13 @@ EOD;
|
||||
}
|
||||
|
||||
/*
|
||||
* Interface IP is needed since apinger will bind a socket to it.
|
||||
* Interface IP is needed since dpinger will bind a socket to it.
|
||||
* However the config GUI should already have checked this and when
|
||||
* PPoE is used the IP address is set to "dynamic". So using is_ipaddrv4
|
||||
* or is_ipaddrv6 to identify packet type would be wrong, especially as
|
||||
* further checks (that can cope with the "dynamic" case) are present inside
|
||||
* the if block. So using $gateway['ipprotocol'] is the better option.
|
||||
* PPPoE is used the IP address is set to "dynamic". So using
|
||||
* is_ipaddrv4 * or is_ipaddrv6 to identify packet type would be
|
||||
* wrong, especially as further checks (that can cope with the
|
||||
* "dynamic" case) are present inside the if block. So using
|
||||
* $gateway['ipprotocol'] is the better option.
|
||||
*/
|
||||
if ($gateway['ipprotocol'] == "inet") { // This is an IPv4 gateway...
|
||||
$gwifip = find_interface_ip($gateway['interface']);
|
||||
@ -283,136 +181,11 @@ EOD;
|
||||
|
||||
$monitor_ips[] = $gateway['monitor'];
|
||||
|
||||
$apingercfg = "target \"{$gateway['monitor']}\" {\n";
|
||||
$apingercfg .= " description \"{$name}\"\n";
|
||||
$apingercfg .= " srcip \"{$gwifip}\"\n";
|
||||
|
||||
## How often the probe should be sent
|
||||
if (!empty($gateway['interval']) && is_numeric($gateway['interval'])) {
|
||||
$interval = intval($gateway['interval']); # Restrict to Integer
|
||||
if ($interval < 1) {
|
||||
$interval = 1; # Minimum
|
||||
}
|
||||
if ($interval != $apinger_default['interval']) {
|
||||
$apingercfg .= " interval " . $interval . "s\n"; # If not default value
|
||||
}
|
||||
}
|
||||
|
||||
## How many replies should be used to compute average delay
|
||||
## for controlling "delay" alarms
|
||||
if (!empty($gateway['avg_delay_samples']) && is_numeric($gateway['avg_delay_samples'])) {
|
||||
$avg_delay_samples = intval($gateway['avg_delay_samples']); # Restrict to Integer
|
||||
if ($avg_delay_samples < 1) {
|
||||
$avg_delay_samples = 1; # Minimum
|
||||
}
|
||||
if ($avg_delay_samples != $apinger_default['avg_delay_samples']) {
|
||||
# If not default value
|
||||
$apingercfg .= " avg_delay_samples " . $avg_delay_samples . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
## How many probes should be used to compute average loss
|
||||
if (!empty($gateway['avg_loss_samples']) && is_numeric($gateway['avg_loss_samples'])) {
|
||||
$avg_loss_samples = intval($gateway['avg_loss_samples']); # Restrict to Integer
|
||||
if ($avg_loss_samples < 1) {
|
||||
$avg_loss_samples = 1; # Minimum
|
||||
}
|
||||
if ($avg_loss_samples != $apinger_default['avg_loss_samples']) {
|
||||
# If not default value
|
||||
$apingercfg .= " avg_loss_samples " . $avg_loss_samples . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
## The delay (in samples) after which loss is computed
|
||||
## without this delays larger than interval would be treated as loss
|
||||
if (!empty($gateway['avg_loss_delay_samples']) && is_numeric($gateway['avg_loss_delay_samples'])) {
|
||||
$avg_loss_delay_samples = intval($gateway['avg_loss_delay_samples']); # Restrict to Integer
|
||||
if ($avg_loss_delay_samples < 1) {
|
||||
$avg_loss_delay_samples = 1; # Minimum
|
||||
}
|
||||
if ($avg_loss_delay_samples != $apinger_default['avg_loss_delay_samples']) {
|
||||
# If not default value
|
||||
$apingercfg .= " avg_loss_delay_samples " . $avg_loss_delay_samples . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
$alarms = "";
|
||||
$alarmscfg = "";
|
||||
$override = false;
|
||||
if (!empty($gateway['losslow'])) {
|
||||
$alarmscfg .= "alarm loss \"{$name}loss\" {\n";
|
||||
$alarmscfg .= "\tpercent_low {$gateway['losslow']}\n";
|
||||
$alarmscfg .= "\tpercent_high {$gateway['losshigh']}\n";
|
||||
$alarmscfg .= "}\n";
|
||||
$alarms .= "\"{$name}loss\"";
|
||||
$override = true;
|
||||
} else {
|
||||
if ($override == true) {
|
||||
$alarms .= ",";
|
||||
}
|
||||
$alarms .= "\"loss\"";
|
||||
$override = true;
|
||||
}
|
||||
if (!empty($gateway['latencylow'])) {
|
||||
$alarmscfg .= "alarm delay \"{$name}delay\" {\n";
|
||||
$alarmscfg .= "\tdelay_low {$gateway['latencylow']}ms\n";
|
||||
$alarmscfg .= "\tdelay_high {$gateway['latencyhigh']}ms\n";
|
||||
$alarmscfg .= "}\n";
|
||||
if ($override == true) {
|
||||
$alarms .= ",";
|
||||
}
|
||||
$alarms .= "\"{$name}delay\"";
|
||||
$override = true;
|
||||
} else {
|
||||
if ($override == true) {
|
||||
$alarms .= ",";
|
||||
}
|
||||
$alarms .= "\"delay\"";
|
||||
$override = true;
|
||||
}
|
||||
if (!empty($gateway['down'])) {
|
||||
$alarmscfg .= "alarm down \"{$name}down\" {\n";
|
||||
$alarmscfg .= "\ttime {$gateway['down']}s\n";
|
||||
$alarmscfg .= "}\n";
|
||||
if ($override == true) {
|
||||
$alarms .= ",";
|
||||
}
|
||||
$alarms .= "\"{$name}down\"";
|
||||
$override = true;
|
||||
} else {
|
||||
if ($override == true) {
|
||||
$alarms .= ",";
|
||||
}
|
||||
$alarms .= "\"down\"";
|
||||
$override = true;
|
||||
}
|
||||
if ($override == true) {
|
||||
$apingercfg .= "\talarms override {$alarms};\n";
|
||||
}
|
||||
|
||||
if (isset($gateway['force_down'])) {
|
||||
$apingercfg .= "\tforce_down on\n";
|
||||
}
|
||||
|
||||
$apingercfg .= " rrd file \"/var/db/rrd/{$gateway['name']}-quality.rrd\"\n";
|
||||
$apingercfg .= "}\n";
|
||||
$apingercfg .= "\n";
|
||||
|
||||
$apingerconfig .= $alarmscfg;
|
||||
$apingerconfig .= $apingercfg;
|
||||
|
||||
/*
|
||||
* Create custom RRD graph with suitable settings that
|
||||
* may differ from the daemon's standards.
|
||||
*/
|
||||
rrd_create_gateway_quality(
|
||||
"/var/db/rrd/{$gateway['name']}-quality.rrd",
|
||||
isset($config['system']['prefer_dpinger'])
|
||||
);
|
||||
|
||||
if (!isset($config['system']['prefer_dpinger'])) {
|
||||
continue;
|
||||
}
|
||||
rrd_create_gateway_quality("/var/db/rrd/{$gateway['name']}-quality.rrd");
|
||||
|
||||
/* log warnings via syslog */
|
||||
$params = '-S ';
|
||||
@ -483,80 +256,39 @@ EOD;
|
||||
mwexec_bg("/usr/local/bin/dpinger -f {$params}");
|
||||
}
|
||||
|
||||
if (!isset($config['system']['prefer_dpinger'])) {
|
||||
$gateways_arr = return_gateways_array();
|
||||
if (!is_array($gateways_arr)) {
|
||||
log_error("No gateways to monitor. Apinger will not be run.");
|
||||
} else {
|
||||
file_put_contents('/var/etc/apinger.conf', $apingerconfig);
|
||||
mwexec_bg('/usr/local/sbin/apinger -c /var/etc/apinger.conf');
|
||||
}
|
||||
}
|
||||
|
||||
if ($verbose) {
|
||||
echo "done.\n";
|
||||
}
|
||||
}
|
||||
|
||||
/* return the status of the apinger targets as a array */
|
||||
function return_gateways_status($byname = false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$status = array();
|
||||
|
||||
if (isvalidpid('/var/run/apinger.pid')) {
|
||||
/* always get the latest status from apinger */
|
||||
killbypid('/var/run/apinger.pid', 'USR1');
|
||||
$dpinger_gws = running_dpinger_processes();
|
||||
$status = array();
|
||||
|
||||
/* we may read the wrong file here as it's async: */
|
||||
if (file_exists('/var/run/apinger.status')) {
|
||||
$apingerstatus = file('/var/run/apinger.status');
|
||||
|
||||
foreach ($apingerstatus as $line) {
|
||||
$info = explode('|', $line);
|
||||
if ($byname == false) {
|
||||
$target = $info[0];
|
||||
} else {
|
||||
$target = $info[2];
|
||||
}
|
||||
|
||||
$status[$target] = array();
|
||||
$status[$target]['monitorip'] = $info[0];
|
||||
$status[$target]['srcip'] = $info[1];
|
||||
$status[$target]['name'] = $info[2];
|
||||
$status[$target]['delay'] = sprintf('%0.1f ms', empty($info[6]) ? 0.0 : round($info[6], 1));
|
||||
$status[$target]['stddev'] = gettext('N/A');
|
||||
$status[$target]['loss'] = sprintf('%0.1f %%', empty($info[7]) ? 0.0 : round($info[7], 1));
|
||||
$status[$target]['status'] = trim($info[8]);
|
||||
}
|
||||
$gateways_arr = return_gateways_array();
|
||||
foreach ($dpinger_gws as $gwname => $gwdata) {
|
||||
$dpinger_status = get_dpinger_status($gwname);
|
||||
if ($dpinger_status === false) {
|
||||
continue;
|
||||
}
|
||||
} elseif (isset($config['system']['prefer_dpinger'])) {
|
||||
$dpinger_gws = running_dpinger_processes();
|
||||
$status = array();
|
||||
|
||||
$gateways_arr = return_gateways_array();
|
||||
foreach ($dpinger_gws as $gwname => $gwdata) {
|
||||
$dpinger_status = get_dpinger_status($gwname);
|
||||
if ($dpinger_status === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($byname == false) {
|
||||
$target = $dpinger_status['monitorip'];
|
||||
} else {
|
||||
$target = $gwname;
|
||||
}
|
||||
|
||||
$status[$target] = array();
|
||||
$status[$target]['monitorip'] = $dpinger_status['monitorip'];
|
||||
$status[$target]['srcip'] = $dpinger_status['srcip'];
|
||||
$status[$target]['name'] = $gwname;
|
||||
$status[$target]['delay'] = sprintf('%0.1f ms', empty($dpinger_status['latency_avg']) ? 0.0 : round($dpinger_status['latency_avg'], 1));
|
||||
$status[$target]['stddev'] = sprintf('%0.1f ms', empty($dpinger_status['latency_stddev']) ? 0.0 : round($dpinger_status['latency_stddev'], 1));
|
||||
$status[$target]['loss'] = sprintf('%0.1f %%', empty($dpinger_status['loss']) ? 0.0 : round($dpinger_status['loss'], 1));
|
||||
$status[$target]['status'] = $dpinger_status['status'];
|
||||
if ($byname == false) {
|
||||
$target = $dpinger_status['monitorip'];
|
||||
} else {
|
||||
$target = $gwname;
|
||||
}
|
||||
|
||||
$status[$target] = array();
|
||||
$status[$target]['monitorip'] = $dpinger_status['monitorip'];
|
||||
$status[$target]['srcip'] = $dpinger_status['srcip'];
|
||||
$status[$target]['name'] = $gwname;
|
||||
$status[$target]['delay'] = sprintf('%0.1f ms', empty($dpinger_status['latency_avg']) ? 0.0 : round($dpinger_status['latency_avg'], 1));
|
||||
$status[$target]['stddev'] = sprintf('%0.1f ms', empty($dpinger_status['latency_stddev']) ? 0.0 : round($dpinger_status['latency_stddev'], 1));
|
||||
$status[$target]['loss'] = sprintf('%0.1f %%', empty($dpinger_status['loss']) ? 0.0 : round($dpinger_status['loss'], 1));
|
||||
$status[$target]['status'] = $dpinger_status['status'];
|
||||
}
|
||||
|
||||
/* tack on any gateways that have monitoring disabled
|
||||
|
||||
@ -1,30 +1,30 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2018 Deciso B.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
* Copyright (C) 2018 Deciso B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
function core_services()
|
||||
{
|
||||
@ -82,16 +82,6 @@ function core_services()
|
||||
$services[] = $pconfig;
|
||||
}
|
||||
|
||||
if (is_apinger_enabled()) {
|
||||
$pconfig = array();
|
||||
$pconfig['name'] = "apinger";
|
||||
$pconfig['description'] = gettext("Gateway Monitoring Daemon");
|
||||
$pconfig['php']['restart'] = array('setup_gateways_monitor');
|
||||
$pconfig['php']['start'] = array('setup_gateways_monitor');
|
||||
$pconfig['pidfile'] = '/var/run/apinger.pid';
|
||||
$services[] = $pconfig;
|
||||
}
|
||||
|
||||
if (is_dpinger_enabled()) {
|
||||
$gateways_arr_all = return_gateways_array(true);
|
||||
|
||||
|
||||
@ -1,30 +1,30 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
* Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
function rrd_create($rrdcreatecmd)
|
||||
{
|
||||
@ -525,9 +525,8 @@ function rrd_configure($verbose = false)
|
||||
$rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$cputemp N:\${CPUTEMP}\n";
|
||||
/* end CPU Temp gathering */
|
||||
|
||||
if (isset($config['system']['prefer_dpinger'])) {
|
||||
/* Start gateway quality */
|
||||
$rrdupdatesh .= <<<EOD
|
||||
/* Start gateway quality */
|
||||
$rrdupdatesh .= <<<EOD
|
||||
|
||||
# Gateway quality graphs
|
||||
for sock in /var/run/dpinger_*.sock;do
|
||||
@ -565,7 +564,6 @@ function rrd_configure($verbose = false)
|
||||
done
|
||||
|
||||
EOD;
|
||||
}
|
||||
|
||||
$rrdupdatesh .= "sleep 60\n";
|
||||
$rrdupdatesh .= "done\n";
|
||||
@ -598,7 +596,7 @@ EOD;
|
||||
}
|
||||
}
|
||||
|
||||
function rrd_create_gateway_quality($rrd_file, $prefer_dpinger = false)
|
||||
function rrd_create_gateway_quality($rrd_file)
|
||||
{
|
||||
$unknown = file_exists('/var/run/booting');
|
||||
$rrdtool = '/usr/local/bin/rrdtool';
|
||||
@ -611,9 +609,7 @@ function rrd_create_gateway_quality($rrd_file, $prefer_dpinger = false)
|
||||
$rrdcreate = "$rrdtool create $rrd_file --step $rrdinterval ";
|
||||
$rrdcreate .= "DS:loss:GAUGE:$valid:0:100 ";
|
||||
$rrdcreate .= "DS:delay:GAUGE:$valid:0:100000 ";
|
||||
if ($prefer_dpinger) {
|
||||
$rrdcreate .= "DS:stddev:GAUGE:$valid:0:100000 ";
|
||||
}
|
||||
$rrdcreate .= "DS:stddev:GAUGE:$valid:0:100000 ";
|
||||
$rrdcreate .= "RRA:AVERAGE:0.5:1:1200 ";
|
||||
$rrdcreate .= "RRA:AVERAGE:0.5:5:720 ";
|
||||
$rrdcreate .= "RRA:AVERAGE:0.5:60:1860 ";
|
||||
@ -625,7 +621,7 @@ function rrd_create_gateway_quality($rrd_file, $prefer_dpinger = false)
|
||||
|
||||
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
|
||||
if ($unknown) {
|
||||
mwexec("$rrdtool update $rrd_file N:U:U" . ($prefer_dpinger ? ':U' : ''));
|
||||
mwexec("$rrdtool update $rrd_file N:U:U:U");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1756,39 +1756,10 @@ function get_dyndns_ip($int, $ipver = 4)
|
||||
return $ip_address;
|
||||
}
|
||||
|
||||
function is_apinger_enabled()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset($config['system']['prefer_dpinger'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$gwcount = 0;
|
||||
|
||||
if (isset($config['gateways']['gateway_item'])) {
|
||||
foreach ($config['gateways']['gateway_item'] as $gwkey => $gateway) {
|
||||
if (!isset($gateway['monitor_disable']) || $gateway['monitor_disable'] == '0') {
|
||||
$gwcount += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($gwcount == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return is_array(return_gateways_array());
|
||||
}
|
||||
|
||||
function is_dpinger_enabled()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (!isset($config['system']['prefer_dpinger'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$gwcount = 0;
|
||||
|
||||
if (isset($config['gateways']['gateway_item'])) {
|
||||
|
||||
@ -688,7 +688,7 @@ function system_syslogd_start($verbose = false, $restart = false)
|
||||
$syslogconfs['configd'] = array('facility' => array('configd.py'));
|
||||
$syslogconfs['dhcpd'] = array('facility' => array('dhcpd', 'dhcrelay', 'dhclient', 'dhcp6c'), 'local' => '/var/dhcpd/var/run/log', 'remote' => 'dhcp');
|
||||
$syslogconfs['filter'] = array('facility' => array('filterlog'), 'remote' => 'filter');
|
||||
$syslogconfs['gateways'] = array('facility' => array('apinger', 'dpinger'), 'remote' => 'apinger');
|
||||
$syslogconfs['gateways'] = array('facility' => array('dpinger'), 'remote' => 'apinger');
|
||||
$syslogconfs['lighttpd'] = array('facility' => array('lighttpd'));
|
||||
$syslogconfs['pkg'] = array('facility' => array('pkg', 'pkg-static'));
|
||||
$syslogconfs['portalauth'] = array('facility' => array('captiveportal'), 'remote' => 'portalauth');
|
||||
|
||||
@ -32,9 +32,7 @@ if [ -z "${GATEWAY}" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ${#} -gt 1 ]; then
|
||||
/usr/bin/logger -t dpinger "GATEWAY ALARM: ${GATEWAY} (Addr: ${2} Alarm: ${3} RTT: ${4}ms RTTd: ${5}ms Loss: ${6}%)"
|
||||
fi
|
||||
/usr/bin/logger -t dpinger "GATEWAY ALARM: ${GATEWAY} (Addr: ${2} Alarm: ${3} RTT: ${4}ms RTTd: ${5}ms Loss: ${6}%)"
|
||||
|
||||
/usr/local/opnsense/service/configd_ctl.py -m \
|
||||
"filter reload" \
|
||||
|
||||
@ -100,7 +100,8 @@ add_new_address() {
|
||||
$LOGGER "New Broadcast Address ($interface): $new_broadcast_address"
|
||||
$LOGGER "New Routers ($interface): $new_routers"
|
||||
|
||||
# This is necessary otherwise apinger will try to ping all 1s address
|
||||
# This is necessary otherwise dpinger will try to ping all 1s address
|
||||
# XXX still true?!
|
||||
if [ -n "$new_routers" ] && [ "$new_routers" != "255.255.255.255" ]; then
|
||||
echo $new_routers > /tmp/${interface}_router
|
||||
fi
|
||||
|
||||
@ -3,6 +3,6 @@
|
||||
$logfile = '/var/log/gateways.log';
|
||||
$logclog = true;
|
||||
|
||||
$service_hook = 'apinger';
|
||||
$service_hook = 'dpinger';
|
||||
|
||||
require_once 'diag_logs_template.inc';
|
||||
|
||||
@ -1,33 +1,33 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2014-2015 Deciso B.V.
|
||||
Copyright (C) 2005-2007 Scott Ullrich <sullrich@gmail.com>
|
||||
Copyright (C) 2008 Shrew Soft Inc. <mgrooms@shrew.net>
|
||||
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
* Copyright (C) 2014-2015 Deciso B.V.
|
||||
* Copyright (C) 2005-2007 Scott Ullrich <sullrich@gmail.com>
|
||||
* Copyright (C) 2008 Shrew Soft Inc. <mgrooms@shrew.net>
|
||||
* Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require_once("guiconfig.inc");
|
||||
require_once("filter.inc");
|
||||
@ -64,7 +64,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$pconfig['enablebinatreflection'] = !empty($config['system']['enablebinatreflection']);
|
||||
$pconfig['enablenatreflectionhelper'] = isset($config['system']['enablenatreflectionhelper']) ? $config['system']['enablenatreflectionhelper'] : null;
|
||||
$pconfig['bypassstaticroutes'] = isset($config['filter']['bypassstaticroutes']);
|
||||
$pconfig['prefer_dpinger'] = isset($config['system']['prefer_dpinger']);
|
||||
$pconfig['ip_change_kill_states'] = isset($config['system']['ip_change_kill_states']);
|
||||
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$pconfig = $_POST;
|
||||
@ -224,14 +223,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
unset($config['system']['gw_switch_default']);
|
||||
}
|
||||
|
||||
$old_pinger = isset($config['system']['prefer_dpinger']);
|
||||
|
||||
if (!empty($pconfig['prefer_dpinger'])) {
|
||||
$config['system']['prefer_dpinger'] = true;
|
||||
} elseif (isset($config['system']['prefer_dpinger'])) {
|
||||
unset($config['system']['prefer_dpinger']);
|
||||
}
|
||||
|
||||
if (!empty($pconfig['ip_change_kill_states'])) {
|
||||
$config['system']['ip_change_kill_states'] = true;
|
||||
} elseif (isset($config['system']['ip_change_kill_states'])) {
|
||||
@ -244,12 +235,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
|
||||
system_cron_configure();
|
||||
filter_configure();
|
||||
|
||||
if ($old_pinger != isset($config['system']['prefer_dpinger'])) {
|
||||
mwexec('rm /var/db/rrd/*-quality.rrd');
|
||||
setup_gateways_monitor();
|
||||
rrd_configure();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -400,18 +385,6 @@ include("head.inc");
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a id="help_for_prefer_dpinger" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext('Monitoring daemon') ?></td>
|
||||
<td>
|
||||
<input name="prefer_dpinger" type="checkbox" id="prefer_dpinger" value="yes" <?= !empty($pconfig['prefer_dpinger']) ? 'checked="checked"' : '' ?> />
|
||||
<?= gettext('Prefer Dpinger over Apinger') ?>
|
||||
<div class="hidden" data-for="help_for_prefer_dpinger">
|
||||
<?=gettext("By default, the system will use Apinger for gateway monitoring. ".
|
||||
"Switching from one to the other will result in the loss of " .
|
||||
"any existing quality RRD data."); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="content-box tab-content table-responsive __mb">
|
||||
|
||||
@ -76,7 +76,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
legacy_html_escape_form_data($a_gateway_groups);
|
||||
legacy_html_escape_form_data($a_gateways);
|
||||
|
||||
$service_hook = 'apinger';
|
||||
$service_hook = 'dpinger';
|
||||
|
||||
include("head.inc");
|
||||
|
||||
|
||||
@ -140,7 +140,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
legacy_html_escape_form_data($a_gateways);
|
||||
legacy_html_escape_form_data($pconfig);
|
||||
|
||||
$service_hook = 'apinger';
|
||||
$service_hook = 'dpinger';
|
||||
|
||||
include("head.inc");
|
||||
|
||||
|
||||
@ -196,7 +196,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
legacy_html_escape_form_data($a_gateways);
|
||||
|
||||
$service_hook = 'apinger';
|
||||
$service_hook = 'dpinger';
|
||||
|
||||
include("head.inc");
|
||||
|
||||
@ -297,9 +297,7 @@ $( document ).ready(function() {
|
||||
<th class="hidden-xs hidden-sm hidden-md"><?=gettext("Gateway"); ?></th>
|
||||
<th class="hidden-xs hidden-sm hidden-md"><?=gettext("Monitor IP"); ?></th>
|
||||
<th class="text-nowrap hidden-xs"><?= gettext('RTT') ?></th>
|
||||
<?php if (isset($config['system']['prefer_dpinger'])) :?>
|
||||
<th class="text-nowrap hidden-xs"><?= gettext('RTTd') ?></th>
|
||||
<?php endif ?>
|
||||
<th class="text-nowrap hidden-xs"><?= gettext('Loss') ?></th>
|
||||
<th><?=gettext("Status"); ?></th>
|
||||
<th class="hidden-xs hidden-sm hidden-md"><?=gettext("Description"); ?></th>
|
||||
@ -352,11 +350,9 @@ $( document ).ready(function() {
|
||||
<td class="text-nowrap hidden-xs">
|
||||
<?= !empty($gateways_status[$gateway['gname']]) ? $gateways_status[$gateway['gname']]['delay'] : gettext("Pending") ?>
|
||||
</td>
|
||||
<?php if (isset($config['system']['prefer_dpinger'])): ?>
|
||||
<td class="text-nowrap hidden-xs">
|
||||
<?= !empty($gateways_status[$gateway['gname']]) ? $gateways_status[$gateway['gname']]['stddev'] : gettext("Pending") ?>
|
||||
</td>
|
||||
<?php endif ?>
|
||||
<td class="text-nowrap hidden-xs">
|
||||
<?= !empty($gateways_status[$gateway['gname']]) ? $gateways_status[$gateway['gname']]['loss'] : gettext("Pending") ?>
|
||||
</td>
|
||||
@ -425,9 +421,7 @@ $( document ).ready(function() {
|
||||
<td class="hidden-xs hidden-sm hidden-md"></td>
|
||||
<td class="text-nowrap hidden-xs"></td>
|
||||
<td class="text-nowrap hidden-xs"></td>
|
||||
<?php if (isset($config['system']['prefer_dpinger'])) :?>
|
||||
<td class="text-nowrap hidden-xs"></td>
|
||||
<?php endif ?>
|
||||
<td></td>
|
||||
<td class="hidden-xs hidden-sm hidden-md"></td>
|
||||
<td class="text-nowrap">
|
||||
|
||||
@ -1,31 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2014-2015 Deciso B.V.
|
||||
Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
* Copyright (C) 2014-2015 Deciso B.V.
|
||||
* Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require_once("guiconfig.inc");
|
||||
require_once("services.inc");
|
||||
@ -37,11 +37,7 @@ foreach ($a_gateways as $gw) {
|
||||
$a_gateways_arr[] = $gw;
|
||||
}
|
||||
$a_gateways = $a_gateways_arr;
|
||||
$apinger_default = return_apinger_defaults();
|
||||
|
||||
if (isset($config['system']['prefer_dpinger'])) {
|
||||
$apinger_default = return_dpinger_defaults();
|
||||
}
|
||||
$dpinger_default = return_dpinger_defaults();
|
||||
|
||||
// form processing
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
@ -201,7 +197,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
}
|
||||
}
|
||||
|
||||
/* input validation of apinger advanced parameters */
|
||||
if (!empty($pconfig['latencylow'])) {
|
||||
if (!is_numeric($pconfig['latencylow'])) {
|
||||
$input_errors[] = gettext("The low latency threshold needs to be a numeric value.");
|
||||
@ -245,12 +240,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$input_errors[] = gettext("The high latency threshold needs to be higher than the low latency threshold");
|
||||
}
|
||||
} elseif (!empty($pconfig['latencylow'])) {
|
||||
if (is_numeric($pconfig['latencylow']) && $pconfig['latencylow'] > $apinger_default['latencyhigh']) {
|
||||
$input_errors[] = sprintf(gettext('The low latency threshold needs to be less than the default high latency threshold (%d)'), $apinger_default['latencyhigh']);
|
||||
if (is_numeric($pconfig['latencylow']) && $pconfig['latencylow'] > $dpinger_default['latencyhigh']) {
|
||||
$input_errors[] = sprintf(gettext('The low latency threshold needs to be less than the default high latency threshold (%d)'), $dpinger_default['latencyhigh']);
|
||||
}
|
||||
} elseif (!empty($pconfig['latencyhigh'])) {
|
||||
if (is_numeric($pconfig['latencyhigh']) && $pconfig['latencyhigh'] < $apinger_default['latencylow']) {
|
||||
$input_errors[] = sprintf(gettext('The high latency threshold needs to be higher than the default low latency threshold (%d)'), $apinger_default['latencylow']);
|
||||
if (is_numeric($pconfig['latencyhigh']) && $pconfig['latencyhigh'] < $dpinger_default['latencylow']) {
|
||||
$input_errors[] = sprintf(gettext('The high latency threshold needs to be higher than the default low latency threshold (%d)'), $dpinger_default['latencylow']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -259,12 +254,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$input_errors[] = gettext("The high Packet Loss threshold needs to be higher than the low Packet Loss threshold");
|
||||
}
|
||||
} elseif (!empty($pconfig['losslow'])) {
|
||||
if (is_numeric($pconfig['losslow']) && $pconfig['losslow'] > $apinger_default['losshigh']) {
|
||||
$input_errors[] = sprintf(gettext('The low Packet Loss threshold needs to be less than the default high Packet Loss threshold (%d)'), $apinger_default['losshigh']);
|
||||
if (is_numeric($pconfig['losslow']) && $pconfig['losslow'] > $dpinger_default['losshigh']) {
|
||||
$input_errors[] = sprintf(gettext('The low Packet Loss threshold needs to be less than the default high Packet Loss threshold (%d)'), $dpinger_default['losshigh']);
|
||||
}
|
||||
} elseif (!empty($pconfig['losshigh'])) {
|
||||
if (is_numeric($pconfig['losshigh']) && $pconfig['losshigh'] < $apinger_default['losslow']) {
|
||||
$input_errors[] = sprintf(gettext('The high Packet Loss threshold needs to be higher than the default low Packet Loss threshold (%d)'), $apinger_default['losslow']);
|
||||
if (is_numeric($pconfig['losshigh']) && $pconfig['losshigh'] < $dpinger_default['losslow']) {
|
||||
$input_errors[] = sprintf(gettext('The high Packet Loss threshold needs to be higher than the default low Packet Loss threshold (%d)'), $dpinger_default['losslow']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,52 +271,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($pconfig['down'])) {
|
||||
if (! is_numeric($pconfig['down'])) {
|
||||
$input_errors[] = gettext("The down time setting needs to be a numeric value.");
|
||||
} elseif ($pconfig['down'] < 1) {
|
||||
$input_errors[] = gettext("The down time setting needs to be positive.");
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($pconfig['interval']) && !empty($pconfig['down'])) {
|
||||
if ((is_numeric($pconfig['interval'])) && (is_numeric($pconfig['down'])) && $pconfig['interval'] > $pconfig['down']) {
|
||||
$input_errors[] = gettext("The probe interval needs to be less than the down time setting.");
|
||||
}
|
||||
} elseif (!empty($pconfig['interval'])) {
|
||||
if (is_numeric($pconfig['interval']) && $pconfig['interval'] > $apinger_default['down']) {
|
||||
$input_errors[] = sprintf(gettext('The probe interval needs to be less than the default down time setting (%d)'), $apinger_default['down']);
|
||||
}
|
||||
} elseif (!empty($pconfig['down'])) {
|
||||
if (is_numeric($pconfig['down']) && $pconfig['down'] < $apinger_default['interval']) {
|
||||
$input_errors[] = sprintf(gettext('The down time setting needs to be higher than the default probe interval (%d)'), $apinger_default['interval']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($pconfig['avg_delay_samples'])) {
|
||||
if (!is_numeric($pconfig['avg_delay_samples'])) {
|
||||
$input_errors[] = gettext("The average delay replies qty needs to be a numeric value.");
|
||||
} elseif ($pconfig['avg_delay_samples'] < 1) {
|
||||
$input_errors[] = gettext("The average delay replies qty needs to be positive.");
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($pconfig['avg_loss_samples'])) {
|
||||
if (!is_numeric($pconfig['avg_loss_samples'])) {
|
||||
$input_errors[] = gettext("The average packet loss probes qty needs to be a numeric value.");
|
||||
} elseif ($pconfig['avg_loss_samples'] < 1) {
|
||||
$input_errors[] = gettext("The average packet loss probes qty needs to be positive.");
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($pconfig['avg_loss_delay_samples'])) {
|
||||
if (!is_numeric($pconfig['avg_loss_delay_samples'])) {
|
||||
$input_errors[] = gettext("The lost probe delay needs to be a numeric value.");
|
||||
} elseif ($pconfig['avg_loss_delay_samples'] < 1) {
|
||||
$input_errors[] = gettext("The lost probe delay needs to be positive.");
|
||||
}
|
||||
}
|
||||
|
||||
if (count($input_errors) == 0) {
|
||||
// A result of obfuscating the list of gateways is that over here we need to map things back that should
|
||||
// be aligned with the configuration. Not going to fix this now.
|
||||
@ -348,19 +297,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$gateway['ipprotocol'] = $pconfig['ipprotocol'];
|
||||
$gateway['interval'] = $pconfig['interval'];
|
||||
$gateway['descr'] = $pconfig['descr'];
|
||||
$gateway['avg_delay_samples'] = $pconfig['avg_delay_samples'];
|
||||
|
||||
if ($pconfig['avg_delay_samples_calculated'] == "yes" || $pconfig['avg_delay_samples_calculated'] == "on") {
|
||||
$gateway['avg_delay_samples_calculated'] = true;
|
||||
}
|
||||
$gateway['avg_loss_samples'] = $pconfig['avg_loss_samples'];
|
||||
if ($pconfig['avg_loss_samples_calculated'] == "yes" || $pconfig['avg_loss_samples_calculated'] == "on") {
|
||||
$gateway['avg_loss_samples_calculated'] = true;
|
||||
}
|
||||
$gateway['avg_loss_delay_samples'] = $pconfig['avg_loss_delay_samples'];
|
||||
if ($pconfig['avg_loss_delay_samples_calculated'] == "yes" || $pconfig['avg_loss_delay_samples_calculated'] == "on") {
|
||||
$gateway['avg_loss_delay_samples_calculated'] = true;
|
||||
}
|
||||
|
||||
if ($pconfig['monitor_disable'] == "yes") {
|
||||
$gateway['monitor_disable'] = true;
|
||||
@ -397,7 +333,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$gateway['defaultgw'] = true;
|
||||
}
|
||||
|
||||
foreach (array('latencylow', 'latencyhigh', 'losslow', 'losshigh', 'down') as $fieldname) {
|
||||
foreach (array('latencylow', 'latencyhigh', 'losslow', 'losshigh') as $fieldname) {
|
||||
if (!empty($pconfig[$fieldname])) {
|
||||
$gateway[$fieldname] = $pconfig[$fieldname];
|
||||
}
|
||||
@ -462,10 +398,25 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
// load data from config
|
||||
$copy_fields = array(
|
||||
'name', 'weight', 'interval', 'avg_delay_samples', 'avg_loss_samples', 'avg_loss_delay_samples',
|
||||
'interface', 'friendlyiface', 'ipprotocol', 'gateway', 'latencylow', 'latencyhigh', 'losslow', 'losshigh',
|
||||
'down', 'monitor', 'descr', 'avg_delay_samples_calculated', 'avg_loss_samples_calculated', 'fargw',
|
||||
'avg_loss_delay_samples_calculated', 'monitor_disable', 'dynamic', 'defaultgw', 'force_down', 'disabled'
|
||||
'defaultgw',
|
||||
'descr',
|
||||
'disabled',
|
||||
'dynamic',
|
||||
'fargw',
|
||||
'force_down',
|
||||
'friendlyiface',
|
||||
'gateway',
|
||||
'interface',
|
||||
'interval',
|
||||
'ipprotocol',
|
||||
'latencyhigh',
|
||||
'latencylow',
|
||||
'losshigh',
|
||||
'losslow',
|
||||
'monitor',
|
||||
'monitor_disable',
|
||||
'name',
|
||||
'weight',
|
||||
);
|
||||
foreach ($copy_fields as $fieldname) {
|
||||
if (isset($configId) && isset($a_gateways[$configId][$fieldname])) {
|
||||
@ -482,7 +433,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
legacy_html_escape_form_data($a_gateways);
|
||||
legacy_html_escape_form_data($pconfig);
|
||||
|
||||
$service_hook = 'apinger';
|
||||
$service_hook = 'dpinger';
|
||||
|
||||
include("head.inc");
|
||||
|
||||
@ -492,41 +443,6 @@ include("head.inc");
|
||||
<?php include("fbegin.inc"); ?>
|
||||
<script>
|
||||
//<![CDATA[
|
||||
function recalc_value(object, min, max) {
|
||||
if (object.val() != "") {
|
||||
object.val(Math.round(object.val())); // Round to integer
|
||||
if (object.val() < min) object.val(min); // Min Value
|
||||
if (object.val() > max) object.val(max); // Max Value
|
||||
if (isNaN(object.val())) object.val(''); // Empty Value
|
||||
}
|
||||
}
|
||||
|
||||
function calculated_change() {
|
||||
// How many replies should be used to compute average delay
|
||||
// for controlling "delay" alarms.
|
||||
// Calculate a reasonable value based on gateway probe interval and RRD 1 minute average graph step size (60).
|
||||
if ($('#avg_delay_samples_calculated').prop('checked') && ( $('#interval').val() > 0)) {
|
||||
$('#avg_delay_samples').val(60 * (1/6) / Math.pow($('#interval').val(), 0.333)); // Calculate
|
||||
}
|
||||
recalc_value($('#avg_delay_samples'), 1, 100);
|
||||
|
||||
// How many probes should be used to compute average loss.
|
||||
// Calculate a reasonable value based on gateway probe interval and RRD 1 minute average graph step size (60).
|
||||
if ($('#avg_loss_samples_calculated').prop('checked') && ( $('#interval').val() > 0)) {
|
||||
$('#avg_loss_samples').val(60 / $('#interval').val()); // Calculate
|
||||
}
|
||||
recalc_value($('#avg_loss_samples'), 1, 1000);
|
||||
|
||||
// The delay (in samples) after which loss is computed
|
||||
// without this delays larger than interval would be treated as loss.
|
||||
// Calculate a reasonable value based on gateway probe interval and RRD 1 minute average graph step size (60).
|
||||
if ($('#avg_loss_delay_samples_calculated').prop('checked') && ( $('#interval').val() > 0)) {
|
||||
$('#avg_loss_delay_samples').val(60 * (1/3) / $('#interval').val()); // Calculate
|
||||
}
|
||||
recalc_value($('#avg_loss_delay_samples'), 1, 200);
|
||||
}
|
||||
|
||||
|
||||
$( document ).ready(function() {
|
||||
// unhide advanced
|
||||
$("#btn_advanced").click(function(event){
|
||||
@ -536,11 +452,10 @@ $( document ).ready(function() {
|
||||
|
||||
// (un)hide advanced on form load when any advanced setting is provided
|
||||
<?php
|
||||
if ((!empty($pconfig['latencylow']) || !empty($pconfig['latencyhigh']) || !empty($pconfig['losslow']) || !empty($pconfig['losshigh']) || (isset($pconfig['weight']) && $pconfig['weight'] > 1) || (!empty($pconfig['interval']) && ($pconfig['interval'] > $apinger_default['interval'])) || (!empty($pconfig['down']) && !($pconfig['down'] == $apinger_default['down'])))): ?>
|
||||
if ((!empty($pconfig['latencylow']) || !empty($pconfig['latencyhigh']) || !empty($pconfig['losslow']) || !empty($pconfig['losshigh']) || (isset($pconfig['weight']) && $pconfig['weight'] > 1) || (!empty($pconfig['interval']) && ($pconfig['interval'] > $dpinger_default['interval'])))): ?>
|
||||
$("#btn_advanced").click();
|
||||
<?php
|
||||
endif;?>
|
||||
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
@ -620,6 +535,15 @@ $( document ).ready(function() {
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a id="help_for_descr" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Description"); ?></td>
|
||||
<td>
|
||||
<input name="descr" type="text" value="<?=$pconfig['descr'];?>" />
|
||||
<div class="hidden" data-for="help_for_descr">
|
||||
<?=gettext("You may enter a description here for your reference (not parsed)"); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a id="help_for_gateway" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Gateway"); ?></td>
|
||||
<td>
|
||||
@ -726,7 +650,7 @@ $( document ).ready(function() {
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="hidden" data-for="help_for_latency">
|
||||
<?= sprintf(gettext('Low and high thresholds for latency in milliseconds. Default is %d/%d.'), $apinger_default['latencylow'], $apinger_default['latencyhigh']) ?>
|
||||
<?= sprintf(gettext('Low and high thresholds for latency in milliseconds. Default is %d/%d.'), $dpinger_default['latencylow'], $dpinger_default['latencyhigh']) ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@ -752,7 +676,7 @@ $( document ).ready(function() {
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="hidden" data-for="help_for_loss">
|
||||
<?= sprintf(gettext('Low and high thresholds for packet loss in %%. Default is %d/%d.'), $apinger_default['losslow'], $apinger_default['losshigh']) ?>
|
||||
<?= sprintf(gettext('Low and high thresholds for packet loss in %%. Default is %d/%d.'), $dpinger_default['losslow'], $dpinger_default['losshigh']) ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@ -761,76 +685,11 @@ $( document ).ready(function() {
|
||||
<td>
|
||||
<input name="interval" id="interval" type="text" value="<?=$pconfig['interval'];?>" onclick="calculated_change()" />
|
||||
<div class="hidden" data-for="help_for_interval">
|
||||
<?= sprintf(gettext('How often that an ICMP probe will be sent in seconds. Default is %d.'), $apinger_default['interval']) ?><br /><br />
|
||||
<?= sprintf(gettext('How often that an ICMP probe will be sent in seconds. Default is %d.'), $dpinger_default['interval']) ?><br /><br />
|
||||
<?=gettext("NOTE: The quality graph is averaged over seconds, not intervals, so as the probe interval is increased the accuracy of the quality graph is decreased.");?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if (!isset($config['system']['prefer_dpinger'])):?>
|
||||
<tr class="advanced hidden">
|
||||
<td><a id="help_for_down" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Down");?></td>
|
||||
<td>
|
||||
<input name="down" type="text" value="<?=$pconfig['down'];?>" />
|
||||
<div class="hidden" data-for="help_for_down">
|
||||
<?= sprintf(gettext('The number of seconds of failed probes before the alarm will fire. Default is %d.'), $apinger_default['down']) ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="advanced hidden">
|
||||
<td><a id="help_for_avg_delay_samples" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Avg Delay Replies Qty");?></td>
|
||||
<td>
|
||||
<input name="avg_delay_samples" id="avg_delay_samples" type="text" value="<?=$pconfig['avg_delay_samples'];?>" onchange="calculated_change()" />
|
||||
<input name="avg_delay_samples_calculated" type="checkbox" id="avg_delay_samples_calculated" value="yes" <?=!empty($pconfig['avg_delay_samples_calculated']) ? "checked=\"checked\"" : "";?> onclick="calculated_change()" />
|
||||
<?=gettext("Use calculated value."); ?>
|
||||
<div class="hidden" data-for="help_for_avg_delay_samples">
|
||||
<?= sprintf(gettext('How many replies should be used to compute average delay for controlling "delay" alarms? Default is %d.'), $apinger_default['avg_delay_samples']) ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="advanced hidden">
|
||||
<td><a id="help_for_avg_loss_samples" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Avg Packet Loss Probes Qty");?></td>
|
||||
<td>
|
||||
<input name="avg_loss_samples" type="text" id="avg_loss_samples" value="<?=$pconfig['avg_loss_samples'];?>" onchange="calculated_change()" />
|
||||
<input name="avg_loss_samples_calculated" type="checkbox" id="avg_loss_samples_calculated" value="yes" <?= !empty($pconfig['avg_loss_samples_calculated']) ? "checked=\"checked\"" : "";?> onclick="calculated_change()" />
|
||||
<?=gettext("Use calculated value."); ?>
|
||||
|
||||
<div class="hidden" data-for="help_for_avg_loss_samples">
|
||||
<?= sprintf(gettext('How many probes should be used to compute average packet loss? Default is %d.'), $apinger_default['avg_loss_samples']) ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="advanced hidden">
|
||||
<td><a id="help_for_avg_loss_delay_samples" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Lost Probe Delay");?></td>
|
||||
<td>
|
||||
<input name="avg_loss_delay_samples" type="text" id="avg_loss_delay_samples" value="<?=$pconfig['avg_loss_delay_samples'];?>" onchange="calculated_change()" />
|
||||
<input name="avg_loss_delay_samples_calculated" type="checkbox" id="avg_loss_delay_samples_calculated" value="yes" <?= !empty($pconfig['avg_loss_delay_samples_calculated']) ? "checked=\"checked\"" : "";?> onclick="calculated_change()" />
|
||||
<?=gettext("Use calculated value."); ?>
|
||||
|
||||
<div class="hidden" data-for="help_for_avg_loss_delay_samples">
|
||||
<?= sprintf(gettext('The delay (in qty of probe samples) after which loss is computed. Without this, delays longer than the probe interval would be treated as packet loss. Default is %d.'), $apinger_default['avg_loss_delay_samples']) ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="advanced hidden">
|
||||
<td></td>
|
||||
<td>
|
||||
<small>
|
||||
<?= gettext("The probe interval must be less than the down time, otherwise the gateway will seem to go down then come up again at the next probe."); ?><br /><br />
|
||||
<?= gettext("The down time defines the length of time before the gateway is marked as down, but the accuracy is controlled by the probe interval. For example, if your down time is 40 seconds but on a 30 second probe interval, only one probe would have to fail before the gateway is marked down at the 40 second mark. By default, the gateway is considered down after 10 seconds, and the probe interval is 1 second, so 10 probes would have to fail before the gateway is marked down."); ?><br />
|
||||
</small>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
endif;?>
|
||||
<tr>
|
||||
<td><a id="help_for_descr" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Description"); ?></td>
|
||||
<td>
|
||||
<input name="descr" type="text" value="<?=$pconfig['descr'];?>" />
|
||||
<div class="hidden" data-for="help_for_descr">
|
||||
<?=gettext("You may enter a description here for your reference (not parsed)"); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>
|
||||
|
||||
@ -63,14 +63,9 @@ $gateways = return_gateways_array();
|
||||
if ($("#"+tr_id).length) {
|
||||
$("#"+tr_id+" > td:eq(0)").html('<small><strong>'+gateway['name']+'</strong><br/>'+gateway['address']+'</small>');
|
||||
$("#"+tr_id+" > td:eq(1)").html(gateway['delay']);
|
||||
<?php if (isset($config['system']['prefer_dpinger'])): ?>
|
||||
$("#"+tr_id+" > td:eq(2)").html(gateway['stddev']);
|
||||
$("#"+tr_id+" > td:eq(3)").html(gateway['loss']);
|
||||
$("#"+tr_id+" > td:eq(4)").html('<span>'+gateway['status_translated']+'</span>');
|
||||
<?php else: ?>
|
||||
$("#"+tr_id+" > td:eq(2)").html(gateway['loss']);
|
||||
$("#"+tr_id+" > td:eq(3)").html('<span>'+gateway['status_translated']+'</span>');
|
||||
<?php endif ?>
|
||||
|
||||
// set color on status text
|
||||
switch (gateway['status']) {
|
||||
@ -90,17 +85,10 @@ $gateways = return_gateways_array();
|
||||
break;
|
||||
}
|
||||
|
||||
<?php if (isset($config['system']['prefer_dpinger'])): ?>
|
||||
$("#"+tr_id+" > td:eq(4) > span").removeClass("label-danger label-warning label-success label");
|
||||
if (status_color != '') {
|
||||
$("#"+tr_id+" > td:eq(4) > span").addClass("label label-" + status_color);
|
||||
}
|
||||
<?php else: ?>
|
||||
$("#"+tr_id+" > td:eq(3) > span").removeClass("label-danger label-warning label-success label");
|
||||
if (status_color != '') {
|
||||
$("#"+tr_id+" > td:eq(3) > span").addClass("label label-" + status_color);
|
||||
}
|
||||
<?php endif ?>
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -132,9 +120,7 @@ $gateways = return_gateways_array();
|
||||
<tr>
|
||||
<th><?=gettext('Name')?></th>
|
||||
<th><?=gettext('RTT')?></th>
|
||||
<?php if (isset($config['system']['prefer_dpinger'])): ?>
|
||||
<th><?=gettext('RTTd')?></th>
|
||||
<?php endif ?>
|
||||
<th><?=gettext('Loss')?></th>
|
||||
<th><?=gettext('Status')?></th>
|
||||
</tr>
|
||||
@ -147,9 +133,7 @@ $gateways = return_gateways_array();
|
||||
<tr id="gateways_widget_gw_<?= html_safe($gwname) ?>">
|
||||
<td><small><strong><?= $gwname ?></strong><br/>~</small></td>
|
||||
<td class="text-nowrap">~</td>
|
||||
<?php if (isset($config['system']['prefer_dpinger'])): ?>
|
||||
<td class="text-nowrap">~</td>
|
||||
<?php endif ?>
|
||||
<td class="text-nowrap">~</td>
|
||||
<td><span class="label label-default"><?= gettext('Unknown') ?></span></td>
|
||||
</tr>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user