Ping Watchdog

Report wireless and/or network connectivity problems in this forum.

Moderator: Moderators

ispyisail
Moderator
Posts: 5180
Joined: Mon Apr 06, 2009 3:15 am
Location: New Zealand

Ping Watchdog

Post by ispyisail »

Hi all

I've just finished a how-to for "Ping Watchdog"

I just made up stuff

anybody want to critique my work

http://www.gargoyle-router.com/wiki/dok ... g_watchdog

Lantis
Moderator
Posts: 6735
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Ping Watchdog

Post by Lantis »

Good guide!
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

ispyisail
Moderator
Posts: 5180
Joined: Mon Apr 06, 2009 3:15 am
Location: New Zealand

Re: Ping Watchdog

Post by ispyisail »

Does anybody know who wrote this plugin

I want to know more about "Custom script" feature

where is in installed?

example script?

do you need to include script headers?

Lantis
Moderator
Posts: 6735
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Ping Watchdog

Post by Lantis »

By looking at the plugin I think you're able to use:

A basic command
"logread"

or a link to a more complex set of commands
"sh /etc/customscript.sh"

Where customscript.sh contains the commands you want to run.
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

focus
Posts: 14
Joined: Fri Nov 10, 2017 8:24 am

Re: Ping Watchdog

Post by focus »

Great guide!

I don't suppose anyone has created custom script already that sends an email with a few logs before the drop-out occurred?

or even a simple script that sends just an email?

rseiler
Posts: 208
Joined: Sun Dec 15, 2013 12:31 am

Re: Ping Watchdog

Post by rseiler »

Something like this should work.

Note that I think this requires the Email notifications plugin, since that may install sendmail (I don't recall if it's included otherwise) but at the very least will define your SMTP particulars (SSL or not, server name and port). Of course, you could always handle sendmail in other ways.

Code: Select all

#!/bin/sh

# Required variable if sending mail securely (i.e. not on port 25).
tlscert="/etc/ssl/certs/ca-certificates.crt"

# Define a timestamp function.
timestamp() {
  date +"%I:%M:%S %p"
}

# Define sendmail variables.
subject="This is the subject, which can include: $(timestamp)"
from="from@email.com"
recipients="to@email.com,to2@email.com"

# Define the message to be sent.
# If using port 25, use the following sendmail line instead of the longer one:
# /usr/sbin/sendmail "$recipients" <<EOF
/usr/sbin/sendmail --tls-trust-file $tlscert "$recipients" <<EOF
subject:$subject
from:$from

Body of the message
EOF

# Commands can be included here or earlier.
# wifi

BENROFU
Posts: 30
Joined: Thu Jan 07, 2021 6:40 am
Location: Norway

Re: Ping Watchdog

Post by BENROFU »

I use gargoyle as a internal router, and a router with LTE connection on a ship. When i loose coverage the lte modem dont automaticali search for signals, and often i need to reboot it to connect lte. I have installed ping watchdog, but i need a script to reboot the lte modem. I use SSH to reboot the modem, so i think it should not be any problem if i only knew how to do it. Someone with tips?

Lantis
Moderator
Posts: 6735
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Ping Watchdog

Post by Lantis »

What commands do you run to reboot the modem? Are they run in Gargoyle or you need to SSH to the modem?
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

BENROFU
Posts: 30
Joined: Thu Jan 07, 2021 6:40 am
Location: Norway

Re: Ping Watchdog

Post by BENROFU »

I have made a VBS script i run from PC to reboot the modem.
The lte modem is the "Outdoorrouter.com" with openwrt luci. I suppose it also is possible to install watchdog on the openwrt, but i am not comfortable to do much with it if i do something wrong and mess it up. It is mounted high up in the ships mast and i accessable only with crane from port in good weather.

It would be perfect if i had a script on the gargoyle router witch send the reboot command to the modem when ping error from watchdog.

Option explicit
Dim oShell
set oShell= Wscript.CreateObject("WScript.Shell")
oShell.Run "ssh 192.168.30.1 -l root"
WScript.Sleep 3000
oShell.Sendkeys "password~"
WScript.Sleep 1000
oShell.Sendkeys "reboot~"
WScript.Sleep 1000
oShell.Sendkeys "exit~"
WScript.Sleep 1000
Wscript.Quit

Lantis
Moderator
Posts: 6735
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Ping Watchdog

Post by Lantis »

Something like

Code: Select all

ssh root@192.168.30.1 'reboot~'
from Gargoyle should work.
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

Post Reply