[mythtv-users] Remotely monitor Backend is running

Bill Meek keemllib at gmail.com
Sat Oct 16 15:37:39 UTC 2021


On 10/16/21 10:13 AM, Barry Martin 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
> 

Make sure there's a ~/.mythtv/config.xml file on this host. Python
bindings need this too. The contents look like any other remote
mythfrontend's would.

Even better than ping: nmap -p 3306,6544 --reason 192.168.4.3

Expect to see:

  PORT     STATE SERVICE REASON
  3306/tcp open  mysql   syn-ack
  6544/tcp open  mythtv  syn-ack

-- 
Bill


More information about the mythtv-users mailing list