Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
b6f358e0
C
cat
项目概览
梦中观雨
/
cat
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
cat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b6f358e0
编写于
5月 27, 2014
作者:
Y
youyong205
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix the project info
上级
a27a0631
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
85 addition
and
268 deletion
+85
-268
cat-home/pom.xml
cat-home/pom.xml
+0
-1
cat-home/src/main/java/com/dianping/cat/CatHomeModule.java
cat-home/src/main/java/com/dianping/cat/CatHomeModule.java
+2
-2
cat-home/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
...n/java/com/dianping/cat/build/ComponentsConfigurator.java
+1
-4
cat-home/src/main/java/com/dianping/cat/build/TaskComponentConfigurator.java
...ava/com/dianping/cat/build/TaskComponentConfigurator.java
+0
-1
cat-home/src/main/java/com/dianping/cat/report/page/statistics/Handler.java
...java/com/dianping/cat/report/page/statistics/Handler.java
+20
-9
cat-home/src/main/java/com/dianping/cat/report/task/product/ProjectUpdateTask.java
...m/dianping/cat/report/task/product/ProjectUpdateTask.java
+59
-69
cat-home/src/main/java/com/dianping/cat/system/config/UtilizationConfigManager.java
.../dianping/cat/system/config/UtilizationConfigManager.java
+0
-91
cat-home/src/main/java/com/dianping/cat/system/page/config/Action.java
...main/java/com/dianping/cat/system/page/config/Action.java
+0
-2
cat-home/src/main/java/com/dianping/cat/system/page/config/Handler.java
...ain/java/com/dianping/cat/system/page/config/Handler.java
+0
-14
cat-home/src/main/java/com/dianping/cat/system/page/config/JspViewer.java
...n/java/com/dianping/cat/system/page/config/JspViewer.java
+0
-2
cat-home/src/main/resources/META-INF/dal/model/utilization-config-codegen.xml
...sources/META-INF/dal/model/utilization-config-codegen.xml
+0
-22
cat-home/src/main/resources/META-INF/dal/model/utilization-config-manifest.xml
...ources/META-INF/dal/model/utilization-config-manifest.xml
+0
-6
cat-home/src/main/resources/META-INF/dal/model/utilization-config-model.xml
...resources/META-INF/dal/model/utilization-config-model.xml
+0
-24
cat-home/src/main/resources/META-INF/dal/model/utilization-report-model.xml
...resources/META-INF/dal/model/utilization-report-model.xml
+1
-0
cat-home/src/main/resources/META-INF/plexus/components.xml
cat-home/src/main/resources/META-INF/plexus/components.xml
+0
-21
cat-home/src/main/webapp/jsp/report/utilization/detail.jsp
cat-home/src/main/webapp/jsp/report/utilization/detail.jsp
+2
-0
未找到文件。
cat-home/pom.xml
浏览文件 @
b6f358e0
...
...
@@ -158,7 +158,6 @@
${basedir}/src/main/resources/META-INF/dal/model/service-report-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/heavy-report-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/utilization-report-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/utilization-config-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/domainGroup-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/metric-group-config-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/metric-aggregation-config-manifest.xml,
...
...
cat-home/src/main/java/com/dianping/cat/CatHomeModule.java
浏览文件 @
b6f358e0
...
...
@@ -52,13 +52,13 @@ public class CatHomeModule extends AbstractModule {
MetricAlert
metricAlert
=
ctx
.
lookup
(
MetricAlert
.
class
);
SwitchAlert
swtichAlert
=
ctx
.
lookup
(
SwitchAlert
.
class
);
ExceptionAlert
exceptionAlert
=
ctx
.
lookup
(
ExceptionAlert
.
class
);
ProjectUpdateTask
productUpdateTask
=
ctx
.
lookup
(
ProjectUpdateTask
.
class
);
Threads
.
forGroup
(
"Cat"
).
start
(
swtichAlert
);
Threads
.
forGroup
(
"Cat"
).
start
(
metricAlert
);
Threads
.
forGroup
(
"Cat"
).
start
(
exceptionAlert
);
Threads
.
forGroup
(
"Cat"
).
start
(
productUpdateTask
);
}
ProjectUpdateTask
productUpdateTask
=
ctx
.
lookup
(
ProjectUpdateTask
.
class
);
Threads
.
forGroup
(
"Cat"
).
start
(
productUpdateTask
);
executeAlarmModule
(
ctx
);
}
...
...
cat-home/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
浏览文件 @
b6f358e0
...
...
@@ -26,9 +26,9 @@ import com.dianping.cat.report.baseline.BaselineService;
import
com.dianping.cat.report.chart.AggregationGraphCreator
;
import
com.dianping.cat.report.chart.CachedMetricReportService
;
import
com.dianping.cat.report.chart.DataExtractor
;
import
com.dianping.cat.report.chart.NetworkGraphCreator
;
import
com.dianping.cat.report.chart.GraphCreator
;
import
com.dianping.cat.report.chart.MetricDataFetcher
;
import
com.dianping.cat.report.chart.NetworkGraphCreator
;
import
com.dianping.cat.report.chart.impl.CachedMetricReportServiceImpl
;
import
com.dianping.cat.report.chart.impl.DataExtractorImpl
;
import
com.dianping.cat.report.chart.impl.MetricDataFetcherImpl
;
...
...
@@ -65,7 +65,6 @@ import com.dianping.cat.system.config.ExceptionThresholdConfigManager;
import
com.dianping.cat.system.config.MetricAggregationConfigManager
;
import
com.dianping.cat.system.config.MetricGroupConfigManager
;
import
com.dianping.cat.system.config.MetricRuleConfigManager
;
import
com.dianping.cat.system.config.UtilizationConfigManager
;
import
com.dianping.cat.system.tool.DefaultMailImpl
;
import
com.dianping.cat.system.tool.MailSMS
;
...
...
@@ -106,8 +105,6 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
all
.
add
(
C
(
BugConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
UtilizationConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
MetricGroupConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
MetricAggregationConfigManager
.
class
).
req
(
ConfigDao
.
class
));
...
...
cat-home/src/main/java/com/dianping/cat/build/TaskComponentConfigurator.java
浏览文件 @
b6f358e0
...
...
@@ -15,7 +15,6 @@ import com.dianping.cat.core.dal.GraphDao;
import
com.dianping.cat.core.dal.TaskDao
;
import
com.dianping.cat.home.dal.report.BaselineDao
;
import
com.dianping.cat.home.dal.report.TopologyGraphDao
;
import
com.dianping.cat.home.dependency.exceptionExclude.entity.ExceptionExcludeConfig
;
import
com.dianping.cat.report.baseline.BaselineConfigManager
;
import
com.dianping.cat.report.baseline.BaselineCreator
;
import
com.dianping.cat.report.baseline.BaselineService
;
...
...
cat-home/src/main/java/com/dianping/cat/report/page/statistics/Handler.java
浏览文件 @
b6f358e0
...
...
@@ -88,7 +88,7 @@ public class Handler implements PageHandler<Context> {
List
<
com
.
dianping
.
cat
.
home
.
alertReport
.
entity
.
Domain
>
sortedDomains
=
buildSortedAlertInfo
(
alertReport
,
model
);
model
.
setAlertDomains
(
sortedDomains
);
}
private
void
builAlertDetails
(
Model
model
,
Payload
payload
)
{
AlertReport
alertReport
=
queryAlertReport
(
payload
);
List
<
com
.
dianping
.
cat
.
home
.
alertReport
.
entity
.
Exception
>
sortedExceptions
=
buildSortedAlertDetails
(
alertReport
,
...
...
@@ -96,7 +96,7 @@ public class Handler implements PageHandler<Context> {
model
.
setAlertExceptions
(
sortedExceptions
);
}
private
void
buildHeavyInfo
(
Model
model
,
Payload
payload
)
{
HeavyReport
heavyReport
=
queryHeavyReport
(
payload
);
...
...
@@ -144,10 +144,10 @@ public class Handler implements PageHandler<Context> {
model
.
setCacheServices
(
cacheServices
);
}
}
private
List
<
com
.
dianping
.
cat
.
home
.
alertReport
.
entity
.
Domain
>
buildSortedAlertInfo
(
AlertReport
report
,
Model
model
)
{
List
<
com
.
dianping
.
cat
.
home
.
alertReport
.
entity
.
Domain
>
domains
=
new
ArrayList
<
com
.
dianping
.
cat
.
home
.
alertReport
.
entity
.
Domain
>();
if
(!
report
.
getDomains
().
values
().
isEmpty
())
{
domains
=
new
ArrayList
<
com
.
dianping
.
cat
.
home
.
alertReport
.
entity
.
Domain
>(
report
.
getDomains
().
values
());
Comparator
<
com
.
dianping
.
cat
.
home
.
alertReport
.
entity
.
Domain
>
domainCompator
=
new
Comparator
<
com
.
dianping
.
cat
.
home
.
alertReport
.
entity
.
Domain
>()
{
...
...
@@ -165,12 +165,12 @@ public class Handler implements PageHandler<Context> {
}
return
domains
;
}
private
List
<
com
.
dianping
.
cat
.
home
.
alertReport
.
entity
.
Exception
>
buildSortedAlertDetails
(
AlertReport
report
,
String
domainName
)
{
List
<
com
.
dianping
.
cat
.
home
.
alertReport
.
entity
.
Exception
>
exceptions
=
new
ArrayList
<
com
.
dianping
.
cat
.
home
.
alertReport
.
entity
.
Exception
>();
com
.
dianping
.
cat
.
home
.
alertReport
.
entity
.
Domain
domain
=
report
.
getDomains
().
get
(
domainName
);
if
(
domain
!=
null
&&
!
domain
.
getExceptions
().
isEmpty
())
{
exceptions
=
new
ArrayList
<
com
.
dianping
.
cat
.
home
.
alertReport
.
entity
.
Exception
>(
domain
.
getExceptions
().
values
());
Comparator
<
com
.
dianping
.
cat
.
home
.
alertReport
.
entity
.
Exception
>
exceptionCompator
=
new
Comparator
<
com
.
dianping
.
cat
.
home
.
alertReport
.
entity
.
Exception
>()
{
...
...
@@ -186,12 +186,14 @@ public class Handler implements PageHandler<Context> {
Collections
.
sort
(
exceptions
,
exceptionCompator
);
}
return
exceptions
;
}
}
private
void
buildUtilizationInfo
(
Model
model
,
Payload
payload
)
{
UtilizationReport
utilizationReport
=
queryUtilizationReport
(
payload
);
Collection
<
com
.
dianping
.
cat
.
home
.
utilization
.
entity
.
Domain
>
dUList
=
utilizationReport
.
getDomains
().
values
();
List
<
com
.
dianping
.
cat
.
home
.
utilization
.
entity
.
Domain
>
dUWebList
=
new
LinkedList
<
com
.
dianping
.
cat
.
home
.
utilization
.
entity
.
Domain
>();
List
<
com
.
dianping
.
cat
.
home
.
utilization
.
entity
.
Domain
>
dUServiceList
=
new
LinkedList
<
com
.
dianping
.
cat
.
home
.
utilization
.
entity
.
Domain
>();
for
(
com
.
dianping
.
cat
.
home
.
utilization
.
entity
.
Domain
d
:
dUList
)
{
if
(
d
.
findApplicationState
(
"URL"
)
!=
null
)
{
dUWebList
.
add
(
d
);
...
...
@@ -277,10 +279,10 @@ public class Handler implements PageHandler<Context> {
return
m_reportService
.
queryHeavyReport
(
Constants
.
CAT
,
pair
.
getKey
(),
pair
.
getValue
());
}
private
AlertReport
queryAlertReport
(
Payload
payload
)
{
Pair
<
Date
,
Date
>
pair
=
queryStartEndTime
(
payload
);
return
m_reportService
.
queryAlertReport
(
Constants
.
CAT
,
pair
.
getKey
(),
pair
.
getValue
());
}
...
...
@@ -313,7 +315,16 @@ public class Handler implements PageHandler<Context> {
private
UtilizationReport
queryUtilizationReport
(
Payload
payload
)
{
Pair
<
Date
,
Date
>
pair
=
queryStartEndTime
(
payload
);
UtilizationReport
report
=
m_reportService
.
queryUtilizationReport
(
Constants
.
CAT
,
pair
.
getKey
(),
pair
.
getValue
());
Collection
<
com
.
dianping
.
cat
.
home
.
utilization
.
entity
.
Domain
>
domains
=
report
.
getDomains
().
values
();
for
(
com
.
dianping
.
cat
.
home
.
utilization
.
entity
.
Domain
d
:
domains
)
{
String
domain
=
d
.
getId
();
Project
project
=
findProjectByDomain
(
domain
);
if
(
project
!=
null
)
{
d
.
setCmdbId
(
project
.
getCmdbDomain
());
}
}
return
report
;
}
...
...
cat-home/src/main/java/com/dianping/cat/report/task/product/ProjectUpdateTask.java
浏览文件 @
b6f358e0
package
com.dianping.cat.report.task.product
;
import
java.io.InputStream
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -12,6 +11,7 @@ import org.codehaus.plexus.logging.Logger;
import
org.unidal.dal.jdbc.DalException
;
import
org.unidal.helper.Files
;
import
org.unidal.helper.Threads.Task
;
import
org.unidal.helper.Urls
;
import
org.unidal.lookup.annotation.Inject
;
import
org.unidal.webres.json.JsonArray
;
import
org.unidal.webres.json.JsonObject
;
...
...
@@ -35,7 +35,7 @@ public class ProjectUpdateTask implements Task, LogEnabled {
private
Logger
m_logger
;
private
Map
<
String
,
String
>
m_domainToIpMap
=
new
HashMap
<
String
,
String
>();
private
Map
<
String
,
List
<
String
>>
m_domainToIpMap
=
new
HashMap
<
String
,
List
<
String
>
>();
private
static
final
long
DURATION
=
60
*
60
*
1000L
;
...
...
@@ -50,7 +50,15 @@ public class ProjectUpdateTask implements Task, LogEnabled {
List
<
Hostinfo
>
infos
=
m_hostInfoDao
.
findAllIp
(
HostinfoEntity
.
READSET_FULL
);
for
(
Hostinfo
info
:
infos
)
{
m_domainToIpMap
.
put
(
info
.
getDomain
(),
info
.
getIp
());
String
domain
=
info
.
getDomain
();
String
ip
=
info
.
getIp
();
List
<
String
>
ips
=
m_domainToIpMap
.
get
(
domain
);
if
(
ips
==
null
)
{
ips
=
new
ArrayList
<
String
>();
m_domainToIpMap
.
put
(
domain
,
ips
);
}
ips
.
add
(
ip
);
}
}
catch
(
DalException
e
)
{
Cat
.
logError
(
e
);
...
...
@@ -85,7 +93,11 @@ public class ProjectUpdateTask implements Task, LogEnabled {
}
private
boolean
checkIfEqual
(
String
source
,
String
target
)
{
return
source
.
equals
(
target
);
if
(
source
==
null
||
target
==
null
)
{
return
false
;
}
else
{
return
source
.
equals
(
target
);
}
}
private
boolean
checkIfValid
(
String
source
)
{
...
...
@@ -112,7 +124,6 @@ public class ProjectUpdateTask implements Task, LogEnabled {
if
(
array
.
length
()
>
0
)
{
return
array
.
getString
(
0
);
}
return
null
;
}
...
...
@@ -143,74 +154,60 @@ public class ProjectUpdateTask implements Task, LogEnabled {
JsonArray
phones
=
object
.
getJSONArray
(
"project_owner_mobile"
);
String
phone
=
buildStringFromJsonArray
(
phones
);
if
(
phone
!=
null
)
{
infosMap
.
put
(
"phone"
,
phone
);
}
return
infosMap
;
}
private
String
queryCmdbName
(
List
<
String
>
ips
)
{
for
(
String
ip
:
ips
)
{
String
cmdbDomain
=
queryDomainFromCMDB
(
ip
);
if
(
checkIfValid
(
cmdbDomain
))
{
return
cmdbDomain
;
}
}
return
null
;
}
private
String
queryDomainFromCMDB
(
String
ip
)
{
try
{
String
cmdb
=
String
.
format
(
CMDB_DOMAIN_URL
,
ip
);
URL
url
=
new
URL
(
cmdb
);
HttpURLConnection
conn
=
(
HttpURLConnection
)
url
.
openConnection
();
int
nRc
=
conn
.
getResponseCode
();
if
(
nRc
==
HttpURLConnection
.
HTTP_OK
)
{
InputStream
input
=
conn
.
getInputStream
();
String
content
=
Files
.
forIO
().
readFrom
(
input
,
"utf-8"
);
String
domain
=
parseDomain
(
content
.
trim
());
if
(
checkIfValid
(
domain
))
{
return
domain
;
}
InputStream
in
=
Urls
.
forIO
().
readTimeout
(
1000
).
connectTimeout
(
1000
).
openStream
(
cmdb
);
String
content
=
Files
.
forIO
().
readFrom
(
in
,
"utf-8"
);
m_logger
.
error
(
"cannt find single domain for ip: "
+
ip
);
return
null
;
}
return
parseDomain
(
content
.
trim
());
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
return
null
;
}
private
String
queryHostnameFromCMDB
(
String
ip
)
{
try
{
String
cmdb
=
String
.
format
(
CMDB_HOSTNAME_URL
,
ip
);
URL
url
=
new
URL
(
cmdb
);
HttpURLConnection
conn
=
(
HttpURLConnection
)
url
.
openConnection
();
int
nRc
=
conn
.
getResponseCode
();
if
(
nRc
==
HttpURLConnection
.
HTTP_OK
)
{
InputStream
input
=
conn
.
getInputStream
();
String
content
=
Files
.
forIO
().
readFrom
(
input
,
"utf-8"
);
return
parseHostname
(
content
.
trim
());
}
InputStream
in
=
Urls
.
forIO
().
readTimeout
(
1000
).
connectTimeout
(
1000
).
openStream
(
cmdb
);
String
content
=
Files
.
forIO
().
readFrom
(
in
,
"utf-8"
);
return
parseHostname
(
content
.
trim
());
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
return
null
;
}
private
Map
<
String
,
String
>
query
Infos
FromCMDB
(
String
cmdbDomain
)
{
private
Map
<
String
,
String
>
query
ProjectInfo
FromCMDB
(
String
cmdbDomain
)
{
try
{
String
cmdb
=
String
.
format
(
CMDB_INFO_URL
,
cmdbDomain
);
URL
url
=
new
URL
(
cmdb
);
HttpURLConnection
conn
=
(
HttpURLConnection
)
url
.
openConnection
();
int
nRc
=
conn
.
getResponseCode
();
if
(
nRc
==
HttpURLConnection
.
HTTP_OK
)
{
InputStream
input
=
conn
.
getInputStream
();
String
content
=
Files
.
forIO
().
readFrom
(
input
,
"utf-8"
);
return
parseInfos
(
content
.
trim
());
}
InputStream
in
=
Urls
.
forIO
().
readTimeout
(
1000
).
connectTimeout
(
1000
).
openStream
(
cmdb
);
String
content
=
Files
.
forIO
().
readFrom
(
in
,
"utf-8"
);
return
parseInfos
(
content
.
trim
());
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
return
null
;
}
...
...
@@ -252,8 +249,7 @@ public class ProjectUpdateTask implements Task, LogEnabled {
info
.
setHostname
(
cmdbHostname
);
m_hostInfoDao
.
updateByPK
(
info
,
HostinfoEntity
.
UPDATESET_FULL
);
}
else
{
m_logger
.
error
(
"cant find hostname for ip: "
+
ip
);
m_logger
.
error
(
"can't find hostname for ip: "
+
ip
);
}
}
}
catch
(
Throwable
e
)
{
...
...
@@ -262,7 +258,7 @@ public class ProjectUpdateTask implements Task, LogEnabled {
}
private
boolean
updateProject
(
Project
proj
)
{
Map
<
String
,
String
>
infosMap
=
query
Infos
FromCMDB
(
proj
.
getCmdbDomain
());
Map
<
String
,
String
>
infosMap
=
query
ProjectInfo
FromCMDB
(
proj
.
getCmdbDomain
());
String
owner
=
infosMap
.
get
(
"owner"
);
String
email
=
infosMap
.
get
(
"email"
);
String
phone
=
infosMap
.
get
(
"phone"
);
...
...
@@ -271,17 +267,15 @@ public class ProjectUpdateTask implements Task, LogEnabled {
String
dbPhone
=
proj
.
getPhone
();
boolean
isProjChanged
=
false
;
if
(
checkIfValid
(
owner
)
&&
!
checkIfEqual
(
owner
,
dbOwner
))
{
if
(!
checkIfEqual
(
owner
,
dbOwner
))
{
proj
.
setOwner
(
owner
);
isProjChanged
=
true
;
}
if
(
checkIfValid
(
email
)
&&
!
checkIfEqual
(
email
,
dbEmail
))
{
if
(!
checkIfEqual
(
email
,
dbEmail
))
{
proj
.
setEmail
(
email
);
isProjChanged
=
true
;
}
if
(
checkIfValid
(
phone
)
&&
!
checkIfEqual
(
phone
,
dbPhone
))
{
if
(!
checkIfEqual
(
phone
,
dbPhone
))
{
proj
.
setPhone
(
phone
);
isProjChanged
=
true
;
}
...
...
@@ -295,26 +289,22 @@ public class ProjectUpdateTask implements Task, LogEnabled {
try
{
List
<
Project
>
projects
=
m_projectDao
.
findAll
(
ProjectEntity
.
READSET_FULL
);
for
(
Project
proj
:
projects
)
{
String
cmdbDomain
=
proj
.
getCmdbDomain
();
boolean
isCmdbDomainChange
=
false
;
if
(!
checkIfValid
(
cmdbDomain
))
{
String
ip
=
m_domainToIpMap
.
get
(
proj
.
getDomain
());
cmdbDomain
=
queryDomainFromCMDB
(
ip
);
for
(
Project
pro
:
projects
)
{
try
{
List
<
String
>
ips
=
m_domainToIpMap
.
get
(
pro
.
getDomain
());
String
cmdbDomain
=
queryCmdbName
(
ips
);
boolean
isChange
=
!
cmdbDomain
.
equals
(
pro
.
getCmdbDomain
());
if
(!
checkIfValid
(
cmdbDomain
))
{
continue
;
}
proj
.
setCmdbDomain
(
cmdbDomain
);
isCmdbDomainChange
=
true
;
}
if
(
checkIfValid
(
cmdbDomain
))
{
pro
.
setCmdbDomain
(
cmdbDomain
);
boolean
isProjectInfoChange
=
updateProject
(
proj
);
boolean
isProjectInfoChange
=
updateProject
(
pro
);
if
(
isProjectInfoChange
||
isCmdbDomainChange
)
{
m_projectDao
.
updateByPK
(
proj
,
ProjectEntity
.
UPDATESET_FULL
);
if
(
isProjectInfoChange
||
isChange
)
{
m_projectDao
.
updateByPK
(
pro
,
ProjectEntity
.
UPDATESET_FULL
);
}
}
}
catch
(
Exception
e
)
{
}
}
}
catch
(
Throwable
e
)
{
...
...
cat-home/src/main/java/com/dianping/cat/system/config/UtilizationConfigManager.java
已删除
100644 → 0
浏览文件 @
a27a0631
package
com.dianping.cat.system.config
;
import
org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
;
import
org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
;
import
org.unidal.dal.jdbc.DalNotFoundException
;
import
org.unidal.helper.Files
;
import
org.unidal.lookup.annotation.Inject
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.core.config.Config
;
import
com.dianping.cat.core.config.ConfigDao
;
import
com.dianping.cat.core.config.ConfigEntity
;
import
com.dianping.cat.home.utilization.config.entity.UtilizationConfig
;
import
com.dianping.cat.home.utilization.config.transform.DefaultSaxParser
;
public
class
UtilizationConfigManager
implements
Initializable
{
@Inject
private
ConfigDao
m_configDao
;
private
int
m_configId
;
private
UtilizationConfig
m_utilizationConfig
;
private
static
final
String
CONFIG_NAME
=
"utilizationConfig"
;
public
UtilizationConfig
getUtilizationConfig
()
{
return
m_utilizationConfig
;
}
@Override
public
void
initialize
()
throws
InitializationException
{
try
{
Config
config
=
m_configDao
.
findByName
(
CONFIG_NAME
,
ConfigEntity
.
READSET_FULL
);
String
content
=
config
.
getContent
();
m_utilizationConfig
=
DefaultSaxParser
.
parse
(
content
);
m_configId
=
config
.
getId
();
}
catch
(
DalNotFoundException
e
)
{
try
{
String
content
=
Files
.
forIO
().
readFrom
(
this
.
getClass
().
getResourceAsStream
(
"/config/default-utilization-config.xml"
),
"utf-8"
);
Config
config
=
m_configDao
.
createLocal
();
config
.
setName
(
CONFIG_NAME
);
config
.
setContent
(
content
);
m_configDao
.
insert
(
config
);
m_utilizationConfig
=
DefaultSaxParser
.
parse
(
content
);
m_configId
=
config
.
getId
();
}
catch
(
Exception
ex
)
{
Cat
.
logError
(
ex
);
}
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
if
(
m_utilizationConfig
==
null
)
{
m_utilizationConfig
=
new
UtilizationConfig
();
}
}
public
boolean
insert
(
String
xml
)
{
try
{
m_utilizationConfig
=
DefaultSaxParser
.
parse
(
xml
);
return
storeConfig
();
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
return
false
;
}
}
private
boolean
storeConfig
()
{
synchronized
(
this
)
{
try
{
Config
config
=
m_configDao
.
createLocal
();
config
.
setId
(
m_configId
);
config
.
setKeyId
(
m_configId
);
config
.
setName
(
CONFIG_NAME
);
config
.
setContent
(
m_utilizationConfig
.
toString
());
m_configDao
.
updateByPK
(
config
,
ConfigEntity
.
UPDATESET_FULL
);
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
return
false
;
}
}
return
true
;
}
}
cat-home/src/main/java/com/dianping/cat/system/page/config/Action.java
浏览文件 @
b6f358e0
...
...
@@ -71,8 +71,6 @@ public enum Action implements org.unidal.web.mvc.Action {
BUG_CONFIG_UPDATE
(
"bugConfigUpdate"
),
UTILIZATION_CONFIG_UPDATE
(
"utilizationConfigUpdate"
),
DOMAIN_GROUP_CONFIG_UPDATE
(
"domainGroupConfigUpdate"
),
METRIC_GROUP_CONFIG_UPDATE
(
"metricGroupConfigUpdate"
),
...
...
cat-home/src/main/java/com/dianping/cat/system/page/config/Handler.java
浏览文件 @
b6f358e0
...
...
@@ -50,7 +50,6 @@ import com.dianping.cat.system.config.ExceptionThresholdConfigManager;
import
com.dianping.cat.system.config.MetricAggregationConfigManager
;
import
com.dianping.cat.system.config.MetricGroupConfigManager
;
import
com.dianping.cat.system.config.MetricRuleConfigManager
;
import
com.dianping.cat.system.config.UtilizationConfigManager
;
public
class
Handler
implements
PageHandler
<
Context
>
{
@Inject
...
...
@@ -74,9 +73,6 @@ public class Handler implements PageHandler<Context> {
@Inject
private
ExceptionThresholdConfigManager
m_exceptionConfigManager
;
@Inject
private
UtilizationConfigManager
m_utilizationConfigManager
;
@Inject
private
DomainGroupConfigManager
m_domainGroupConfigManger
;
...
...
@@ -361,16 +357,6 @@ public class Handler implements PageHandler<Context> {
}
model
.
setBug
(
m_bugConfigManager
.
getBugConfig
().
toString
());
break
;
case
UTILIZATION_CONFIG_UPDATE:
String
content
=
payload
.
getContent
();
if
(!
StringUtils
.
isEmpty
(
content
))
{
model
.
setOpState
(
m_utilizationConfigManager
.
insert
(
content
));
}
else
{
model
.
setOpState
(
true
);
}
model
.
setContent
(
m_utilizationConfigManager
.
getUtilizationConfig
().
toString
());
break
;
case
DOMAIN_GROUP_CONFIG_UPDATE:
String
domainGroupContent
=
payload
.
getContent
();
if
(!
StringUtils
.
isEmpty
(
domainGroupContent
))
{
...
...
cat-home/src/main/java/com/dianping/cat/system/page/config/JspViewer.java
浏览文件 @
b6f358e0
...
...
@@ -85,8 +85,6 @@ public class JspViewer extends BaseJspViewer<SystemPage, Action, Context, Model>
// Bug
case
BUG_CONFIG_UPDATE:
return
JspFile
.
BUG_CONFIG_UPDATE
.
getPath
();
case
UTILIZATION_CONFIG_UPDATE:
return
JspFile
.
UTILIZATION_CONFIG_UPDATE
.
getPath
();
case
DOMAIN_GROUP_CONFIG_UPDATE:
return
JspFile
.
DOMAIN_GROUP_CONFIG_UPDATE
.
getPath
();
case
METRIC_GROUP_CONFIG_UPDATE:
...
...
cat-home/src/main/resources/META-INF/dal/model/utilization-config-codegen.xml
已删除
100644 → 0
浏览文件 @
a27a0631
<?xml version="1.0" encoding="UTF-8"?>
<model>
<entity
name=
"utilization-config"
root=
"true"
>
<attribute
name=
"url-weight"
value-type=
"double"
/>
<attribute
name=
"service-weight"
value-type=
"double"
/>
<attribute
name=
"sql-weight"
value-type=
"double"
/>
<attribute
name=
"pigeoncall-weight"
value-type=
"double"
/>
<attribute
name=
"cache-weight"
value-type=
"double"
/>
<attribute
name=
"swallow-weight"
value-type=
"double"
/>
<entity-ref
name=
"domain"
type=
"list"
names=
"domains"
/>
</entity>
<entity
name=
"domain"
>
<attribute
name=
"id"
value-type=
"String"
/>
<attribute
name=
"url-weight"
value-type=
"double"
/>
<attribute
name=
"service-weight"
value-type=
"double"
/>
<attribute
name=
"sql-weight"
value-type=
"double"
/>
<attribute
name=
"pigeoncall-weight"
value-type=
"double"
/>
<attribute
name=
"cache-weight"
value-type=
"double"
/>
<attribute
name=
"swallow-weight"
value-type=
"double"
/>
</entity>
</model>
cat-home/src/main/resources/META-INF/dal/model/utilization-config-manifest.xml
已删除
100644 → 0
浏览文件 @
a27a0631
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<file
path=
"utilization-config-codegen.xml"
/>
<file
path=
"utilization-config-model.xml"
/>
</manifest>
cat-home/src/main/resources/META-INF/dal/model/utilization-config-model.xml
已删除
100644 → 0
浏览文件 @
a27a0631
<?xml version="1.0" encoding="UTF-8"?>
<model
model-package=
"com.dianping.cat.home.utilization.config"
enable-merger=
"false"
enable-sax-parser=
"true"
enable-base-visitor=
"false"
enable-xml-parser=
"false"
enable-xml-builder=
"false"
>
<entity
name=
"utilization-config"
root=
"true"
>
<attribute
name=
"url-weight"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"service-weight"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"sql-weight"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"pigeoncall-weight"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"cache-weight"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"swallow-weight"
value-type=
"double"
primitive=
"true"
/>
<entity-ref
name=
"domain"
type=
"map"
names=
"domains"
method-find-or-create=
'true'
/>
</entity>
<entity
name=
"domain"
>
<attribute
name=
"id"
value-type=
"String"
key=
"true"
/>
<attribute
name=
"cmdb-id"
value-type=
"String"
/>
<attribute
name=
"url-weight"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"service-weight"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"sql-weight"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"pigeoncall-weight"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"cache-weight"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"swallow-weight"
value-type=
"double"
primitive=
"true"
/>
</entity>
</model>
cat-home/src/main/resources/META-INF/dal/model/utilization-report-model.xml
浏览文件 @
b6f358e0
...
...
@@ -9,6 +9,7 @@
</entity>
<entity
name=
"domain"
>
<attribute
name=
"id"
value-type=
"String"
key=
"true"
/>
<attribute
name=
"cmdb-id"
value-type=
"String"
/>
<attribute
name=
"machine-number"
value-type=
"int"
primitive=
"true"
/>
<entity-ref
name=
"machineState"
type=
"map"
names=
"machineStates"
method-find-or-create=
'true'
/>
<entity-ref
name=
"applicationState"
type=
"map"
names=
"applicationStates"
method-find-or-create=
'true'
/>
...
...
cat-home/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
b6f358e0
...
...
@@ -113,15 +113,6 @@
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.system.config.UtilizationConfigManager
</role>
<implementation>
com.dianping.cat.system.config.UtilizationConfigManager
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.core.config.ConfigDao
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.system.config.MetricGroupConfigManager
</role>
<implementation>
com.dianping.cat.system.config.MetricGroupConfigManager
</implementation>
...
...
@@ -3600,9 +3591,6 @@
<requirement>
<role>
com.dianping.cat.system.config.ExceptionThresholdConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.system.config.UtilizationConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.system.config.DomainGroupConfigManager
</role>
</requirement>
...
...
@@ -3647,15 +3635,6 @@
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.system.config.UtilizationConfigManager
</role>
<implementation>
com.dianping.cat.system.config.UtilizationConfigManager
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.core.config.ConfigDao
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.system.config.MetricRuleConfigManager
</role>
<implementation>
com.dianping.cat.system.config.MetricRuleConfigManager
</implementation>
...
...
cat-home/src/main/webapp/jsp/report/utilization/detail.jsp
浏览文件 @
b6f358e0
...
...
@@ -17,6 +17,7 @@
<thead>
<tr>
<th>
Web应用
</th>
<th>
CMDB
</th>
<th>
机器数
</th>
<th>
访问量
<i
tips=
""
data-trigger=
"hover"
class=
"icon-question-sign"
data-toggle=
"popover"
data-placement=
"left"
data-content=
"一段时间【小时、天、周、月】的URL访问总量"
></i></th>
<th>
集群QPS
<i
tips=
""
data-trigger=
"hover"
class=
"icon-question-sign"
data-toggle=
"popover"
data-placement=
"left"
data-content=
"一段时间【小时、天、周、月】集群机器URL每秒的访问最大量"
></i></th>
...
...
@@ -34,6 +35,7 @@
<c:forEach
var=
"item"
items=
"
${
model
.
utilizationWebList
}
"
varStatus=
"status"
>
<tr>
<td>
${item.id}
</td>
<td>
${item.cmdbId}
</td>
<td
style=
"text-align:right"
>
${item.machineNumber}
</td>
<td
style=
"text-align:right"
>
${w:format(item.applicationStates.URL.count,'###0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.applicationStates.URL.maxQps,'###0')}
</td>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录