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() { ...@@ -98,7 +98,7 @@ function dataHandler() {
98 } 98 }
99 </script> 99 </script>
100 100
101 <h1>OraMon Web 1.1 with JmxMon</h1> 101 <h1>OraMon Web 1.2</h1>
102 102
103 <h2>Status Oracle Monitors</h2> 103 <h2>Status Oracle Monitors</h2>
104 <p>Number of monitors: <%= se.lil.om.Registry.getList().size() %></p> 104 <p>Number of monitors: <%= se.lil.om.Registry.getList().size() %></p>
...@@ -117,6 +117,8 @@ function dataHandler() { ...@@ -117,6 +117,8 @@ function dataHandler() {
117 <th>Name</th> 117 <th>Name</th>
118 <th>Instance</th> 118 <th>Instance</th>
119 <th>Connection String</th> 119 <th>Connection String</th>
120 <th>%CPU</th>
121 <th>Logical IO/s</th>
120 <th>Data Calls</th> 122 <th>Data Calls</th>
121 <th>Success</th> 123 <th>Success</th>
122 <th>Failed</th> 124 <th>Failed</th>
...@@ -127,10 +129,13 @@ function dataHandler() { ...@@ -127,10 +129,13 @@ function dataHandler() {
127 <th>Action</th> 129 <th>Action</th>
128 </tr> 130 </tr>
129 <% for (OraMon mon : se.lil.om.Registry.getList()) { %> 131 <% for (OraMon mon : se.lil.om.Registry.getList()) { %>
132 <% Double cpu=0D; Double lio=0D; try {cpu=mon.getCPUPercent();} catch(Throwable t) {} try {lio=mon.getLogicalReadsPerSecond();} catch(Throwable t) {} %>
130 <tr> 133 <tr>
131 <td><%= mon.getFriendlyName() %></td> 134 <td><%= mon.getFriendlyName() %></td>
132 <td><%= mon.getDBName() %></td> 135 <td><%= mon.getDBName() %></td>
133 <td><%= mon.getConString() %></td> 136 <td><%= mon.getConString() %></td>
137 <td><%= String.format("%.2f", cpu) %></td>
138 <td><%= String.format("%.2f", lio) %></td>
134 <td><%= mon.getDataCalled() %></td> 139 <td><%= mon.getDataCalled() %></td>
135 <td><%= mon.getDataSucceeded() %></td> 140 <td><%= mon.getDataSucceeded() %></td>
136 <td><%= mon.getDataFailed() %></td> 141 <td><%= mon.getDataFailed() %></td>
......
...@@ -26,6 +26,7 @@ public class OraMon { ...@@ -26,6 +26,7 @@ public class OraMon {
26 26
27 int getDataCalls = 0; 27 int getDataCalls = 0;
28 int getDataSucess = 0; 28 int getDataSucess = 0;
29 int getDataBadirad = 0;
29 30
30 boolean getPdbs = false; 31 boolean getPdbs = false;
31 Collector colPdbSysStat = null; 32 Collector colPdbSysStat = null;
...@@ -39,6 +40,11 @@ public class OraMon { ...@@ -39,6 +40,11 @@ public class OraMon {
39 40
40 public void setBlockedState(Boolean blockedState) { 41 public void setBlockedState(Boolean blockedState) {
41 this.blocked = blockedState; 42 this.blocked = blockedState;
43 if(this.blocked) {
44 reset();
45 try {conn.close();}
46 catch (Exception e) {}
47 }
42 } 48 }
43 49
44 public boolean getBlockedState() { 50 public boolean getBlockedState() {
...@@ -108,6 +114,7 @@ public class OraMon { ...@@ -108,6 +114,7 @@ public class OraMon {
108 LongDelta cpuTime = new LongDelta("cpuTime"); 114 LongDelta cpuTime = new LongDelta("cpuTime");
109 LongDelta niwTime = new LongDelta("niwTime"); 115 LongDelta niwTime = new LongDelta("niwTime");
110 public double getCPUPercent(boolean excludeNonIdleWaitTime, String pdbName) throws Throwable { 116 public double getCPUPercent(boolean excludeNonIdleWaitTime, String pdbName) throws Throwable {
117 if(numCpus < 1) return 0D;
111 double cpuPerSec; 118 double cpuPerSec;
112 if(pdbName == null) cpuPerSec = cpuTime.getPerSecondValue(); 119 if(pdbName == null) cpuPerSec = cpuTime.getPerSecondValue();
113 else cpuPerSec = colPdbCPU.getPerSecValue(pdbName + strCpuTime); 120 else cpuPerSec = colPdbCPU.getPerSecValue(pdbName + strCpuTime);
...@@ -234,6 +241,7 @@ public class OraMon { ...@@ -234,6 +241,7 @@ public class OraMon {
234 } 241 }
235 242
236 public double getOsLoadPerCPU() throws Throwable { 243 public double getOsLoadPerCPU() throws Throwable {
244 if(this.numCpus < 1) return 0D;
237 double num = this.numCpus; 245 double num = this.numCpus;
238 double load = getOsLoad(); 246 double load = getOsLoad();
239 return load / num; 247 return load / num;
...@@ -334,9 +342,25 @@ public class OraMon { ...@@ -334,9 +342,25 @@ public class OraMon {
334 Lock lock = new ReentrantLock(); 342 Lock lock = new ReentrantLock();
335 Throwable lastEx = null; 343 Throwable lastEx = null;
336 344
345 public void reset() {
346 colSysStat = new Collector("colSysStat");
347 colOsStat = new Collector("colOsStat");
348 colPdbSysStat = null;
349 colPdbCPU = null;
350 pdbSet = null;
351 cpuTime = new LongDelta("cpuTime");
352 niwTime = new LongDelta("niwTime");
353 osLoad = new DoubleDelta();
354 numCpus = 0;
355 }
356
337 public boolean getData(long ageTs, String pdbName) throws Throwable { 357 public boolean getData(long ageTs, String pdbName) throws Throwable {
338 //Check if we are blocked. If we are, just return with false telling the caller we did not update. 358 //Check if we are blocked. If we are, just return with false telling the caller we did not update.
339 if(this.blocked) return false; 359 if(this.blocked) {
360 // Reset all data
361 reset();
362 return false;
363 }
340 364
341 //Check age (unless pdbName was set for the first time, in that case we need to discard the cached data) 365 //Check age (unless pdbName was set for the first time, in that case we need to discard the cached data)
342 if(getPdbs == false && pdbName != null) { 366 if(getPdbs == false && pdbName != null) {
...@@ -442,8 +466,10 @@ public class OraMon { ...@@ -442,8 +466,10 @@ public class OraMon {
442 getDataSucess++; 466 getDataSucess++;
443 lastFetchTSns = System.nanoTime(); 467 lastFetchTSns = System.nanoTime();
444 lastRTns = lastFetchTSns - startTSns; 468 lastRTns = lastFetchTSns - startTSns;
469 getDataBadirad = 0;
445 return true; 470 return true;
446 } catch (Throwable e) { 471 } catch (Throwable e) {
472 getDataBadirad += 1;
447 Throwable lastCause = e.getCause(); 473 Throwable lastCause = e.getCause();
448 Throwable thisCause = e; 474 Throwable thisCause = e;
449 while(lastCause != null) { thisCause = lastCause; lastCause = thisCause.getCause(); } 475 while(lastCause != null) { thisCause = lastCause; lastCause = thisCause.getCause(); }
...@@ -457,6 +483,8 @@ public class OraMon { ...@@ -457,6 +483,8 @@ public class OraMon {
457 } 483 }
458 lastFetchTSns = System.nanoTime(); 484 lastFetchTSns = System.nanoTime();
459 lastRTns = lastFetchTSns - startTSns; 485 lastRTns = lastFetchTSns - startTSns;
486 if(getDataBadirad >= 3) reset();
487 if(getDataBadirad >=10) setBlockedState(true);
460 throw (e); 488 throw (e);
461 } finally { 489 } finally {
462 lock.unlock(); 490 lock.unlock();
......