X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fsimulator-group%2Fsim-monitor.js;h=e118e1751ef45ad0b50039bf0722b330b4d7fef7;hb=8cffee5976e66653c08f55abfe59663ecfd44f66;hp=7d7ffdf80533bc1c381417b3ae61b07944fe468c;hpb=49f0e5ab01b51aee8713a17aed86cd6d229b40cc;p=nonrtric.git diff --git a/test/simulator-group/sim-monitor.js b/test/simulator-group/sim-monitor.js index 7d7ffdf8..e118e175 100644 --- a/test/simulator-group/sim-monitor.js +++ b/test/simulator-group/sim-monitor.js @@ -26,6 +26,7 @@ var AGENT_PORT="8081" var CR_PORT="8090" var ECS_PORT="8083" var PRODSTUB_PORT="8092" +var RC_PORT="8680" var http = require('http'); @@ -69,7 +70,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 @@ -121,9 +122,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\' -f1 | sed \'s/[[-]]*$//\'', (err, stdout, stderr) => { + exec('docker ps --filter "name='+ricbasename+'" --filter "network=nonrtric-docker-net" --format "{{.Names}} {{.Ports}}" | sed s/0.0.0.0:// | cut -d \'>\' -f1 | sed \'s/[[-]]*$//\'', (err, stdout, stderr) => { var simulators = "" simulators=`${stdout}`.replace(/(\r\n|\n|\r)/gm," "); @@ -235,7 +244,7 @@ function fetchAllMetrics_pol() { var sims=simulators.split(" ") simnames=[] simports=[] - for(i=0;i { + + if (checkFunctionFlag("rc_stat")) { + getSimCtr(LOCALHOST+RC_PORT+"/services", 0, function(data, index) { + var tmp_serv="" + try { + var jd=JSON.parse(data); + for(var i=0;i 0) { + tmp_serv=tmp_serv+"," + } + tmp_serv=tmp_serv+jd[i]["name"] + } + + } + catch (err) { + tmp_serv="no_response" + } + rc_services=tmp_serv + }); + clearFlag("rc_stat") + } + fetchAllMetrics_rc(); + }, 500) +} + // Monitor for CR db app.get("/mon3",function(req, res){ @@ -696,10 +806,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

" + "" + @@ -723,24 +836,33 @@ 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

" + "" + @@ -755,26 +877,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 } } @@ -797,27 +919,37 @@ app.get("/mon",function(req, res){ } refreshCount_pol=5 + if (refreshCount_rc < 0) { + refreshCount_rc=5 + fetchAllMetrics_rc() + } + refreshCount_rc=5 + var bn=req.query.basename + pmsprefix=req.query.pmsprefix - if (bn == undefined) { + console.log("PMS"+pmsprefix) + if ((bn == undefined) || (pmsprefix == undefined)) { getCtr=0 - return res.redirect('/mon?basename=ricsim'); + return res.redirect('/mon?basename=ricsim&pmsprefix=/a1-policy/v2'); } else { ricbasename=bn } + //Build web page var htmlStr = "" + "" + "" + ""+ //2 sec auto refresh - "Policy Agent and simulator monitor"+ + "Policy Management Service and simulator monitor"+ "" + "" + "" + "

Change basename in url if other ric sim prefix is used

" + + "

Change pmsprefix in url if pms with other prefix is used

" + "
" + - "

Policy agent

" + + "

Policy Management Service

" + "" + "Status:..............................." + formatDataRow(ag1) + "
" + "Services:............................." + formatIdRowCompact(ag2) + "
" + @@ -834,13 +966,17 @@ app.get("/mon",function(req, res){ "Fetched responses.............................." + formatDataRow(mr5) + "
" + "Current responses waiting......................" + formatDataRow(mr6) + "
" + "
"+ - "

Callback receiver

" + + "

Callback|Notification receiver

" + "" + "Callbacks received:..................." + formatDataRow(cr1) + "
" + "Callbacks fetched:...................." + formatDataRow(cr2) + "
" + "Number of waiting callback messages:.." + formatDataRow(cr3) + "
" + "
" + - "

Near-RT RIC Simulators

" + + "

R-APP Catalogue

" + + "" + + "Services:............................." + formatIdRowCompact(rc_services) + "
" + + "
" + + "

Near-RT RIC | A1 Simulators

" + "" htmlStr=htmlStr+padding("Near-RT RIC Simulator name", 35," ")