mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Merge pull request #953 from N0YB/Gateway_Quality_RRD
Fix gateway quality RRD to have the correct granularity and be consistent with the pfSense graphs set.
This commit is contained in:
commit
c3e4ef746f
@ -30,6 +30,7 @@
|
||||
|
||||
*/
|
||||
require_once("config.inc");
|
||||
require_once("rrd.inc");
|
||||
|
||||
/* Returns an array of default values used for apinger.conf */
|
||||
function return_apinger_defaults() {
|
||||
@ -299,6 +300,11 @@ EOD;
|
||||
|
||||
$apingerconfig .= $alarmscfg;
|
||||
$apingerconfig .= $apingercfg;
|
||||
|
||||
# Create gateway quality RRD with settings more suitable for pfSense graph set,
|
||||
# since apinger uses default step (300; 5 minutes) and other settings that don't
|
||||
# match the pfSense gateway quality graph set.
|
||||
create_gateway_quality_rrd("{$g['vardb_path']}/rrd/{$gateway['name']}-quality.rrd");
|
||||
}
|
||||
@file_put_contents("{$g['varetc_path']}/apinger.conf", $apingerconfig);
|
||||
unset($apingerconfig);
|
||||
@ -310,6 +316,7 @@ EOD;
|
||||
|
||||
@chown("{$g['vardb_path']}/rrd", "nobody");
|
||||
|
||||
/* Restart apinger process */
|
||||
if (isvalidpid("{$g['varrun_path']}/apinger.pid"))
|
||||
sigkillbypid("{$g['varrun_path']}/apinger.pid", "HUP");
|
||||
else {
|
||||
|
||||
@ -927,6 +927,34 @@ function enable_rrd_graphing() {
|
||||
|
||||
}
|
||||
|
||||
# Create gateway quality RRD with settings suitable for pfSense graph set.
|
||||
function create_gateway_quality_rrd($rrd_file) {
|
||||
global $g;
|
||||
$rrdinterval = 60;
|
||||
$valid = $rrdinterval * 2;
|
||||
$rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool";
|
||||
|
||||
/* GATEWAY QUALITY, set up the rrd file */
|
||||
if (!file_exists("$rrd_file")) {
|
||||
$rrdcreate = "$rrdtool create $rrd_file --step $rrdinterval ";
|
||||
$rrdcreate .= "DS:loss:GAUGE:$valid:0:100 ";
|
||||
$rrdcreate .= "DS:delay: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 ";
|
||||
$rrdcreate .= "RRA:AVERAGE:0.5:1440:2284 ";
|
||||
|
||||
create_new_rrd($rrdcreate);
|
||||
unset($rrdcreate);
|
||||
}
|
||||
|
||||
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
|
||||
if($g['booting']) {
|
||||
mwexec("$rrdtool update $rrd_file N:U:U");
|
||||
}
|
||||
unset($rrdtool, $rrdinterval, $valid, $rrd_file);
|
||||
}
|
||||
|
||||
function kill_traffic_collector() {
|
||||
global $g;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user