From 063322df4f2d166ceb07063d7e707570f3677d07 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Sun, 13 Mar 2022 15:55:03 +0000 Subject: [PATCH] monitor: Move configuration into separate file This will allow for running more than one monitor without editing actual source. --- contrib/monitor/index.html | 2 ++ contrib/monitor/js/eddn-config.js | 22 +++++++++++++++++ contrib/monitor/js/eddn.js | 40 ++++++++++--------------------- 3 files changed, 36 insertions(+), 28 deletions(-) create mode 100644 contrib/monitor/js/eddn-config.js diff --git a/contrib/monitor/index.html b/contrib/monitor/index.html index 9f16a47..0b7c365 100644 --- a/contrib/monitor/index.html +++ b/contrib/monitor/index.html @@ -400,6 +400,8 @@ + + diff --git a/contrib/monitor/js/eddn-config.js b/contrib/monitor/js/eddn-config.js new file mode 100644 index 0000000..16b2a97 --- /dev/null +++ b/contrib/monitor/js/eddn-config.js @@ -0,0 +1,22 @@ +/* vim: wrapmargin=0 textwidth=0 tabstop=4 softtabstop=4 expandtab shiftwidth=4 + */ +var eddn_config = { + updateInterval: 60000, + + eddn_host: 'eddn.miggy.org', + monitorEndPoint: 'https://eddn.miggy.org/dev/monitor/', + + gatewayStats: '/dev/stats/', + + relayStats: '/dev/relay/stats/', + relayBottlePort: 9110, + + gateways: [ + 'eddn.miggy.org' + ], //TODO: Must find a way to bind them to monitor + + relays: [ + 'eddn.miggy.org' + ] //TODO: Must find a way to bind them to monitor + +}; diff --git a/contrib/monitor/js/eddn.js b/contrib/monitor/js/eddn.js index 79aab9a..7c18ecd 100644 --- a/contrib/monitor/js/eddn.js +++ b/contrib/monitor/js/eddn.js @@ -1,21 +1,5 @@ /* vim: wrapmargin=0 textwidth=0 tabstop=4 softtabstop=4 expandtab shiftwidth=4 */ -var updateInterval = 60000, - - monitorEndPoint = 'https://eddn.edcd.io:9091/', - - //gatewayBottlePort = 8080, - gatewayBottlePort = 4430, - relayBottlePort = 9090, - - gateways = [ - 'eddn.edcd.io' - ], //TODO: Must find a way to bind them to monitor - - relays = [ - 'eddn.edcd.io' - ]; //TODO: Must find a way to bind them to monitor - var stats = { 'gateways' : {}, 'relays' : {} @@ -435,11 +419,11 @@ var doUpdateSoftwares = function() */ $.ajax({ dataType: "json", - url: monitorEndPoint + 'getSoftwares/?dateStart=' + yesterday + '&dateEnd = ' + today, + url: eddn_config.monitorEndPoint + 'getSoftwares/?dateStart=' + yesterday + '&dateEnd = ' + today, success: function(softwaresTodayYesterday){ $.ajax({ dataType: "json", - url: monitorEndPoint + 'getTotalSoftwares/', + url: eddn_config.monitorEndPoint + 'getTotalSoftwares/', success: function(softwaresTotals){ // Might happen when nothing is received... if(softwaresTodayYesterday[yesterday] == undefined) @@ -524,7 +508,7 @@ var doUpdateSchemas = function() $.ajax({ dataType: "json", - url: monitorEndPoint + 'getSchemas/?dateStart=' + yesterday + '&dateEnd = ' + today, + url: eddn_config.monitorEndPoint + 'getSchemas/?dateStart=' + yesterday + '&dateEnd = ' + today, success: function(schemasTodayYesterday){ // Might happen when nothing is received... if(schemasTodayYesterday[yesterday] == undefined) @@ -534,7 +518,7 @@ var doUpdateSchemas = function() $.ajax({ dataType: "json", - url: monitorEndPoint + 'getTotalSchemas/', + url: eddn_config.monitorEndPoint + 'getTotalSchemas/', success: function(schemasTotals){ var chart = $('#schemas .chart').highcharts(), series = chart.get('schemas'); @@ -807,12 +791,12 @@ var start = function(){ // Grab gateways //gateways = gateways.sort(); - $.each(gateways, function(k, gateway){ + $.each(eddn_config.gateways, function(k, gateway){ gateway = gateway.replace('tcp://', ''); gateway = gateway.replace(':8500', ''); $("select[name=gateways]").append($('