Page 1 of 2

Ping Watchdog

Posted: Thu Aug 20, 2015 4:45 am
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

Re: Ping Watchdog

Posted: Thu Aug 20, 2015 4:59 am
by Lantis
Good guide!

Re: Ping Watchdog

Posted: Sat Aug 22, 2015 8:02 pm
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?

Re: Ping Watchdog

Posted: Sat Aug 22, 2015 11:36 pm
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.

Re: Ping Watchdog

Posted: Mon May 07, 2018 11:29 pm
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?

Re: Ping Watchdog

Posted: Sat Aug 11, 2018 2:00 pm
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

Re: Ping Watchdog

Posted: Wed Aug 04, 2021 11:14 am
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?

Re: Ping Watchdog

Posted: Wed Aug 04, 2021 6:15 pm
by Lantis
What commands do you run to reboot the modem? Are they run in Gargoyle or you need to SSH to the modem?

Re: Ping Watchdog

Posted: Thu Aug 05, 2021 4:32 am
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

Re: Ping Watchdog

Posted: Thu Aug 05, 2021 7:19 am
by Lantis
Something like

Code: Select all

ssh root@192.168.30.1 'reboot~'
from Gargoyle should work.