+ "<font size=\"-3\" face=\"summary\">"
+ if (summary == "false") {
+ htmlStr=htmlStr+"<p>Set query param '?summary' to true to only show summary statistics.</p>"
+ } else {
+ htmlStr=htmlStr+"<p>Set query param '?summary' to false to only show full statistics</p>"
+ }
+ if (ecs_job_status.length > 10) {
+ htmlStr=htmlStr+"<div style=\"color:red\"> Avoid running the server for large number of producers and/or jobs</div>"
+ }
+ htmlStr=htmlStr+"</font>" +
+ "<h3>Enrichment Coordinator Service</h3>" +
+ "<font face=\"monospace\">" +
+ "Status:..........." + formatDataRow(ecs1) + "<br>" +
+ "Producers:........" + formatDataRow(ecs2) + "<br>" +
+ "Types:............" + formatDataRow(ecs3) + "<br>" +
+ "Jobs:............." + formatDataRow(ecs4) + "<br>" +
+ "</font>"
+ if (summary == "false") {
+ htmlStr=htmlStr+
+ "<h4>Details</h4>" +
+ "<font face=\"monospace\">" +
+ "Producer ids:....." + formatDataRow(ecs_producers) + "<br>" +
+ "Type ids:........." + formatDataRow(ecs_types) + "<br>" +
+ "<br>";
+ for(var i=0;i<ecs_producer_type_arr.length;i++) {
+ var tmp=ecs_producer_type_arr[i]
+ if (tmp != undefined) {
+ var s = "Producer types...." + formatDataRow(ecs_producer_type_arr[i]) + "<br>"
+ htmlStr=htmlStr+s
+ }
+ }
+ htmlStr=htmlStr+"<br>";
+ for(i=0;i<ecs_producer_jobs_arr.length;i++) {
+ tmp=ecs_producer_jobs_arr[i]
+ if (tmp != undefined) {
+ s = "Producer jobs....." + formatDataRow(ecs_producer_jobs_arr[i]) + "<br>"
+ htmlStr=htmlStr+s
+ }
+ }
+ htmlStr=htmlStr+"<br>";
+ for(i=0;i<ecs_producer_status_arr.length;i++) {
+ tmp=ecs_producer_status_arr[i]
+ if (tmp != undefined) {
+ s = "Producer status..." + formatDataRow(tmp) + "<br>"
+ htmlStr=htmlStr+s
+ }
+ }
+ htmlStr=htmlStr+"<br>";
+ for(i=0;i<ecs_job_status.length;i++) {
+ tmp=ecs_job_status[i]
+ if (tmp != undefined) {
+ s = padding("Job", 18, ".") + formatDataRow(tmp) + "<br>"
+ htmlStr=htmlStr+s
+ }
+ }
+ htmlStr=htmlStr+"<br>"+"<br>" +
+ "</font>"
+ }
+
+ htmlStr=htmlStr+
+ "<h3>Producer stub</h3>" +
+ "<font face=\"monospace\">" +
+ "Producers:........" + formatDataRow(ps2) + "<br>" +
+ "Types:............" + formatDataRow(ps3) + "<br>" +
+ "Jobs:............." + formatDataRow(ps4) + "<br>" +
+ "</font>"
+ if (summary == "false") {
+ htmlStr=htmlStr+
+ "<h4>Details</h4>" +
+ "<font face=\"monospace\">" +
+ "Producer ids:....." + formatDataRow(ps_producers) + "<br>" +
+ "Type ids:........." + formatDataRow(ps_types) + "<br>" +
+ "<br>";
+ for(i=0;i<ps_producer_type_arr.length;i++) {
+ tmp=ps_producer_type_arr[i]
+ if (tmp != undefined) {
+ s = "Producer types...." + formatDataRow(ps_producer_type_arr[i]) + "<br>"
+ htmlStr=htmlStr+s
+ }
+ }
+ htmlStr=htmlStr+"<br>";
+ for(i=0;i<ps_producer_jobs_arr.length;i++) {
+ tmp=ps_producer_jobs_arr[i]
+ if (tmp != undefined) {
+ s = "Producer jobs....." + formatDataRow(ps_producer_jobs_arr[i]) + "<br>"
+ htmlStr=htmlStr+s
+ }
+ }
+ htmlStr=htmlStr+"<br>";
+ for(i=0;i<ps_producer_delivery_arr.length;i++) {
+ tmp=ps_producer_delivery_arr[i]
+ if (tmp != undefined) {
+ s = "Producer delivery." + formatDataRow(ps_producer_delivery_arr[i]) + "<br>"
+ htmlStr=htmlStr+s
+ }
+ }
+ }
+ htmlStr=htmlStr+
+ "</font>" +
+ "</body>" +
+ "</html>";
+ res.send(htmlStr);
+})
+
+// Monitor for policy management
+app.get("/mon",function(req, res){
+
+ console.log("Creating policy metrics page " + refreshCount_pol)
+
+ if (refreshCount_pol < 0) {
+ refreshCount_pol=5
+ fetchAllMetrics_pol()
+ }
+ refreshCount_pol=5
+
+ if (refreshCount_rc < 0) {
+ refreshCount_rc=5
+ fetchAllMetrics_rc()
+ }
+ refreshCount_rc=5
+
+ var bn=req.query.basename
+ pmsprefix=req.query.pmsprefix
+
+ console.log("PMS"+pmsprefix)
+ if ((bn == undefined) || (pmsprefix == undefined)) {
+ getCtr=0
+ return res.redirect('/mon?basename=ricsim&pmsprefix=/a1-policy/v2');
+ } else {
+ ricbasename=bn
+ }
+
+
+ //Build web page
+ var htmlStr = "<!DOCTYPE html>" +
+ "<html>" +
+ "<head>" +
+ "<meta http-equiv=\"refresh\" content=\"2\">"+ //2 sec auto refresh
+ "<title>Policy Management Service and simulator monitor</title>"+
+ "</head>" +
+ "<body>" +
+ "<font size=\"-3\" face=\"monospace\">" +
+ "<p>Change basename in url if other ric sim prefix is used</p>" +
+ "<p>Change pmsprefix in url if pms with other prefix is used</p>" +
+ "</font>" +
+ "<h3>Policy Management Service</h3>" +