<%@page import="java.net.URLEncoder"%> <%@page import="se.lil.om.Registry"%> <%@page import="se.lil.om.OraMon"%> <%@page import="se.lil.jm.JmxMon"%> <%@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>OraMon Admin</title> </head> <body> <% // Handling of actions boolean error = false; String errMsg = ""; boolean info = false; String infMsg = ""; if(request.getParameter("action") != null) { if(request.getParameter("action").equals("remove")) { if(request.getParameter("omconstr") != null && request.getParameter("omconstr").length() != 0) { se.lil.om.Registry.remove(request.getParameter("omconstr")); info = true; infMsg = "Removed OraMon " + request.getParameter("omconstr"); } if(request.getParameter("jmconstr") != null && request.getParameter("jmconstr").length() != 0) { se.lil.jm.Registry.remove(request.getParameter("jmconstr")); info = true; infMsg = "Removed JmxMon " + request.getParameter("jmconstr"); } } } %> <% if(error) { %> <div style="background: Salmon; padding: 10px;">Error: <%= errMsg %></div> <% } %> <% if(info) { %> <div style="background: Aquamarine; padding: 10px;">Info: <%= infMsg %> <form><input type="submit" value="OK"></form></div> <% } %> <script type="text/javascript"> function getData(type, input) { // Update the data var client1 = new XMLHttpRequest(); client1.onreadystatechange = dataHandler; client1.open("GET", "/" + type + "/getData?age=14&connectionString=" + encodeURIComponent(input)); client1.setRequestHeader('Cache-Control', 'no-cache'); client1.setRequestHeader('Pragma', 'no-cache'); client1.send(); } function getMetrics(type, input) { // Get the metrics var client2 = new XMLHttpRequest(); client2.onreadystatechange = metricsHandler; client2.open("GET", "/" + type + "/getMetrics?connectionString=" + encodeURIComponent(input)); client2.setRequestHeader('Cache-Control', 'no-cache'); client2.setRequestHeader('Pragma', 'no-cache'); client2.send(); } function metricsHandler() { if (this.readyState == 4) { window.alert("HTTP " + this.status + "\n\n" + this.responseText); } } function dataHandler() { if (this.readyState == 4) { window.alert("HTTP " + this.status + "\n\n" + this.responseText); } } </script> <h1>OraMon Web 1.1 with JmxMon</h1> <h2>Status Oracle Monitors</h2> <p>Number of monitors: <%= se.lil.om.Registry.getList().size() %></p> <div title="Add Monitor" style="background: WhiteSmoke; padding: 10px;"> <form> <table> <tr><td>Connection String:</td><td><input id="addoradata" name="data" size="70"></td><td><input type="button" value="add" onClick="getData('OraMonREST', addoradata.value)"></td></tr> </table> </form> </div> <div style="background-color: LightSteelBlue; padding: 10px;"> <table> <tr> <th>Name</th> <th>Connection String</th> <th>Data Calls</th> <th>Success</th> <th>Failed</th> <th>Last Exception</th> <th>Age</th> <th>RT</th> <th>Action</th> </tr> <% for (OraMon mon : se.lil.om.Registry.getList()) { %> <tr> <td><%= mon.getDBName() %></td> <td><%= mon.getConString() %></td> <td><%= mon.getDataCalled() %></td> <td><%= mon.getDataSucceeded() %></td> <td><%= mon.getDataFailed() %></td> <td><%= mon.getLastEx() %></td> <td><%= mon.getAgeTs() %>s</td> <td><%= mon.getLastRTms() %>ms</td> <td> <form method="POST"> <input type="submit" name="action" value="remove" > <input type="hidden" name="omconstr" value="<%= mon.getConString() %>"> <input type="button" value="graph" onClick="window.open('/viewOraMon.html?<%= URLEncoder.encode(mon.getConString(), "UTF-8") %>')"> <input id="getDataButton" type="button" value="getData" onClick="getData('OraMonREST', '<%= mon.getConString() %>')"> <input id="getMetricsButton" type="button" value="getMetrics" onClick="getMetrics('OraMonREST', '<%= mon.getConString() %>')"> </form> </td> </tr> <% } %> </table> </div> <h2>Status JMX Monitors</h2> <p>Number of monitors: <%= se.lil.jm.Registry.getList().size() %></p> <div title="Add Monitor" style="background: WhiteSmoke; padding: 10px;"> <form> <table> <tr><td>Connection String:</td><td><input id="addjmxdata" name="data" size="70"></td><td><input type="button" value="add" onClick="getData('JmxMonREST', addjmxdata.value)"></td></tr> </table> </form> </div> <div style="background-color: LightSteelBlue; padding: 10px;"> <table> <tr> <th>Name</th> <th>Connection String</th> <th>Data Calls</th> <th>Success</th> <th>Failed</th> <th>Last Exception</th> <th>Age</th> <th>RT</th> <th>Action</th> </tr> <% for (JmxMon mon : se.lil.jm.Registry.getList()) { %> <tr> <td><%= mon.getServerName() %></td> <td><%= mon.getConString() %></td> <td><%= mon.getDataCalled() %></td> <td><%= mon.getDataSucceeded() %></td> <td><%= mon.getDataFailed() %></td> <td><%= mon.getLastEx() %></td> <td><%= mon.getAgeTs() %>s</td> <td><%= mon.getLastRTms() %>ms</td> <td> <form method="POST"> <input type="submit" name="action" value="remove" > <input type="hidden" name="jmconstr" value="<%= mon.getConString() %>"> <input type="button" value="graph" onClick="window.open('/viewJmxMon.html?<%= URLEncoder.encode(mon.getConString(), "UTF-8") %>')"> <input type="button" value="getData" onClick="getData('JmxMonREST', '<%= mon.getConString() %>')"> <input type="button" value="getMetrics" onClick="getMetrics('JmxMonREST', '<%= mon.getConString() %>')"> </form> </td> </tr> <% } %> </table> </div> </body> </html>