[mythtv-users] Remotely monitor Backend is running
Barry Martin
barry3martin at gmail.com
Fri Oct 8 23:54:04 UTC 2021
Hi Folks!
Trying to create a script to let me know when my MythTV Backend is not
running. What I have works, but apparently only if totally off-line (as
in off). This morning not quite sure what happened but the Frontend
could not find the Backend (glanced at the screen, knew it was a BE
issue). Accessing the webpage (Firefox to 192.168.4.3:6544) the “last
10” rotating display was not present, fairly certain the ‘Current Tuner
Activity” listing was present; ‘Frontend Status” was definitely present.
(Probably unnecessary information, but in case help….)
What I current have follows; cron on the computer my rump is usually in
front of has a script which inquires the Backend every 15 minutes during
the day. If no problem no notification; if there is a problem a popup
appears on my screen. Works if the MythTV is totally off, but did not
notify with the above situation. I also prefer the pop-up over an e-mail
notification.
The nitty-grity so far:
The Backend is at 192.168.4.3.
crontab on my computer:
# Test Backend 3 (BE3) is on-line every 15 minutes from 6:00 a.m. to
7:45 p.m.
# The script does not display except with a problem
*/15 07-19 * * * export DISPLAY=:0 && /bin/sh '/home/barry/MythTV
Backend Scripts/Test_BE3.sh'
==> barry at NZXT:~$ cat '/home/barry/MythTV Backend Scripts/Test_BE3.sh'
#!/bin/sh
# Test Backend 3 (BE3) 192.168.4.3
#
# Test cmd line for make appear off-line: search for " nc -z "
#
#####################################################################
# Create variables
current_date_time=$(date)
#####################################################################
# Test connection -- port 6544 is default -- use 8080 for off-line test
nc -z 192.168.4.3 6544
if [ $? -eq 0 ]
then
echo "BE3 is up."
else
echo "exit status is $?."
echo "BE3 192.168.4.3:6544 down."
Err_BE3_1="Oh-oh!! MythTV Backend 3 (BE3 - 192.168.4.3) is down! "
# XMsg_Size=" -fn '-*-*-*-r-*--0-150-0-0-p-*-iso8859-1'"
# Why this works in one script and not another -- bug
# XMsg_Size=" -fn '-*-*-*-r-*--0-200-0-0-p-*-iso8859-1'"
# echo "$current_date_time\n $Err_BE3_1\n" | xmessage $XMsg_Size -file -
echo "$current_date_time\n $Err_BE3_1\n" | xmessage -fn
'-*-*-*-r-*--0-200-0-0-p-*-iso8859-1' -file -
fi
exit
I don’t know what netcat’s -z switch does – saw it when cookbooking
another project and seemed to do what I needed. ..Something about not
sending data (which is probably good as I saw something about a lot of
pings could lock up MythTV).
Thanks!
Barry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20211008/373d3abf/attachment.htm>
More information about the mythtv-users
mailing list