Commit a4be1d68 a4be1d681d1fce7e7992d3b2a73e928120847e59 by Christian Gerdes

New features;

-Block resets data to zero values
-Auto-reset on 3 consecutive failures
-Auto-block on 10 consecutive failures
-%CPU and Logical IO on OraMonWeb overview for each monitor, sortable
1 parent e28383d8
......@@ -98,7 +98,7 @@ function dataHandler() {
}
</script>
<h1>OraMon Web 1.1 with JmxMon</h1>
<h1>OraMon Web 1.2</h1>
<h2>Status Oracle Monitors</h2>
<p>Number of monitors: <%= se.lil.om.Registry.getList().size() %></p>
......@@ -117,6 +117,8 @@ function dataHandler() {
<th>Name</th>
<th>Instance</th>
<th>Connection String</th>
<th>%CPU</th>
<th>Logical IO/s</th>
<th>Data Calls</th>
<th>Success</th>
<th>Failed</th>
......@@ -127,10 +129,13 @@ function dataHandler() {
<th>Action</th>
</tr>
<% for (OraMon mon : se.lil.om.Registry.getList()) { %>
<% Double cpu=0D; Double lio=0D; try {cpu=mon.getCPUPercent();} catch(Throwable t) {} try {lio=mon.getLogicalReadsPerSecond();} catch(Throwable t) {} %>
<tr>
<td><%= mon.getFriendlyName() %></td>
<td><%= mon.getDBName() %></td>
<td><%= mon.getConString() %></td>
<td><%= String.format("%.2f", cpu) %></td>
<td><%= String.format("%.2f", lio) %></td>
<td><%= mon.getDataCalled() %></td>
<td><%= mon.getDataSucceeded() %></td>
<td><%= mon.getDataFailed() %></td>
......
......@@ -26,6 +26,7 @@ public class OraMon {
int getDataCalls = 0;
int getDataSucess = 0;
int getDataBadirad = 0;
boolean getPdbs = false;
Collector colPdbSysStat = null;
......@@ -39,6 +40,11 @@ public class OraMon {
public void setBlockedState(Boolean blockedState) {
this.blocked = blockedState;
if(this.blocked) {
reset();
try {conn.close();}
catch (Exception e) {}
}
}
public boolean getBlockedState() {
......@@ -108,6 +114,7 @@ public class OraMon {
LongDelta cpuTime = new LongDelta("cpuTime");
LongDelta niwTime = new LongDelta("niwTime");
public double getCPUPercent(boolean excludeNonIdleWaitTime, String pdbName) throws Throwable {
if(numCpus < 1) return 0D;
double cpuPerSec;
if(pdbName == null) cpuPerSec = cpuTime.getPerSecondValue();
else cpuPerSec = colPdbCPU.getPerSecValue(pdbName + strCpuTime);
......@@ -234,6 +241,7 @@ public class OraMon {
}
public double getOsLoadPerCPU() throws Throwable {
if(this.numCpus < 1) return 0D;
double num = this.numCpus;
double load = getOsLoad();
return load / num;
......@@ -334,9 +342,25 @@ public class OraMon {
Lock lock = new ReentrantLock();
Throwable lastEx = null;
public void reset() {
colSysStat = new Collector("colSysStat");
colOsStat = new Collector("colOsStat");
colPdbSysStat = null;
colPdbCPU = null;
pdbSet = null;
cpuTime = new LongDelta("cpuTime");
niwTime = new LongDelta("niwTime");
osLoad = new DoubleDelta();
numCpus = 0;
}
public boolean getData(long ageTs, String pdbName) throws Throwable {
//Check if we are blocked. If we are, just return with false telling the caller we did not update.
if(this.blocked) return false;
if(this.blocked) {
// Reset all data
reset();
return false;
}
//Check age (unless pdbName was set for the first time, in that case we need to discard the cached data)
if(getPdbs == false && pdbName != null) {
......@@ -442,8 +466,10 @@ public class OraMon {
getDataSucess++;
lastFetchTSns = System.nanoTime();
lastRTns = lastFetchTSns - startTSns;
getDataBadirad = 0;
return true;
} catch (Throwable e) {
getDataBadirad += 1;
Throwable lastCause = e.getCause();
Throwable thisCause = e;
while(lastCause != null) { thisCause = lastCause; lastCause = thisCause.getCause(); }
......@@ -457,6 +483,8 @@ public class OraMon {
}
lastFetchTSns = System.nanoTime();
lastRTns = lastFetchTSns - startTSns;
if(getDataBadirad >= 3) reset();
if(getDataBadirad >=10) setBlockedState(true);
throw (e);
} finally {
lock.unlock();
......