Toggle navigation
Toggle navigation
This project
Loading...
Sign in
guizhou-monitorV2.0.1
/
agent
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
宋文圆
8 years ago
Commit
fe33a9874968de7a16e3c3ac9c582d0084455738
1 parent
f2ea16f9
增加活动会话百分比
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
5 deletions
src/com/sitech/ismp/coll/CollOracleBySql.java
src/com/sitech/ismp/coll/CollOracleBySql.java
View file @
fe33a98
...
...
@@ -9,6 +9,7 @@ import com.sitech.util.JSONUtil;
import
com.sitech.util.upload.RomoteController
;
import
org.apache.log4j.Logger
;
import
java.text.DecimalFormat
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -413,13 +414,11 @@ public class CollOracleBySql {
//add start 活动会话数量
String
sqlActiveSession
=
"select STATUS,count(*) from v$session where status='ACTIVE' group by STATUS"
;
Vector
activeSessionDetail
=
collectiondbbase
.
getSQLKPIResult
(
sqlActiveSession
);
/* PM-00-03-009-04 定义的为 JDBC可链接性,这里不统一,注释掉。
int
activeSessionNum
=
0
;
Vector
activeSessionDetailVector
=
(
Vector
)
activeSessionDetail
.
elementAt
(
0
);
String
num
=
(
String
)
activeSessionDetailVector
.
get
(
1
);
activeSessionNum
=
Integer
.
parseInt
(
num
);
collectiondbbase.addKPI(KBP_ID, "PM-00-03-009-04", String.valueOf(activeSessionNum));
*/
collectiondbbase
.
addKPI
(
KBP_ID
,
"PM-00-03-009-04"
,
String
.
valueOf
(
activeSessionNum
));
//add end
int
sessionNum
=
0
;
for
(
int
i
=
0
;
i
<
sessionDetail
.
size
();
i
++)
{
...
...
@@ -441,6 +440,28 @@ public class CollOracleBySql {
collectiondbbase
.
addKPI
(
KBP_ID
,
"PM-00-03-009-03"
,
String
.
valueOf
(
sessionNum
));
//================== 会话百分比=活动会话数/最大会话数 2017.05.23 swy ===========================
String
sqlMaxSession
=
"select value from v$parameter where name='sessions'"
;
Vector
maxSessionDetail
=
collectiondbbase
.
getSQLKPIResult
(
sqlMaxSession
);
int
maxSessionNum
=
0
;
Vector
numberVector
=
(
Vector
)
maxSessionDetail
.
get
(
0
);
String
number
=(
String
)
numberVector
.
get
(
0
);
maxSessionNum
=
Integer
.
parseInt
(
number
);
float
activeSessionPercentage
=
0
;
DecimalFormat
df
=
new
DecimalFormat
(
"0.00"
);
try
{
activeSessionPercentage
=((
float
)
activeSessionNum
*
100
/
maxSessionNum
);
}
catch
(
Exception
ex
){
activeSessionPercentage
=
0
;
logger
.
error
(
"计算会话百分比出错;ex="
+
ex
.
getMessage
());
}
finally
{
collectiondbbase
.
addKPI
(
KBP_ID
,
"PM-00-03-009-888"
,
String
.
valueOf
(
df
.
format
(
activeSessionPercentage
)));
}
// 4. buffer Hit %
collectiondbbase
.
addKPI
(
...
...
@@ -685,7 +706,7 @@ public class CollOracleBySql {
* PM-10-12-10-18 free buffer busy :f
* PM-10-12-10-19 log file sync 等待时间:v
* PM-10-12-10-20 log file sync 等待数量:v
* PM-00-03-009-03 数据库连接用户数:
* PM-00-03-009-03 数据库连接用户数:
ui
* FM-00-03-001-01 数据库状态 :
* FM-10-12-10-22 有无死锁产生0 :
* PM-10-12-10-23 锁等待数量:select count(*) from v$lock where request<>0
...
...
@@ -964,8 +985,10 @@ public class CollOracleBySql {
"PM-00-03-904-01"
,
freesize
);
// 14. 表空间剩余大小
}
}
catch
(
Exception
ex
){
log
.
info
(
"This is Oracle 11g"
);
}
catch
(
Exception
ex
){
log
.
info
(
"This is Oracle 9i"
);
//String KBP_ID = KBP_ID + "-11:" + deviceId + "-TABLESPACES";
String
sql
=
"SELECT upper(d.tablespace_name), "
+
...
...
Please
register
or
login
to post a comment