diff --git a/aprsd/web/admin/static/js/main.js b/aprsd/web/admin/static/js/main.js index f448a2a..f202e90 100644 --- a/aprsd/web/admin/static/js/main.js +++ b/aprsd/web/admin/static/js/main.js @@ -113,6 +113,32 @@ function update_plugins( data ) { plugindiv.append(html_str); } +function update_threads( data ) { + stats = data["stats"]; + if (stats.hasOwnProperty("APRSDThreadList") == false) { + return + } + var threadsdiv = $("#threadsDiv"); + var html_str = '' + html_str += '' + html_str += '' + html_str += '' + threadsdiv.html('') + + var threads = stats["APRSDThreadList"]; + var keys = Object.keys(threads); + keys.sort(); + for (var i=0; i'; + html_str += ''; + html_str += ''; + } + html_str += "
Thread NameAlive?AgeLoop Count
' + val["alive"] + '' + val["age"] + '' + val["loop_count"] + '
"; + threadsdiv.append(html_str); +} + function update_packets( data ) { var packetsdiv = $("#packetsDiv"); //nuke the contents first, then add to it. @@ -179,6 +205,7 @@ function start_update() { update_watchlist(data); update_seenlist(data); update_plugins(data); + update_threads(data); }, complete: function() { setTimeout(statsworker, 10000); diff --git a/aprsd/web/admin/templates/index.html b/aprsd/web/admin/templates/index.html index 4fe1194..5c26818 100644 --- a/aprsd/web/admin/templates/index.html +++ b/aprsd/web/admin/templates/index.html @@ -81,6 +81,7 @@
Seen List
Watch List
Plugins
+
Threads
Config
LogFile
@@ -155,6 +156,13 @@
Loading
+
+

+ Threads Loaded ({{ thread_count }}) +

+
Loading
+
+

Config

{{ config_json|safe }}
diff --git a/aprsd/wsgi.py b/aprsd/wsgi.py index 487a5e4..28fc02e 100644 --- a/aprsd/wsgi.py +++ b/aprsd/wsgi.py @@ -70,12 +70,17 @@ def index(): pm = plugin.PluginManager() plugins = pm.get_plugins() plugin_count = len(plugins) + client_stats = stats["stats"].get("APRSClientStats", {}) if CONF.aprs_network.enabled: transport = "aprs-is" + if client_stats: + aprs_connection = client_stats.get("server_string", "") + else: + aprs_connection = "APRS-IS" aprs_connection = ( "APRS-IS Server: " - "{}".format(stats["stats"]["APRSClientStats"]["server_string"]) + "{}".format(aprs_connection) ) else: # We might be connected to a KISS socket? @@ -96,10 +101,17 @@ def index(): ) ) - stats["stats"]["APRSClientStats"]["transport"] = transport - stats["stats"]["APRSClientStats"]["aprs_connection"] = aprs_connection + if client_stats: + stats["stats"]["APRSClientStats"]["transport"] = transport + stats["stats"]["APRSClientStats"]["aprs_connection"] = aprs_connection entries = conf.conf_to_dict() + thread_info = stats["stats"].get("APRSDThreadList", {}) + if thread_info: + thread_count = len(thread_info) + else: + thread_count = "unknown" + return flask.render_template( "index.html", initial_stats=json.dumps(stats, cls=aprsd_json.SimpleJSONEncoder), @@ -111,6 +123,7 @@ def index(): sort_keys=True, default=str, ), plugin_count=plugin_count, + thread_count=thread_count, # oslo_out=generate_oslo() )