[mythtv-users] Remotely monitor Backend is running

Stephen Worthington stephen_agent at jsw.gen.nz
Sun Oct 17 08:59:01 UTC 2021


On Sat, 16 Oct 2021 10:13:04 -0500, you wrote:

>
>Hi Stephen!
>
>> That message means that you did not use the -n option to tell it which
>> PC to talk to, so it tried to find a database on the local PC to get
>> the address and port number from.  As there is no local database, it
>> was unable to connect to it and gives you that message.  Getting that
>> message means that you have all the required Python modules, so that
>> is good news.
>>
>>> Try changing HOST= ?localhost? to using the IP address of the Backend?.
>>> same error.
>> I am not sure what you did there - what you need to do is use -n <IP
>> address> on the command line.
>
>
>Last part first: within the python script I had changed
>
>
>HOST = 'localhost'
>
>PORT = 6544
>
>
>to
>
>
>HOST = ‘192.168.4.3’
>
>PORT = 6544
>
>
>The IP address being that of the Backend.
>
>
>
>Back to the first section, adding the -n switch

>
>
> From your Python script:
>
>parser.add_argument('-n', '--host', action='store', help='MythTV backend 
>hostname or IP address (default: '+host+')')
>
>
>Well, that’s where the -n comes from (my ‘cookbook’ learning and 
>patching together isn’t the best way!)
>
>
>python '/home/barry/MythTV Backend 
>Scripts/test-mythbackend_v1_3-101421.py' -n 192.168.4.3
>
>Unable to get BackendStatusPort settings from MythTV database, using 
>defaults
>
>
>
>python '/home/barry/MythTV Backend 
>Scripts/test-mythbackend_v1_3-101421.py -n 192.168.4.3'
>
>python: can't open file '/home/barry/MythTV Backend 
>Scripts/test-mythbackend_v1_3-101421.py -n 192.168.4.3': [Errno 2] No 
>such file or directory
>
>
>
>python '/home/barry/MythTV Backend 
>Scripts/test-mythbackend_v1_3-101421.py' -n --host 192.168.4.3
>
>Unable to get BackendStatusPort settings from MythTV database, using 
>defaults
>
>usage: test-mythbackend_v1_3-101421.py [-h] [-V] [-n HOST] [-p PORT]
>
>test-mythbackend_v1_3-101421.py: error: argument -n/--host: expected one 
>argument
>
>
>
>python '/home/barry/MythTV Backend 
>Scripts/test-mythbackend_v1_3-101421.py' -n --host '192.168.4.3'
>
>Unable to get BackendStatusPort settings from MythTV database, using 
>defaults
>
>usage: test-mythbackend_v1_3-101421.py [-h] [-V] [-n HOST] [-p PORT]
>
>test-mythbackend_v1_3-101421.py: error: argument -n/--host: expected one 
>argument
>
>
>
>python '/home/barry/MythTV Backend 
>Scripts/test-mythbackend_v1_3-101421.py' -n 192.168.4.3
>
>Unable to get BackendStatusPort settings from MythTV database, using 
>defaults
>
>
>- - -
>
>
>python '/home/barry/MythTV Backend 
>Scripts/test-mythbackend_v1_3-101421.py' -h
>
>Unable to get BackendStatusPort settings from MythTV database, using 
>defaults
>
>usage: test-mythbackend_v1_3-101421.py [-h] [-V] [-n HOST] [-p PORT]
>
>
>Test that mythbackend is running and responding to API calls (Version: 1.3)
>
>
>optional arguments:
>
>-h, --help show this help message and exit
>
>-V, --version
>
>display the version number and exit
>
>-n HOST, --host HOST
>
>MythTV backend hostname or IP address (default: localhost)
>
>-p PORT, --port PORT
>
>MythTV backend API port number (default: 6544)
>
>
>
>python '/home/barry/MythTV Backend 
>Scripts/test-mythbackend_v1_3-101421.py' -V
>
>Unable to get BackendStatusPort settings from MythTV database, using 
>defaults
>
>Version 1.3
>
>
>
>It seems like from Terminal I’m not passing the host’s IP address on to 
>the Python script.
>
>
>For ‘fun’ cd’d to the subdirectory so I’m working where the Python 
>script is – same error.
>
>
>OK, now you get to tell me what simple little thing I’m overlooking! And 
>just for more fun checked:
>
>
>barry at NZXT:~/MythTV Backend Scripts$ ping -c2 192.168.4.3
>
>PING 192.168.4.3 (192.168.4.3) 56(84) bytes of data.
>
>64 bytes from 192.168.4.3: icmp_seq=1 ttl=64 time=0.206 ms
>
>64 bytes from 192.168.4.3: icmp_seq=2 ttl=64 time=0.150 ms
>
>
>--- 192.168.4.3 ping statistics ---
>
>2 packets transmitted, 2 received, 0% packet loss, time 1005ms
>
>rtt min/avg/max/mdev = 0.150/0.178/0.206/0.028 ms
>
>barry at NZXT:~/MythTV Backend Scripts$ ping -c2 192.168.4.3 -p 6544
>
>PATTERN: 0x6544
>
>PING 192.168.4.3 (192.168.4.3) 56(84) bytes of data.
>
>64 bytes from 192.168.4.3: icmp_seq=1 ttl=64 time=0.184 ms
>
>64 bytes from 192.168.4.3: icmp_seq=2 ttl=64 time=0.193 ms
>
>
>--- 192.168.4.3 ping statistics ---
>
>2 packets transmitted, 2 received, 0% packet loss, time 1007ms
>
>rtt min/avg/max/mdev = 0.184/0.188/0.193/0.014 ms
>
>
>Thanks!
>
>Barry

It look like the problems you are having are due to the way you are
running test-mythbackend.py.  The easy way to run it is to execute it
directly as a command:

test-mythbackend.py <options>

This does require that test-mythbackend.py has been given the
executable option when you downloaded it:

chmod a+x test-mythbackend.py

If you run it as an argument from a python command, then you need to
use different syntax in order to pass options to test-mythbackend.py
instead of to python.  The -c option of the python command tells
python that it is to stop looking for any further options on its
command line and instead run the command directly after the -c option
and pass the rest of the python command line options to the program it
is running via -c.  So instead of:

python '/home/barry/MythTV Backend
Scripts/test-mythbackend_v1_3-101421.py' -n 192.168.4.3

it should be:

python -c '/home/barry/MythTV Backend
Scripts/test-mythbackend_v1_3-101421.py' -n 192.168.4.3

or preferably:

/home/barry/MythTV\ Backend\ Scripts/test-mythbackend_v1_3-101421.py
-n 192.168.4.3

or

"/home/barry/MythTV Backend Scripts/test-mythbackend_v1_3-101421.py"
-n 192.168.4.3

I have also put v1.4 on my web server.  This makes it only try to
access the database if neither -n or -p is used on the command line.
So it will not waste time trying to access a non-existent local
database when you are using -n to tell it to talk to a different PC.
And I have also eliminated the use of text message output except for
install problems - it will now just return a result code without any
warning text messages.


More information about the mythtv-users mailing list