OPNsense Forum

English Forums => General Discussion => Topic started by: ittchmh on January 26, 2016, 06:32:15 pm

Title: [SOLVED] Switch apinger to dpinger possible?
Post by: ittchmh on January 26, 2016, 06:32:15 pm
I have same issue in OPNSense like in pfSense
Issue and potiential fix for apinger monitoring of IPv6 GIF interfaces (https://forum.pfsense.org/index.php?topic=104240.0)

(http://i.imgur.com/BdafBSF.png)

After apinger restart all ok

(http://i.imgur.com/NIIfb9P.png)

Currently I have other issues in pfSense with apinger, I fixed it like this
pfsense 2.1-release - Gateway aPinger broken? (https://forum.pfsense.org/index.php?topic=69533.msg584074#msg584074)
Code: [Select]
<?php
require_once("/etc/inc/service-utils.inc");
require_once(
"/etc/inc/globals.inc");
require_once(
"/etc/inc/gwlb.inc");
$log_file "/var/log/apinger.log";

$log_date date('d/m/Y H:i:s'time());


$counter 0;
$a_gateways return_gateways_array();
$gateways_status = array();
$gateways_status return_gateways_status(true);

foreach (
$a_gateways as $gname => $gateway) {
if ($gateways_status[$gname]) {
$str_data $gateways_status[$gname]['delay'];
$pos substr($str_data,0,strpos($str_data"ms"));
if (floatval($pos) > 500 ) {
$counter++;

}
}
}
if (
$counter 0) {

service_control_restart(apinger,restartservice);
$log_data 'Counter = '.$counter' date: '.$log_date' | service restarted!'PHP_EOL;
file_put_contents($log_file$log_dataFILE_APPEND);

?>



OPNSense running as guest on Hyper-V host
Title: Re: Switch apinger to dpinger possible?
Post by: franco on January 27, 2016, 10:24:30 am
We're watching the dpinger efforts (and have helped in the beginning with the FreeBSD porting), but we have no immediate plans.

Does calling /status_services.php?mode=restartservice&service=apinger not suffice in your scenario, or is this a cron job?

Hyper-V is quite fragile when it comes to clocks and NTP, the suggestion from the pfSense forum sounds interesting... have you ever tried to "disarm" NTP by providing an invalid server?

System: Settings: General: NTP server: "no"
Title: Re: Switch apinger to dpinger possible?
Post by: ittchmh on January 27, 2016, 10:44:20 am
This is cron job

If at least one gw has ping > 500 service restarted

After yestarday I think that all the problems linked to time issues

Hyper-V is quite fragile when it comes to clocks and NTP, the suggestion from the pfSense forum sounds interesting... have you ever tried to "disarm" NTP by providing an invalid server?

System: Settings: General: NTP server: "no"
I will try this.

Rising Probe Interval to 10 sec of GW also helped

on pfSense same Probe Interval but I have many issues with apinger on different Hyper-V hosts

I will try to rise Probe Interval there...

sorry for my English
Title: Re: Switch apinger to dpinger possible?
Post by: franco on January 27, 2016, 12:51:13 pm
No need to be sorry, looking forward to your feedback :)
Title: Re: Switch apinger to dpinger possible?
Post by: ittchmh on January 27, 2016, 07:08:00 pm
Hi!

Problem with apinger only on VMs!
To eliminate this issue only one time provider must be enabled!
On Hyper-V VM
(http://i.imgur.com/kMWECSO.png)

Or ntpd inside VM Guest

If Hyper-V host time wrong even few seconds, guest VM updating time from NTP server, after that VM Integration service adjusting guest VM clock immediately to Hyper-V time value.
(http://i.imgur.com/KjxokpP.png)

And this breaking apinger
Title: Re: [SOLVED] Switch apinger to dpinger possible?
Post by: franco on April 21, 2016, 10:40:16 pm
I've started some cleanups over at:

https://github.com/opnsense/apinger

What I can see is that gettimeofday() is used for measurements. We need to switch to a monotonic time source in order to fix that. 8)
Title: Re: [SOLVED] Switch apinger to dpinger possible?
Post by: franco on May 01, 2016, 07:48:09 pm
This was fixed a few days ago in our apinger repository:

https://github.com/opnsense/apinger/commit/9a330e42b79f9bf4fcb6b3b34560194e87206575

Been running this for a few days without an issue, we may as well push this with 16.1.13 next week. :)