OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • General Discussion »
  • [SOLVED] Switch apinger to dpinger possible?
« previous next »
  • Print
Pages: [1]

Author Topic: [SOLVED] Switch apinger to dpinger possible?  (Read 9142 times)

ittchmh

  • Newbie
  • *
  • Posts: 10
  • Karma: 4
    • View Profile
[SOLVED] Switch apinger to dpinger possible?
« 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



After apinger restart all ok



Currently I have other issues in pfSense with apinger, I fixed it like this
pfsense 2.1-release - Gateway aPinger broken?
Code: [Select]
<?phprequire_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_data, FILE_APPEND);} ?>



OPNSense running as guest on Hyper-V host
« Last Edit: January 28, 2016, 06:28:55 pm by ittchmh »
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17705
  • Karma: 1618
    • View Profile
Re: Switch apinger to dpinger possible?
« Reply #1 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"
Logged

ittchmh

  • Newbie
  • *
  • Posts: 10
  • Karma: 4
    • View Profile
Re: Switch apinger to dpinger possible?
« Reply #2 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

Quote from: franco on January 27, 2016, 10:24:30 am
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
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17705
  • Karma: 1618
    • View Profile
Re: Switch apinger to dpinger possible?
« Reply #3 on: January 27, 2016, 12:51:13 pm »
No need to be sorry, looking forward to your feedback :)
Logged

ittchmh

  • Newbie
  • *
  • Posts: 10
  • Karma: 4
    • View Profile
Re: Switch apinger to dpinger possible?
« Reply #4 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


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.


And this breaking apinger
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17705
  • Karma: 1618
    • View Profile
Re: [SOLVED] Switch apinger to dpinger possible?
« Reply #5 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)
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17705
  • Karma: 1618
    • View Profile
Re: [SOLVED] Switch apinger to dpinger possible?
« Reply #6 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. :)
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • English Forums »
  • General Discussion »
  • [SOLVED] Switch apinger to dpinger possible?
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2