dpinger not started on boot

Started by Maarten, August 25, 2020, 02:04:35 PM

Previous topic - Next topic
Hi,

I'm running a multiwan setup and sometimes on a reboot the dpinger service is not started. This is obviously a pretty big problem, because the gateway is then not enabled.

1) Is there a way to see why this happened?
2) Should a service like this be monitored and started if it failed?

Dpinger does not enable the gateway, it merely monitors it. There is an option within the single gateway settings 'Disable Gateway Monitoring'. If that us ticked dpinger will not start on that gateway.
OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member

yes, but I have "Allow default gateway switching" enabled, so it needs to know if it's a usable gateway.

You should be able to look at the gateway log files to see what's happening,
OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member

There is a way to monitor dpinger and restart it, but it's not a default function, it's something you need to add to Monit. Here's how I do mine, maybe not the best or only way, but it's never let me down. I only monitor my v6 dpinger as that is the only one that occasionally fails when something happens ISP wise.

Go to Services->Monit and click on the 'Service Test Settings' tab. Add a new Service test, give it a name, such as 'Dpinger not Running Restart', set the Condition to 'does not exist' and the action to 'Execute'. Put this in the Path box '/usr/local/etc/rc.d/dpinger_starter', Save that and that's the first part done.

Now click on the 'Service Settings' tab and add a new entry. Give the new entry a name, mine is 'dpinger_WAN_V6_Dpinger_Restart', set the Type to 'Process'. Now you need to find the pid file you want to monitor, look in /var/run/ you'll see them, they will be named dpinger_*_ pid, copy the filename and enter the path an file name into the PID File box, e.g. mine is '/var/run/dpinger_WAN_V6_Monitor.pid'. Now select from the 'Tests' dropdown the test you created first, thats it, click on save.

All that's needed now is to copy the attached file to the /usr/local/etc/rc.d/ directory and make it executable, set the permissions to 755.
Works for me, not sure it will work for you as I suspect there's more afoot than just dpinger not starting.
OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member

@marjohn56 Thanks for your detailed reply, I'm gonna try this script when it happens again and see it that fixes it. Normally I'm a bit hesitant with placing scripts on the router, because after an update it's gone.

Best regards, Maarten

Then you need one of my other scripts which uses rsync to back up my scripts and other specific files to my QNAP.  :)
OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member

Almost eight weeks later I had a pppoe down event which usually results in dpinger failing to restart. There's an issue with my script, it could be that it's because of an update and somethings moved, but it's easy to fix, just add this extra require  in the script with the others.


require_once '/usr/local/etc/inc/system.inc';
OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member

Is there a reason "Disable Gateway Monitoring" is disabled by default? In my particular case I'm refering to a single  WAN network. Also did Maarten find a bug with dpinger not restarting after a reboot?

Quote from: packet loss on October 15, 2020, 08:05:26 PM
Is there a reason "Disable Gateway Monitoring" is disabled by default? In my particular case I'm refering to a single  WAN network. Also did Maarten find a bug with dpinger not restarting after a reboot?

Because 90% only use single WAN where it's not relevant?

Dpinger, on occasion, will not restart after a PPPoE loss, usually the ISP side. I run a Monit task which watches dpinger and will restart it if it's not running, it doesn't really matter what the cause is, the script and monit will restart it, that's what I was referring to. It was to help the OP with the original issue he posted.
OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member

Quote from: marjohn56 on October 16, 2020, 10:02:39 AM
Dpinger, on occasion, will not restart after a PPPoE loss, usually the ISP side. I run a Monit task which watches dpinger and will restart it if it's not running, it doesn't really matter what the cause is, the script and monit will restart it, that's what I was referring to. It was to help the OP with the original issue he posted.

Can you post screenshots? I'd like to add this to the examples .. (or you can add them yourself)

I can, but I have a vague memory of @Franco telling me there was an easier way than using a script.. whatever, I can't remember and this works so I stick with it.


What is it you want, images of the Monit setup etc?
OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member

Yes ... so I can just add a 4th example. monit is so powerful but noone knows how to work with it. It needs practical examples.

@mimugmail


Here you, go, note it monitors the wan v6 dpinger pid, but the script restarts all dpinger instances.
OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member