合并分支 'swy' 到 'master'
Swy 查看合并请求 !8
Showing
1 changed file
with
28 additions
and
5 deletions
@@ -9,6 +9,7 @@ import com.sitech.util.JSONUtil; | @@ -9,6 +9,7 @@ import com.sitech.util.JSONUtil; | ||
9 | import com.sitech.util.upload.RomoteController; | 9 | import com.sitech.util.upload.RomoteController; |
10 | import org.apache.log4j.Logger; | 10 | import org.apache.log4j.Logger; |
11 | 11 | ||
12 | +import java.text.DecimalFormat; | ||
12 | import java.util.ArrayList; | 13 | import java.util.ArrayList; |
13 | import java.util.HashMap; | 14 | import java.util.HashMap; |
14 | import java.util.List; | 15 | import java.util.List; |
@@ -413,13 +414,11 @@ public class CollOracleBySql { | @@ -413,13 +414,11 @@ public class CollOracleBySql { | ||
413 | //add start 活动会话数量 | 414 | //add start 活动会话数量 |
414 | String sqlActiveSession = "select STATUS,count(*) from v$session where status='ACTIVE' group by STATUS"; | 415 | String sqlActiveSession = "select STATUS,count(*) from v$session where status='ACTIVE' group by STATUS"; |
415 | Vector activeSessionDetail = collectiondbbase.getSQLKPIResult(sqlActiveSession); | 416 | Vector activeSessionDetail = collectiondbbase.getSQLKPIResult(sqlActiveSession); |
416 | - | ||
417 | - /* PM-00-03-009-04 定义的为 JDBC可链接性,这里不统一,注释掉。 | ||
418 | int activeSessionNum = 0; | 417 | int activeSessionNum = 0; |
419 | Vector activeSessionDetailVector = (Vector) activeSessionDetail.elementAt(0); | 418 | Vector activeSessionDetailVector = (Vector) activeSessionDetail.elementAt(0); |
420 | String num = (String) activeSessionDetailVector.get(1); | 419 | String num = (String) activeSessionDetailVector.get(1); |
421 | activeSessionNum = Integer.parseInt(num); | 420 | activeSessionNum = Integer.parseInt(num); |
422 | - collectiondbbase.addKPI(KBP_ID, "PM-00-03-009-04", String.valueOf(activeSessionNum));*/ | 421 | + collectiondbbase.addKPI(KBP_ID, "PM-00-03-009-04", String.valueOf(activeSessionNum)); |
423 | //add end | 422 | //add end |
424 | int sessionNum = 0; | 423 | int sessionNum = 0; |
425 | for (int i = 0; i < sessionDetail.size(); i++) { | 424 | for (int i = 0; i < sessionDetail.size(); i++) { |
@@ -441,6 +440,28 @@ public class CollOracleBySql { | @@ -441,6 +440,28 @@ public class CollOracleBySql { | ||
441 | 440 | ||
442 | collectiondbbase.addKPI(KBP_ID, "PM-00-03-009-03", String | 441 | collectiondbbase.addKPI(KBP_ID, "PM-00-03-009-03", String |
443 | .valueOf(sessionNum)); | 442 | .valueOf(sessionNum)); |
443 | + | ||
444 | + //================== 会话百分比=活动会话数/最大会话数 2017.05.23 swy =========================== | ||
445 | + String sqlMaxSession = "select value from v$parameter where name='sessions'"; | ||
446 | + Vector maxSessionDetail = collectiondbbase.getSQLKPIResult(sqlMaxSession); | ||
447 | + int maxSessionNum = 0; | ||
448 | + Vector numberVector = (Vector)maxSessionDetail.get(0); | ||
449 | + String number=(String)numberVector.get(0); | ||
450 | + maxSessionNum = Integer.parseInt(number); | ||
451 | + float activeSessionPercentage= 0; | ||
452 | + DecimalFormat df = new DecimalFormat("0.00"); | ||
453 | + try{ | ||
454 | + activeSessionPercentage=((float)activeSessionNum*100/maxSessionNum); | ||
455 | + }catch (Exception ex){ | ||
456 | + activeSessionPercentage=0; | ||
457 | + logger.error("计算会话百分比出错;ex="+ex.getMessage()); | ||
458 | + | ||
459 | + }finally { | ||
460 | + collectiondbbase.addKPI(KBP_ID, "PM-00-03-009-888", String.valueOf(df.format(activeSessionPercentage))); | ||
461 | + } | ||
462 | + | ||
463 | + | ||
464 | + | ||
444 | // 4. buffer Hit % | 465 | // 4. buffer Hit % |
445 | collectiondbbase | 466 | collectiondbbase |
446 | .addKPI( | 467 | .addKPI( |
@@ -685,7 +706,7 @@ public class CollOracleBySql { | @@ -685,7 +706,7 @@ public class CollOracleBySql { | ||
685 | * PM-10-12-10-18 free buffer busy :f | 706 | * PM-10-12-10-18 free buffer busy :f |
686 | * PM-10-12-10-19 log file sync 等待时间:v | 707 | * PM-10-12-10-19 log file sync 等待时间:v |
687 | * PM-10-12-10-20 log file sync 等待数量:v | 708 | * PM-10-12-10-20 log file sync 等待数量:v |
688 | - * PM-00-03-009-03 数据库连接用户数: | 709 | + * PM-00-03-009-03 数据库连接用户数:ui |
689 | * FM-00-03-001-01 数据库状态 : | 710 | * FM-00-03-001-01 数据库状态 : |
690 | * FM-10-12-10-22 有无死锁产生0 : | 711 | * FM-10-12-10-22 有无死锁产生0 : |
691 | * PM-10-12-10-23 锁等待数量:select count(*) from v$lock where request<>0 | 712 | * PM-10-12-10-23 锁等待数量:select count(*) from v$lock where request<>0 |
@@ -964,8 +985,10 @@ public class CollOracleBySql { | @@ -964,8 +985,10 @@ public class CollOracleBySql { | ||
964 | "PM-00-03-904-01", freesize);// 14. 表空间剩余大小 | 985 | "PM-00-03-904-01", freesize);// 14. 表空间剩余大小 |
965 | 986 | ||
966 | } | 987 | } |
967 | - }catch (Exception ex){ | ||
968 | 988 | ||
989 | + log.info("This is Oracle 11g"); | ||
990 | + }catch (Exception ex){ | ||
991 | + log.info("This is Oracle 9i"); | ||
969 | //String KBP_ID = KBP_ID + "-11:" + deviceId + "-TABLESPACES"; | 992 | //String KBP_ID = KBP_ID + "-11:" + deviceId + "-TABLESPACES"; |
970 | 993 | ||
971 | String sql = "SELECT upper(d.tablespace_name), "+ | 994 | String sql = "SELECT upper(d.tablespace_name), "+ |
-
Please register or login to post a comment