Commit 2141767f 2141767f01f49b0b8ac4fafd4dc11adbdf8fdc12 by Christian Gerdes

Stöd för att köras direkt från Eclipse med en Tomcat 7

Viss debug och loggning av negativa värden, se Notes.md
1 parent 34b74092
......@@ -3,6 +3,8 @@
<name>JavaMonWeb</name>
<comment></comment>
<projects>
<project>LILJM Library</project>
<project>LILOM Library</project>
</projects>
<buildSpec>
<buildCommand>
......
......@@ -49,7 +49,7 @@ function getData(type, input, pdb) {
if(pdb != "" && pdb != null) pdbAdd = "&pdbName=" + pdb;
var client1 = new XMLHttpRequest();
client1.onreadystatechange = dataHandler;
client1.open("GET", "/" + type + "/getData?age=14" + pdbAdd + "&connectionString=" + encodeURIComponent(input));
client1.open("GET", "" + type + "/getData?age=14" + pdbAdd + "&connectionString=" + encodeURIComponent(input));
client1.setRequestHeader('Cache-Control', 'no-cache');
client1.setRequestHeader('Pragma', 'no-cache');
client1.send();
......@@ -61,12 +61,19 @@ function getMetrics(type, input, pdb) {
if(pdb != "" && pdb != null) pdbAdd = "pdbName=" + pdb + "&";
var client2 = new XMLHttpRequest();
client2.onreadystatechange = metricsHandler;
client2.open("GET", "/" + type + "/getMetrics?" + pdbAdd + "connectionString=" + encodeURIComponent(input));
client2.open("GET", "" + type + "/getMetrics?" + pdbAdd + "connectionString=" + encodeURIComponent(input));
client2.setRequestHeader('Cache-Control', 'no-cache');
client2.setRequestHeader('Pragma', 'no-cache');
client2.send();
}
function showGraph(type, input, pdb) {
// Get the metrics
var pdbAdd = "";
if(pdb != "" && pdb != null) pdbAdd = "&pdbName=" + pdb + "";
window.open(type + '.html?' + input + pdbAdd);
}
function metricsHandler() {
if (this.readyState == 4) {
window.alert("HTTP " + this.status + "\n\n" + this.responseText);
......@@ -120,7 +127,7 @@ function dataHandler() {
<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 type="button" value="graph" onClick="showGraph('viewOraMon','<%= URLEncoder.encode(mon.getConString(), "UTF-8") %>',this.form.pdbName.value)">
<input id="getDataButton" type="button" value="getData" onClick="getData('OraMonREST', '<%= mon.getConString() %>',this.form.pdbName.value)">
<input id="getMetricsButton" type="button" value="getMetrics" onClick="getMetrics('OraMonREST', '<%= mon.getConString() %>',this.form.pdbName.value)">
<input id="pdbName" name="pdbName" size="10">
......
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>JavaMonWeb</display-name>
<welcome-file-list>
<welcome-file>OraMon.jsp</welcome-file>
</welcome-file-list>
</web-app>
\ No newline at end of file
......@@ -90,7 +90,7 @@
statusP.innerHTML = "Updating...";
var client1 = new XMLHttpRequest();
client1.onreadystatechange = handler1;
client1.open("GET", "/JmxMonREST/getData?age=14&connectionString=" + location.search.substring(1));
client1.open("GET", "JmxMonREST/getData?age=14&connectionString=" + location.search.substring(1));
client1.setRequestHeader('Cache-Control', 'no-cache');
client1.setRequestHeader('Pragma', 'no-cache');
client1.send();
......@@ -106,7 +106,7 @@
// Get the metrics
var client2 = new XMLHttpRequest();
client2.onreadystatechange = handler2;
client2.open("GET", "/JmxMonREST/getMetrics?connectionString=" + location.search.substring(1));
client2.open("GET", "JmxMonREST/getMetrics?connectionString=" + location.search.substring(1));
client2.setRequestHeader('Cache-Control', 'no-cache');
client2.setRequestHeader('Pragma', 'no-cache');
client2.send();
......
......@@ -90,7 +90,7 @@
statusP.innerHTML = "Updating...";
var client1 = new XMLHttpRequest();
client1.onreadystatechange = handler1;
client1.open("GET", "/OraMonREST/getData?age=14&connectionString=" + location.search.substring(1));
client1.open("GET", "OraMonREST/getData?age=14&connectionString=" + location.search.substring(1));
client1.setRequestHeader('Cache-Control', 'no-cache');
client1.setRequestHeader('Pragma', 'no-cache');
client1.send();
......@@ -106,7 +106,7 @@
// Get the metrics
var client2 = new XMLHttpRequest();
client2.onreadystatechange = handler2;
client2.open("GET", "/OraMonREST/getMetrics?connectionString=" + location.search.substring(1));
client2.open("GET", "OraMonREST/getMetrics?connectionString=" + location.search.substring(1));
client2.setRequestHeader('Cache-Control', 'no-cache');
client2.setRequestHeader('Pragma', 'no-cache');
client2.send();
......
......@@ -59,4 +59,10 @@ Här känns alla värden rätt. Får göra klart GUI bitarna och se hur monitore
När jag kört ett tag i graph läget nu på en PDB via CDB, ser jag även konstiga värden på mycket annat. Cache Hit Ratio på 1200%, negativa värden på flera räknare, mm.
GUI delarna lirar inte riktigt heller, getMetrics ger en 500 och en NullPointer (beror på att pdbName skickas alltid, null om den inte ska användas, och det funkar
inte i alla metoder i OraMon.java klassen). Anger man en PDB i OraMon.jsp så blir det HTTP 0 status?? på getData och getMetrics knapparna.
\ No newline at end of file
inte i alla metoder i OraMon.java klassen). Anger man en PDB i OraMon.jsp så blir det HTTP 0 status?? på getData och getMetrics knapparna.
2018-05-02
Lyckades köra JavaMonWeb i Debug läge med Tomcat 7 local server. Skapade en sanityCheck() metod med break points så jag kan debugga när vissa räknare blir negativa.
Dock svårt att hitta rätt LongDelta objekt, eftersom det finns över 1000 i listan i random ordning. Behöver spara undan det nånstans eller breaka inne i en LongDelta metod istället.
Checkar in detta i alla fall så länge.
......
......@@ -5,10 +5,12 @@ import java.util.HashSet;
import java.util.Properties;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class OraMon {
private final static Logger LOGGER = Logger.getLogger(OraMon.class.getName());
Connection conn = null;
String conString = "jdbc:oracle:thin:@//hostname:1521/SID";
String conUser = "system";
......@@ -424,6 +426,9 @@ public class OraMon {
}
stmt.close();
sanityCheck(pdbName);
getDataSucess++;
lastFetchTSns = System.nanoTime();
lastRTns = lastFetchTSns - startTSns;
......@@ -447,6 +452,30 @@ public class OraMon {
// End thread safe
}
public void sanityCheck(String pdbName) throws Throwable {
String prefix = getFriendlyName(pdbName);
if(getBufferCacheHitRatioPercent(pdbName) < 0)
LOGGER.warning(prefix + " getBufferCacheHitRatioPercent" + " has negative delta");
if(getLogicalReadsPerSecond(pdbName) < 0)
LOGGER.warning(prefix + " getLogicalReadsPerSecond" + " has negative delta");
if(getCPUTimePerSecond(pdbName) < 0)
LOGGER.warning(prefix + " getCPUTimePerSecond" + " has negative delta");
if(getCacheHitRatioPercent(pdbName) < 0)
LOGGER.warning(prefix + " getCacheHitRatioPercent" + " has negative delta");
if(getCPUTimePerSecond(pdbName) < 0)
LOGGER.warning(prefix + " getCPUTimePerSecond" + " has negative delta");
if(getPerSecondValue("execute count",pdbName) < 0)
LOGGER.warning(prefix + " getPerSecondValue(execute count)" + " has negative delta");
if(getPerSecondValue("consistent gets",pdbName) < 0)
LOGGER.warning(prefix + " getPerSecondValue(consistent gets)" + " has negative delta");
if(getPerSecondValue("physical reads",pdbName) < 0)
LOGGER.warning(prefix + " getPerSecondValue(physical reads)" + " has negative delta");
if(getPerSecondValue("non-idle wait time",pdbName) < 0)
LOGGER.warning(prefix + " getPerSecondValue(non-idle wait time)" + " has negative delta");
if(getPerSecondValue("user commits",pdbName) < 0)
LOGGER.warning(prefix + " getPerSecondValue(user commits)" + " has negative delta");
}
public Throwable getLastEx() {
return lastEx;
}
......