diff --git a/data/interfaces/default/ip_address_modal.html b/data/interfaces/default/ip_address_modal.html index 2874cf45..5902f33b 100644 --- a/data/interfaces/default/ip_address_modal.html +++ b/data/interfaces/default/ip_address_modal.html @@ -79,7 +79,7 @@ $('#ip_error').html(' Internal request failed.').show(); }, success: function (result) { - if (result.results === 'error') { + if (result.result === 'error') { $('#ip_error').html(' ' + result.message).show(); } else { var data = result.data; diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html index b75312ee..8426224a 100644 --- a/data/interfaces/default/settings.html +++ b/data/interfaces/default/settings.html @@ -858,6 +858,28 @@

Enable to have Tautulli check if remote access to the Plex Media Server goes down.

+
+
+ +
+
+ +
+ +
+

The interval (in seconds) Tautulli will ping the Plex Media Server for the remote access status. Minimum 60.

+
+
+ +
+
+ +
+ +
+

The number of consecutive remote access status failures to consider remote access as down. Minimum 1.

+
+
@@ -2051,6 +2073,7 @@ $(document).ready(function() { initConfigCheckbox('#https_create_cert'); initConfigCheckbox('#check_github'); initConfigCheckbox('#monitor_pms_updates'); + initConfigCheckbox('#monitor_remote_access'); initConfigCheckbox('#newsletter_self_hosted'); $('#menu_link_shutdown').click(function() { diff --git a/plexpy/activity_pinger.py b/plexpy/activity_pinger.py index 94927cf0..e3b093a1 100644 --- a/plexpy/activity_pinger.py +++ b/plexpy/activity_pinger.py @@ -45,6 +45,7 @@ else: monitor_lock = threading.Lock() ext_ping_count = 0 +ext_ping_error = None int_ping_count = 0 @@ -323,18 +324,25 @@ def check_server_access(): server_response = pms_connect.get_server_response() global ext_ping_count + global ext_ping_error # Check for remote access if server_response: + log = (server_response['mapping_error'] != ext_ping_error) + if server_response['reason']: ext_ping_count += 1 - logger.warn("Tautulli Monitor :: Remote access failed: %s, ping attempt %s." \ - % (server_response['reason'], str(ext_ping_count))) + ext_ping_error = server_response['mapping_error'] + if log: + logger.warn("Tautulli Monitor :: Remote access failed: %s, ping attempt %s." + % (server_response['reason'], str(ext_ping_count))) # Waiting for port mapping elif server_response['mapping_state'] == 'waiting': - logger.warn("Tautulli Monitor :: Remote access waiting for port mapping, ping attempt %s." \ - % str(ext_ping_count)) + ext_ping_error = server_response['mapping_error'] + if log: + logger.warn("Tautulli Monitor :: Remote access waiting for port mapping, ping attempt %s." + % str(ext_ping_count)) # Reset external ping counter else: @@ -344,8 +352,10 @@ def check_server_access(): plexpy.NOTIFY_QUEUE.put({'notify_action': 'on_extup', 'remote_access_info': server_response}) ext_ping_count = 0 + ext_ping_error = None if ext_ping_count == plexpy.CONFIG.REMOTE_ACCESS_PING_THRESHOLD: + logger.info("Tautulli Monitor: Plex remote access is down.") plexpy.NOTIFY_QUEUE.put({'notify_action': 'on_extdown', 'remote_access_info': server_response}) diff --git a/plexpy/plextv.py b/plexpy/plextv.py index e2a38752..dbe1354c 100644 --- a/plexpy/plextv.py +++ b/plexpy/plextv.py @@ -946,7 +946,7 @@ class PlexTV(object): return account_details def get_geoip_lookup(self, ip_address=''): - if not ip_address or not helpers.is_public_ip(ip_address): + if not ip_address or not helpers.is_valid_ip(ip_address): return geoip_data = self.get_plextv_geoip(ip_address=ip_address, output_format='xml') diff --git a/plexpy/webserve.py b/plexpy/webserve.py index d7f04236..44c76ff2 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -2993,6 +2993,8 @@ class WebInterface(object): "grouping_charts": checked(plexpy.CONFIG.GROUPING_CHARTS), "monitor_pms_updates": checked(plexpy.CONFIG.MONITOR_PMS_UPDATES), "monitor_remote_access": checked(plexpy.CONFIG.MONITOR_REMOTE_ACCESS), + "remote_access_ping_interval": plexpy.CONFIG.REMOTE_ACCESS_PING_INTERVAL, + "remote_access_ping_threshold": plexpy.CONFIG.REMOTE_ACCESS_PING_THRESHOLD, "refresh_libraries_interval": plexpy.CONFIG.REFRESH_LIBRARIES_INTERVAL, "refresh_libraries_on_startup": checked(plexpy.CONFIG.REFRESH_LIBRARIES_ON_STARTUP), "refresh_users_interval": plexpy.CONFIG.REFRESH_USERS_INTERVAL, @@ -3124,6 +3126,7 @@ class WebInterface(object): kwargs.get('pms_update_check_interval') != str(plexpy.CONFIG.PMS_UPDATE_CHECK_INTERVAL) or \ kwargs.get('monitor_pms_updates') != plexpy.CONFIG.MONITOR_PMS_UPDATES or \ kwargs.get('monitor_remote_access') != plexpy.CONFIG.MONITOR_REMOTE_ACCESS or \ + kwargs.get('remote_access_ping_interval') != plexpy.CONFIG.REMOTE_ACCESS_PING_INTERVAL or \ kwargs.get('pms_url_manual') != plexpy.CONFIG.PMS_URL_MANUAL: reschedule = True @@ -5828,8 +5831,6 @@ class WebInterface(object): message = 'No IP address provided.' elif not helpers.is_valid_ip(ip_address): message = 'Invalid IP address provided: %s' % ip_address - elif not helpers.is_public_ip(ip_address): - message = 'Non-public IP address provided: %s' % ip_address if message: return {'result': 'error', 'message': message}