mirror of
https://github.com/EDCD/EDDN.git
synced 2025-05-22 09:41:22 +03:00
monitor: Move configuration into separate file
This will allow for running more than one monitor without editing actual source.
This commit is contained in:
parent
1ae349a4b7
commit
8f73060c74
@ -400,6 +400,8 @@
|
|||||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
|
||||||
<script src="https://code.highcharts.com/5.0.12/highcharts.js"></script>
|
<script src="https://code.highcharts.com/5.0.12/highcharts.js"></script>
|
||||||
<script src="https://code.highcharts.com/5.0.12/modules/drilldown.js"></script>
|
<script src="https://code.highcharts.com/5.0.12/modules/drilldown.js"></script>
|
||||||
|
<!-- config file -->
|
||||||
|
<script src="./js/eddn-config.js"></script>
|
||||||
<script src="./js/eddn.js"></script>
|
<script src="./js/eddn.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
22
contrib/monitor/js/eddn-config.js
Normal file
22
contrib/monitor/js/eddn-config.js
Normal file
@ -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
|
||||||
|
|
||||||
|
};
|
@ -1,21 +1,5 @@
|
|||||||
/* vim: wrapmargin=0 textwidth=0 tabstop=4 softtabstop=4 expandtab shiftwidth=4
|
/* 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 = {
|
var stats = {
|
||||||
'gateways' : {},
|
'gateways' : {},
|
||||||
'relays' : {}
|
'relays' : {}
|
||||||
@ -435,11 +419,11 @@ var doUpdateSoftwares = function()
|
|||||||
*/
|
*/
|
||||||
$.ajax({
|
$.ajax({
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
url: monitorEndPoint + 'getSoftwares/?dateStart=' + yesterday + '&dateEnd = ' + today,
|
url: eddn_config.monitorEndPoint + 'getSoftwares/?dateStart=' + yesterday + '&dateEnd = ' + today,
|
||||||
success: function(softwaresTodayYesterday){
|
success: function(softwaresTodayYesterday){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
url: monitorEndPoint + 'getTotalSoftwares/',
|
url: eddn_config.monitorEndPoint + 'getTotalSoftwares/',
|
||||||
success: function(softwaresTotals){
|
success: function(softwaresTotals){
|
||||||
// Might happen when nothing is received...
|
// Might happen when nothing is received...
|
||||||
if(softwaresTodayYesterday[yesterday] == undefined)
|
if(softwaresTodayYesterday[yesterday] == undefined)
|
||||||
@ -524,7 +508,7 @@ var doUpdateSchemas = function()
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
url: monitorEndPoint + 'getSchemas/?dateStart=' + yesterday + '&dateEnd = ' + today,
|
url: eddn_config.monitorEndPoint + 'getSchemas/?dateStart=' + yesterday + '&dateEnd = ' + today,
|
||||||
success: function(schemasTodayYesterday){
|
success: function(schemasTodayYesterday){
|
||||||
// Might happen when nothing is received...
|
// Might happen when nothing is received...
|
||||||
if(schemasTodayYesterday[yesterday] == undefined)
|
if(schemasTodayYesterday[yesterday] == undefined)
|
||||||
@ -534,7 +518,7 @@ var doUpdateSchemas = function()
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
url: monitorEndPoint + 'getTotalSchemas/',
|
url: eddn_config.monitorEndPoint + 'getTotalSchemas/',
|
||||||
success: function(schemasTotals){
|
success: function(schemasTotals){
|
||||||
var chart = $('#schemas .chart').highcharts(),
|
var chart = $('#schemas .chart').highcharts(),
|
||||||
series = chart.get('schemas');
|
series = chart.get('schemas');
|
||||||
@ -807,12 +791,12 @@ var start = function(){
|
|||||||
|
|
||||||
// Grab gateways
|
// Grab gateways
|
||||||
//gateways = gateways.sort();
|
//gateways = gateways.sort();
|
||||||
$.each(gateways, function(k, gateway){
|
$.each(eddn_config.gateways, function(k, gateway){
|
||||||
gateway = gateway.replace('tcp://', '');
|
gateway = gateway.replace('tcp://', '');
|
||||||
gateway = gateway.replace(':8500', '');
|
gateway = gateway.replace(':8500', '');
|
||||||
|
|
||||||
$("select[name=gateways]").append($('<option>', {
|
$("select[name=gateways]").append($('<option>', {
|
||||||
value: 'https://' + gateway + ':' + gatewayBottlePort + '/stats/',
|
value: eddn_config.gatewayStats,
|
||||||
text : gateway
|
text : gateway
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -853,13 +837,13 @@ var start = function(){
|
|||||||
doUpdates('gateways');
|
doUpdates('gateways');
|
||||||
setInterval(function(){
|
setInterval(function(){
|
||||||
doUpdates('gateways');
|
doUpdates('gateways');
|
||||||
}, updateInterval);
|
}, eddn_config.updateInterval);
|
||||||
|
|
||||||
// Grab relays
|
// Grab relays
|
||||||
//relays = relays.sort();
|
//relays = relays.sort();
|
||||||
$.each(relays, function(k, relay){
|
$.each(eddn_config.relays, function(k, relay){
|
||||||
$("select[name=relays]").append($('<option>', {
|
$("select[name=relays]").append($('<option>', {
|
||||||
value: 'https://' + relay + ':' + relayBottlePort + '/stats/',
|
value: eddn_config.relayStats,
|
||||||
text : relay
|
text : relay
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -903,7 +887,7 @@ var start = function(){
|
|||||||
doUpdates('relays');
|
doUpdates('relays');
|
||||||
setInterval(function(){
|
setInterval(function(){
|
||||||
doUpdates('relays');
|
doUpdates('relays');
|
||||||
}, updateInterval);
|
}, eddn_config.updateInterval);
|
||||||
|
|
||||||
// Grab software from monitor
|
// Grab software from monitor
|
||||||
$('#software .chart').highcharts({
|
$('#software .chart').highcharts({
|
||||||
@ -926,7 +910,7 @@ var start = function(){
|
|||||||
doUpdateSoftwares();
|
doUpdateSoftwares();
|
||||||
setInterval(function(){
|
setInterval(function(){
|
||||||
doUpdateSoftwares();
|
doUpdateSoftwares();
|
||||||
}, updateInterval);
|
}, eddn_config.updateInterval);
|
||||||
|
|
||||||
// Grab uploader from monitor
|
// Grab uploader from monitor
|
||||||
$('#uploaders .chart').highcharts({
|
$('#uploaders .chart').highcharts({
|
||||||
@ -965,7 +949,7 @@ var start = function(){
|
|||||||
doUpdateSchemas();
|
doUpdateSchemas();
|
||||||
setInterval(function(){
|
setInterval(function(){
|
||||||
doUpdateSchemas();
|
doUpdateSchemas();
|
||||||
}, updateInterval);
|
}, eddn_config.updateInterval);
|
||||||
|
|
||||||
// Attach events
|
// Attach events
|
||||||
$("select[name=gateways]").change(function(){
|
$("select[name=gateways]").change(function(){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user