Fungerande viewJmxMon.html
Lagt till view knapp för denna i OraMon.jsp
Showing
5 changed files
with
113 additions
and
60 deletions
1 | <%@page import="java.net.URLEncoder"%> | ||
1 | <%@page import="se.lil.om.Registry"%> | 2 | <%@page import="se.lil.om.Registry"%> |
2 | <%@page import="se.lil.om.OraMon"%> | 3 | <%@page import="se.lil.om.OraMon"%> |
3 | <%@page import="se.lil.jm.JmxMon"%> | 4 | <%@page import="se.lil.jm.JmxMon"%> |
... | @@ -70,7 +71,13 @@ if(request.getParameter("action") != null) { | ... | @@ -70,7 +71,13 @@ if(request.getParameter("action") != null) { |
70 | <td><%= mon.getLastEx() %></td> | 71 | <td><%= mon.getLastEx() %></td> |
71 | <td><%= mon.getAgeTs() %>s</td> | 72 | <td><%= mon.getAgeTs() %>s</td> |
72 | <td><%= mon.getLastRTms() %>ms</td> | 73 | <td><%= mon.getLastRTms() %>ms</td> |
73 | <td><form method="POST"><input type="submit" name="action" value="remove" ><input type="hidden" name="omconstr" value="<%= mon.getConString() %>"></form></td> | 74 | <td> |
75 | <form method="POST"> | ||
76 | <input type="submit" name="action" value="remove" > | ||
77 | <input type="hidden" name="omconstr" value="<%= mon.getConString() %>"> | ||
78 | <input type="button" value="view" onClick="window.open('/viewOraMon.html?<%= URLEncoder.encode(mon.getConString(), "UTF-8") %>')"> | ||
79 | </form> | ||
80 | </td> | ||
74 | </tr> | 81 | </tr> |
75 | <% } %> | 82 | <% } %> |
76 | </table> | 83 | </table> |
... | @@ -103,7 +110,13 @@ if(request.getParameter("action") != null) { | ... | @@ -103,7 +110,13 @@ if(request.getParameter("action") != null) { |
103 | <td><%= mon.getLastEx() %></td> | 110 | <td><%= mon.getLastEx() %></td> |
104 | <td><%= mon.getAgeTs() %>s</td> | 111 | <td><%= mon.getAgeTs() %>s</td> |
105 | <td><%= mon.getLastRTms() %>ms</td> | 112 | <td><%= mon.getLastRTms() %>ms</td> |
106 | <td><form method="POST"><input type="submit" name="action" value="remove" ><input type="hidden" name="jmconstr" value="<%= mon.getConString() %>"></form></td> | 113 | <td> |
114 | <form method="POST"> | ||
115 | <input type="submit" name="action" value="remove" > | ||
116 | <input type="hidden" name="jmconstr" value="<%= mon.getConString() %>"> | ||
117 | <input type="button" value="view" onClick="window.open('/viewJmxMon.html?<%= URLEncoder.encode(mon.getConString(), "UTF-8") %>')"> | ||
118 | </form> | ||
119 | </td> | ||
107 | </tr> | 120 | </tr> |
108 | <% } %> | 121 | <% } %> |
109 | </table> | 122 | </table> | ... | ... |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | 1 | <!DOCTYPE html> |
2 | <html> | 2 | <html> |
3 | <head> | 3 | <head> |
4 | <title>LIL JMX Monitor</title> | 4 | <title>LIL JMX Monitor</title> |
5 | <script type="text/javascript" src="https://www.google.com/jsapi"></script> | 5 | <script type="text/javascript" src="https://www.google.com/jsapi"></script> |
6 | </head> | ||
7 | <body> | ||
8 | <h1 id="main_title">LIL JMX Monitor</h1> | ||
9 | <div style="background-color: lightgrey; line-height:1em; min-height:3em;"><p id="statusP">Nothing loaded</p></div> | ||
10 | <div id="main_div"></div> | ||
6 | <script type="text/javascript"> | 11 | <script type="text/javascript"> |
7 | var ac_data = null; | 12 | var ac_data = []; |
8 | var ac_chart = null; | 13 | var ac_chart = []; |
14 | var created = false; | ||
9 | 15 | ||
10 | google.load("visualization", "1", { packages: ["corechart"] }); | 16 | google.load("visualization", "1", { packages: ["corechart"] }); |
11 | google.setOnLoadCallback(getData); | 17 | google.setOnLoadCallback(getData); |
12 | 18 | ||
13 | var ac_options = { | 19 | var ac_options = { |
14 | title: 'Current Real User Activity', | 20 | title: 'Current Activity', |
15 | hAxis: { title: 'Timeline', titleTextStyle: { color: '#333'}, format: 'HH:mm:ss' }, | 21 | hAxis: { title: 'Timeline', titleTextStyle: { color: '#333'}, format: 'HH:mm:ss' }, |
16 | vAxis: { minValue: 0 }, | 22 | vAxis: { }, |
17 | isStacked: false | 23 | isStacked: false, |
24 | legend: { position: 'none' } | ||
18 | }; | 25 | }; |
19 | 26 | ||
20 | function createChart(nvarray) { | 27 | function createChart(nvarray) { |
21 | ac_data = new google.visualization.DataTable(); | ||
22 | |||
23 | ac_data.addColumn('datetime', 'Time'); | ||
24 | |||
25 | for(var i=0; i < nvarray.length; i++) { | 28 | for(var i=0; i < nvarray.length; i++) { |
26 | ac_data.addColumn('number', nvarray[i].name); | 29 | ac_data[i] = new google.visualization.DataTable(); |
30 | ac_data[i].addColumn('datetime', 'Time'); | ||
31 | ac_data[i].addColumn('number', nvarray[i].name); | ||
32 | var newdiv = document.createElement('div'); | ||
33 | newdiv.id = 'ac_div' + i; | ||
34 | main_div.appendChild(newdiv); | ||
35 | ac_chart[i] = new google.visualization.LineChart(newdiv); | ||
27 | } | 36 | } |
28 | 37 | ||
29 | ac_chart = new google.visualization.LineChart(document.getElementById('ac_div')); | 38 | created = true; |
30 | ac_chart.draw(ac_data, ac_options); | ||
31 | |||
32 | } | 39 | } |
33 | 40 | ||
34 | function getData() { | 41 | function getData() { |
35 | var client = new XMLHttpRequest(); | ||
36 | client.onreadystatechange = handler; | ||
37 | if(location.search != '') | 42 | if(location.search != '') |
38 | { | 43 | { |
39 | client.open("GET", "/JmxMonREST/getMetrics?connectionString=" + location.search.substring(1)); | 44 | // Update the data |
40 | client.setRequestHeader('Cache-Control', 'no-cache'); | 45 | statusP.innerHTML = "Calling getData..."; |
41 | client.setRequestHeader('Pragma', 'no-cache'); | 46 | var client1 = new XMLHttpRequest(); |
42 | client.send(); | 47 | client1.onreadystatechange = handler1; |
48 | client1.open("GET", "/JmxMonREST/getData?age=14&connectionString=" + location.search.substring(1)); | ||
49 | client1.setRequestHeader('Cache-Control', 'no-cache'); | ||
50 | client1.setRequestHeader('Pragma', 'no-cache'); | ||
51 | client1.send(); | ||
43 | } else { | 52 | } else { |
44 | // Error, no monitor specified | 53 | // Error, no monitor specified |
45 | ac_div.innerHTML = "<p>No monitor specified in URL QueryString (use ?enter uri encoded con string)</p>"; | 54 | statusP.innerHTML = "No monitor specified in URL QueryString (use ?enter uri encoded con string)"; |
55 | } | ||
56 | } | ||
57 | |||
58 | function getMetrics() { | ||
59 | if(location.search != '') | ||
60 | { | ||
61 | // Get the metrics | ||
62 | statusP.innerHTML += "<br>Calling getMetrics..."; | ||
63 | var client2 = new XMLHttpRequest(); | ||
64 | client2.onreadystatechange = handler2; | ||
65 | client2.open("GET", "/JmxMonREST/getMetrics?connectionString=" + location.search.substring(1)); | ||
66 | client2.setRequestHeader('Cache-Control', 'no-cache'); | ||
67 | client2.setRequestHeader('Pragma', 'no-cache'); | ||
68 | client2.send(); | ||
69 | } else { | ||
70 | // Error, no monitor specified | ||
71 | statusP.innerHTML = "No monitor specified in URL QueryString (use ?enter uri encoded con string)"; | ||
46 | } | 72 | } |
47 | |||
48 | } | 73 | } |
49 | 74 | ||
50 | function handler() { | 75 | function handler1() { |
51 | var cT = new Date(); | 76 | if (this.readyState == 4) { |
77 | if ((this.status == 200 || this.status == 202) && | ||
78 | this.responseText != null) { | ||
79 | var res = eval('(' + this.responseText + ')'); | ||
80 | statusP.innerHTML += " Received 200 OK (ms:" + res.ms + " age:" + res.age + ")<br>" + res.msg; | ||
81 | getMetrics(); | ||
82 | } else { | ||
83 | statusP.innerHTML += " Received responsecode " + this.status; | ||
84 | } | ||
85 | } | ||
86 | } | ||
87 | |||
88 | function handler2() { | ||
52 | if (this.readyState == 4) { | 89 | if (this.readyState == 4) { |
53 | if (this.status == 200 && | 90 | if (this.status == 200 && |
54 | this.responseText != null) { | 91 | this.responseText != null) { |
55 | addData(this.responseText); | 92 | statusP.innerHTML += " Received 200 OK"; |
56 | return; | 93 | var res = eval('(' + this.responseText + ')'); |
94 | addData(res); | ||
95 | } else { | ||
96 | statusP.innerHTML += " Received responsecode " + this.status; | ||
57 | } | 97 | } |
58 | } | 98 | } |
59 | } | 99 | } |
60 | 100 | ||
61 | function addData(data) { | 101 | function addData(res) { |
62 | var res = eval('(' + data + ')'); | 102 | if(res.error == false && res.nvarray.length > 0) { |
63 | 103 | main_title.innerHTML = res.name + " JMX Monitor"; | |
64 | if (ac_data == null) { | 104 | if (created == false) { |
65 | createChart(res.nvarray); | 105 | createChart(res.nvarray); |
106 | } | ||
107 | |||
108 | for(var i=0; i < res.nvarray.length; i++) { | ||
109 | var dataRow = []; | ||
110 | dataRow[0] = new Date(); | ||
111 | dataRow[1] = res.nvarray[i].value; | ||
112 | ac_data[i].addRow(dataRow); | ||
113 | if (ac_data[i].getNumberOfRows() > 1000) ac_data[i].removeRow(0); | ||
114 | ac_options.title = res.nvarray[i].name + ": " + res.nvarray[i].value; | ||
115 | ac_chart[i].draw(ac_data[i], ac_options); | ||
116 | } | ||
66 | } | 117 | } |
67 | |||
68 | var dataRow = []; | ||
69 | dataRow.push(new Date()); | ||
70 | for(var i=0; i < res.nvarray.length; i++) { | ||
71 | dataRow[i+1] = res.nvarray[i].value; | ||
72 | } | ||
73 | |||
74 | if (ac_data.getNumberOfRows() > 1000) ac_data.removeRow(0); | ||
75 | |||
76 | ac_data.addRow(dataRow); | ||
77 | ac_chart.draw(ac_data, ac_options); | ||
78 | 118 | ||
79 | window.setTimeout('getData()', 5000); | 119 | window.setTimeout('getData()', 15000); |
80 | } | 120 | } |
81 | 121 | ||
82 | </script> | 122 | </script> |
83 | </head> | ||
84 | <body> | ||
85 | <h1>LIL JMX Monitor</h1> | ||
86 | <div id="ac_div" style="width: 99%; height: 80%; "></div> | ||
87 | </body> | 123 | </body> |
88 | </html> | 124 | </html> | ... | ... |
No preview for this file type
... | @@ -65,26 +65,30 @@ public class JmxMonRESTgetMetrics extends HttpServlet { | ... | @@ -65,26 +65,30 @@ public class JmxMonRESTgetMetrics extends HttpServlet { |
65 | } | 65 | } |
66 | 66 | ||
67 | // Loop over all monitors and output a Json array with the default set of metrics | 67 | // Loop over all monitors and output a Json array with the default set of metrics |
68 | sb.append("{\"error\":false,\"nvarray\":"); | 68 | sb.append("{\"name\":\"" + mon.getServerName() + "\",\"error\":false,\"nvarray\":"); |
69 | sb.append("["); | 69 | sb.append("["); |
70 | 70 | ||
71 | sb.append("{\"name\":\"Number of processors #\",\"value\":" + mon.getNumberOfCPUs() + "}"); | 71 | sb.append("{\"name\":\"Process CPU Used %\",\"value\":" + mon.getCPUPercent() + "}"); |
72 | sb.append(",{\"name\":\"Process CPU Used %\",\"value\":" + mon.getCPUPercent() + "}"); | 72 | sb.append(",{\"name\":\"Process Heap Used %\",\"value\":" + mon.getHeapUsedPercent() + "}"); |
73 | sb.append(",{\"name\":\"OldGen Used %\",\"value\":" + mon.getOldGenUsedPercent() + "}"); | ||
74 | sb.append(",{\"name\":\"GC Time (Overhead) %\",\"value\":" + mon.getGCOverhead() + "}"); | ||
75 | sb.append(",{\"name\":\"Process File Descriptors %\",\"value\":" + mon.getSystemFileDescriptorsPercentUsed() + "}"); | ||
76 | sb.append(",{\"name\":\"System Memory %\",\"value\":" + mon.getSystemMemoryPercentUsed() + "}"); | ||
77 | sb.append(",{\"name\":\"System Swap %\",\"value\":" + mon.getSystemSwapPercentUsed() + "}"); | ||
73 | sb.append(",{\"name\":\"Process Threads #\",\"value\":" + mon.getThreads() + "}"); | 78 | sb.append(",{\"name\":\"Process Threads #\",\"value\":" + mon.getThreads() + "}"); |
74 | sb.append(",{\"name\":\"Process Loaded Classes #\",\"value\":" + mon.getLoadedClassCount() + "}"); | 79 | sb.append(",{\"name\":\"Process Loaded Classes #\",\"value\":" + mon.getLoadedClassCount() + "}"); |
75 | sb.append(",{\"name\":\"Process File Descriptors %\",\"value\":" + mon.getSystemFileDescriptorsPercentUsed() + "}"); | 80 | |
76 | sb.append(",{\"name\":\"Process Heap Committed MB\",\"value\":" + mon.getHeapCommittedMB() + "}"); | 81 | sb.append(",{\"name\":\"Process Heap Committed MB\",\"value\":" + mon.getHeapCommittedMB() + "}"); |
77 | sb.append(",{\"name\":\"Process Heap Used MB\",\"value\":" + mon.getHeapUsedMB() + "}"); | 82 | sb.append(",{\"name\":\"Process Heap Used MB\",\"value\":" + mon.getHeapUsedMB() + "}"); |
78 | sb.append(",{\"name\":\"Process Heap Used %\",\"value\":" + mon.getHeapUsedPercent() + "}"); | 83 | |
79 | sb.append(",{\"name\":\"OldGen Used MB\",\"value\":" + mon.getOldGenUsedMB() + "}"); | 84 | sb.append(",{\"name\":\"OldGen Used MB\",\"value\":" + mon.getOldGenUsedMB() + "}"); |
80 | sb.append(",{\"name\":\"OldGen Used %\",\"value\":" + mon.getOldGenUsedPercent() + "}"); | 85 | |
81 | sb.append(",{\"name\":\"OldGen After Last GC MB\",\"value\":" + mon.getOldGenAfterGCMB() + "}"); | 86 | sb.append(",{\"name\":\"OldGen After Last GC MB\",\"value\":" + mon.getOldGenAfterGCMB() + "}"); |
82 | sb.append(",{\"name\":\"PermGen After Last GC MB\",\"value\":" + mon.getPermGenAfterGCMB() + "}"); | 87 | sb.append(",{\"name\":\"PermGen After Last GC MB\",\"value\":" + mon.getPermGenAfterGCMB() + "}"); |
83 | sb.append(",{\"name\":\"GC Time (Overhead) %\",\"value\":" + mon.getGCOverhead() + "}"); | 88 | |
84 | sb.append(",{\"name\":\"System Load (per cpu)\",\"value\":" + mon.getAverageLoadPerCpu() + "}"); | 89 | sb.append(",{\"name\":\"System Load (per cpu)\",\"value\":" + mon.getAverageLoadPerCpu() + "}"); |
85 | sb.append(",{\"name\":\"System Load (total)\",\"value\":" + mon.getAverageLoad() + "}"); | 90 | sb.append(",{\"name\":\"System Load (total)\",\"value\":" + mon.getAverageLoad() + "}"); |
86 | sb.append(",{\"name\":\"System Memory %\",\"value\":" + mon.getSystemMemoryPercentUsed() + "}"); | 91 | sb.append(",{\"name\":\"Number of processors #\",\"value\":" + mon.getNumberOfCPUs() + "}"); |
87 | sb.append(",{\"name\":\"System Swap %\",\"value\":" + mon.getSystemSwapPercentUsed() + "}"); | ||
88 | 92 | ||
89 | sb.append("]}"); | 93 | sb.append("]}"); |
90 | 94 | ... | ... |
... | @@ -25,8 +25,8 @@ public class TestRunner { | ... | @@ -25,8 +25,8 @@ public class TestRunner { |
25 | //JmxMon mon1 = new JmxMon("service:jmx:rmi:///jndi/iiop://u30009:2673/weblogic.management.mbeanservers.runtime"); // Fel port | 25 | //JmxMon mon1 = new JmxMon("service:jmx:rmi:///jndi/iiop://u30009:2673/weblogic.management.mbeanservers.runtime"); // Fel port |
26 | //JmxMon mon1 = new JmxMon("service:jmx:rmi:///jndi/iiop://u02878.ht.kap.rsv.se:17040/weblogic.management.mbeanservers.runtime"); // 10.3.6.0.161018.2 PS | 26 | //JmxMon mon1 = new JmxMon("service:jmx:rmi:///jndi/iiop://u02878.ht.kap.rsv.se:17040/weblogic.management.mbeanservers.runtime"); // 10.3.6.0.161018.2 PS |
27 | //JmxMon mon1 = new JmxMon("service:jmx:rmi:///jndi/iiop://u01891.ef.kap.rsv.se:17020/weblogic.management.mbeanservers.runtime"); // 10.3.6.0.161018.2 CMS | 27 | //JmxMon mon1 = new JmxMon("service:jmx:rmi:///jndi/iiop://u01891.ef.kap.rsv.se:17020/weblogic.management.mbeanservers.runtime"); // 10.3.6.0.161018.2 CMS |
28 | //JmxMon mon1 = new JmxMon("service:jmx:rmi:///jndi/iiop://u30450:34502/weblogic.management.mbeanservers.runtime"); // CMS | 28 | JmxMon mon1 = new JmxMon("service:jmx:rmi:///jndi/iiop://u30450:34502/weblogic.management.mbeanservers.runtime"); // CMS |
29 | JmxMon mon1 = new JmxMon("service:jmx:rmi:///jndi/iiop://u30030:28392/weblogic.management.mbeanservers.runtime"); | 29 | //JmxMon mon1 = new JmxMon("service:jmx:rmi:///jndi/iiop://u30030:28392/weblogic.management.mbeanservers.runtime"); |
30 | //mon1.open(); | 30 | //mon1.open(); |
31 | //mon2.open(); | 31 | //mon2.open(); |
32 | jmxList.add(mon1); | 32 | jmxList.add(mon1); | ... | ... |
-
Please register or sign in to post a comment