X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fsimulator-group%2Fsim-monitor.js;h=7a220263ad1c3ac397f0dc1e35f4a556b258ae5f;hb=f0a158c3c32b6547c839c559548e4e4b729802e1;hp=b746ae5df3d8cbe502eafcaa90b37172c62af80a;hpb=b7311fbcbd77f615266a039613516adb9cea24f1;p=nonrtric.git diff --git a/test/simulator-group/sim-monitor.js b/test/simulator-group/sim-monitor.js index b746ae5d..7a220263 100644 --- a/test/simulator-group/sim-monitor.js +++ b/test/simulator-group/sim-monitor.js @@ -30,6 +30,7 @@ var PRODSTUB_PORT="8092" var http = require('http'); var express = require('express'); +const { POINT_CONVERSION_HYBRID } = require('constants') var app = express(); var fieldSize=32; @@ -68,7 +69,7 @@ function getSimCtr(url, index, cb) { } catch(err) { cb("no response", index); } -}; +} //Format a comma separated list of data to a html-safe string with fixed fieldsizes @@ -120,9 +121,9 @@ function formatIdRowCompact(commaList) { } //Pad a string upto a certain size using a pad string -function padding(val, fieldSize, pad) { +function padding(val, size, pad) { var s=""+val; - for(var i=s.length;i { + + if (checkFunctionFlag("cr_stat")) { + getSimCtr(LOCALHOST+CR_PORT+"/db", 0, function(data, index) { + try { + cr_db=JSON.parse(data); + } + catch (err) { + cr_db={} + } + }); + clearFlag("cr_stat") + } + fetchAllMetrics_cr(); + }, 500) +} + +// Monitor for CR db +app.get("/mon3",function(req, res){ + + console.log("Creating CR DB page - timer: " + refreshCount_ecs) + + if (refreshCount_cr < 0) { + refreshCount_cr=5 + fetchAllMetrics_cr() + } + refreshCount_cr=5 + var json_str=JSON.stringify(cr_db, null, 1) + var htmlStr = "" + + "" + + "" + + ""+ //2 sec auto refresh + "CR DB dump"+ + "" + + "" + + json_str + + "" + + ""; + res.send(htmlStr); +}) + // Monitor for ECS app.get("/mon2",function(req, res){ @@ -638,10 +762,13 @@ app.get("/mon2",function(req, res){ "" + "" if (summary == "false") { - htmlStr=htmlStr+"

Set query param '?summary' to true to only show summary statistics

" + htmlStr=htmlStr+"

Set query param '?summary' to true to only show summary statistics.

" } else { htmlStr=htmlStr+"

Set query param '?summary' to false to only show full statistics

" } + if (ecs_job_status.length > 10) { + htmlStr=htmlStr+"
Avoid running the server for large number of producers and/or jobs
" + } htmlStr=htmlStr+"
" + "

Enrichment Coordinator Service

" + "" + @@ -665,24 +792,34 @@ app.get("/mon2",function(req, res){ } } htmlStr=htmlStr+"
"; - for(var i=0;i" + htmlStr=htmlStr+s + } + } + htmlStr=htmlStr+"
"; + for(i=0;i" + s = "Producer status..." + formatDataRow(tmp) + "
" htmlStr=htmlStr+s } } htmlStr=htmlStr+"
"; - for(var i=0;i" + s = padding("Job", 18, ".") + formatDataRow(tmp) + "
" htmlStr=htmlStr+s } } htmlStr=htmlStr+"
"+"
" + "
" } + htmlStr=htmlStr+ "

Producer stub

" + "" + @@ -697,26 +834,26 @@ app.get("/mon2",function(req, res){ "Producer ids:....." + formatDataRow(ps_producers) + "
" + "Type ids:........." + formatDataRow(ps_types) + "
" + "
"; - for(var i=0;i" + s = "Producer types...." + formatDataRow(ps_producer_type_arr[i]) + "
" htmlStr=htmlStr+s } } htmlStr=htmlStr+"
"; - for(var i=0;i" + s = "Producer jobs....." + formatDataRow(ps_producer_jobs_arr[i]) + "
" htmlStr=htmlStr+s } } htmlStr=htmlStr+"
"; - for(var i=0;i" + s = "Producer delivery." + formatDataRow(ps_producer_delivery_arr[i]) + "
" htmlStr=htmlStr+s } } @@ -831,4 +968,5 @@ var httpPort=9999; httpServer.listen(httpPort); console.log("Simulator monitor listening (http) at "+httpPort); console.log("Open the web page on localhost:9999/mon to view the policy statistics page.") -console.log("Open the web page on localhost:9999/mon2 to view the enrichment statistics page.") \ No newline at end of file +console.log("Open the web page on localhost:9999/mon2 to view the enrichment statistics page.") +console.log("Open the web page on localhost:9999/mon3 to view CR DB in json.") \ No newline at end of file