Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
59979b68
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,发现更多精彩内容 >>
提交
59979b68
编写于
7月 24, 2014
作者:
Y
youyong205
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #413 from jialinsun/master
删掉debug注释
上级
28aa56e9
eba52148
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
250 addition
and
81 deletion
+250
-81
cat-client/src/main/resources/com/dianping/cat/configuration/client/config.xsd
...esources/com/dianping/cat/configuration/client/config.xsd
+2
-1
cat-client/src/main/resources/com/dianping/cat/status/model/status.xsd
...c/main/resources/com/dianping/cat/status/model/status.xsd
+2
-1
cat-home/src/main/java/com/dianping/cat/CatHomeModule.java
cat-home/src/main/java/com/dianping/cat/CatHomeModule.java
+4
-10
cat-home/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
...n/java/com/dianping/cat/build/ComponentsConfigurator.java
+4
-4
cat-home/src/main/java/com/dianping/cat/report/task/alert/exception/ExceptionAlert.java
...nping/cat/report/task/alert/exception/ExceptionAlert.java
+2
-2
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/HttpConnector.java
...nping/cat/report/task/alert/thirdParty/HttpConnector.java
+11
-18
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/ThirdPartyAlert.java
...ing/cat/report/task/alert/thirdParty/ThirdPartyAlert.java
+7
-11
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/ThirdPartyAlertBuilder.java
.../report/task/alert/thirdParty/ThirdPartyAlertBuilder.java
+190
-0
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/ThirdPartyAlertEntity.java
...t/report/task/alert/thirdParty/ThirdPartyAlertEntity.java
+5
-9
cat-home/src/main/resources/META-INF/dal/model/thirdParty-codegen.xml
.../main/resources/META-INF/dal/model/thirdParty-codegen.xml
+4
-4
cat-home/src/main/resources/META-INF/dal/model/thirdParty-model.xml
...rc/main/resources/META-INF/dal/model/thirdParty-model.xml
+6
-6
cat-home/src/main/resources/META-INF/plexus/components.xml
cat-home/src/main/resources/META-INF/plexus/components.xml
+5
-5
cat-home/src/main/resources/config/default-thirdParty-config.xml
...e/src/main/resources/config/default-thirdParty-config.xml
+4
-2
cat-home/src/test/resources/config/thirdParty-config.xml
cat-home/src/test/resources/config/thirdParty-config.xml
+4
-8
未找到文件。
cat-client/src/main/resources/com/dianping/cat/configuration/client/config.xsd
浏览文件 @
59979b68
<?xml version="1.0" encoding="utf-8"?>
<xs:schema
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
elementFormDefault=
"qualified"
attributeFormDefault=
"unqualified"
>
<?xml version="1.0" encoding="utf-8"?>
<xs:schema
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
elementFormDefault=
"qualified"
attributeFormDefault=
"unqualified"
>
<xs:element
name=
"config"
type=
"ConfigType"
/>
<xs:complexType
name=
"ConfigType"
>
<xs:sequence>
...
...
cat-client/src/main/resources/com/dianping/cat/status/model/status.xsd
浏览文件 @
59979b68
<?xml version="1.0" encoding="utf-8"?>
<xs:schema
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
elementFormDefault=
"qualified"
attributeFormDefault=
"unqualified"
>
<?xml version="1.0" encoding="utf-8"?>
<xs:schema
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
elementFormDefault=
"qualified"
attributeFormDefault=
"unqualified"
>
<xs:element
name=
"status"
type=
"StatusType"
/>
<xs:complexType
name=
"StatusType"
>
<xs:sequence>
...
...
cat-home/src/main/java/com/dianping/cat/CatHomeModule.java
浏览文件 @
59979b68
...
...
@@ -19,7 +19,7 @@ import com.dianping.cat.report.task.alert.exception.ExceptionAlert;
import
com.dianping.cat.report.task.alert.network.NetworkAlert
;
import
com.dianping.cat.report.task.alert.system.SystemAlert
;
import
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlert
;
import
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlert
Task
;
import
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlert
Builder
;
import
com.dianping.cat.report.task.product.ProjectUpdateTask
;
import
com.dianping.cat.report.view.DomainNavManager
;
import
com.dianping.cat.system.config.ConfigReloadTask
;
...
...
@@ -50,10 +50,6 @@ public class CatHomeModule extends AbstractModule {
Threads
.
forGroup
(
"Cat"
).
start
(
domainNavManager
);
Threads
.
forGroup
(
"Cat"
).
start
(
taskConsumer
);
}
ThirdPartyAlert
thirdPartyAlert
=
ctx
.
lookup
(
ThirdPartyAlert
.
class
);
ThirdPartyAlertTask
thirdPartyAlertTask
=
ctx
.
lookup
(
ThirdPartyAlertTask
.
class
);
Threads
.
forGroup
(
"Cat"
).
start
(
thirdPartyAlert
);
Threads
.
forGroup
(
"Cat"
).
start
(
thirdPartyAlertTask
);
if
(
serverConfigManager
.
isAlertMachine
()
&&
!
serverConfigManager
.
isLocalMode
())
{
BusinessAlert
metricAlert
=
ctx
.
lookup
(
BusinessAlert
.
class
);
...
...
@@ -61,10 +57,8 @@ public class CatHomeModule extends AbstractModule {
SystemAlert
systemAlert
=
ctx
.
lookup
(
SystemAlert
.
class
);
ExceptionAlert
exceptionAlert
=
ctx
.
lookup
(
ExceptionAlert
.
class
);
ProjectUpdateTask
productUpdateTask
=
ctx
.
lookup
(
ProjectUpdateTask
.
class
);
Threads
.
forGroup
(
"Cat"
).
start
(
thirdPartyAlert
);
Threads
.
forGroup
(
"Cat"
).
start
(
thirdPartyAlertTask
);
// ThirdPartyAlert thirdPartyAlert = ctx.lookup(ThirdPartyAlert.class);
// ThirdPartyAlertTask thirdPartyAlertTask = ctx.lookup(ThirdPartyAlertTask.class);
ThirdPartyAlert
thirdPartyAlert
=
ctx
.
lookup
(
ThirdPartyAlert
.
class
);
ThirdPartyAlertBuilder
alertBuildingTask
=
ctx
.
lookup
(
ThirdPartyAlertBuilder
.
class
);
Threads
.
forGroup
(
"Cat"
).
start
(
networkAlert
);
Threads
.
forGroup
(
"Cat"
).
start
(
systemAlert
);
...
...
@@ -72,7 +66,7 @@ public class CatHomeModule extends AbstractModule {
Threads
.
forGroup
(
"Cat"
).
start
(
exceptionAlert
);
Threads
.
forGroup
(
"Cat"
).
start
(
productUpdateTask
);
Threads
.
forGroup
(
"Cat"
).
start
(
thirdPartyAlert
);
Threads
.
forGroup
(
"Cat"
).
start
(
thirdPartyAlert
Task
);
Threads
.
forGroup
(
"Cat"
).
start
(
alertBuilding
Task
);
}
executeAlarmModule
(
ctx
);
}
...
...
cat-home/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
浏览文件 @
59979b68
...
...
@@ -79,9 +79,9 @@ import com.dianping.cat.report.task.alert.summary.AlertSummaryGenerator;
import
com.dianping.cat.report.task.alert.summary.AlertSummaryManager
;
import
com.dianping.cat.report.task.alert.system.SystemAlert
;
import
com.dianping.cat.report.task.alert.system.SystemAlertConfig
;
import
com.dianping.cat.report.task.alert.thirdParty.Http
Moni
tor
;
import
com.dianping.cat.report.task.alert.thirdParty.Http
Connec
tor
;
import
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlert
;
import
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlert
Task
;
import
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlert
Builder
;
import
com.dianping.cat.report.task.product.ProjectUpdateTask
;
import
com.dianping.cat.report.view.DomainNavManager
;
import
com.dianping.cat.service.IpService
;
...
...
@@ -137,9 +137,9 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
all
.
add
(
C
(
ThirdPartyAlert
.
class
).
req
(
ProjectDao
.
class
,
MailSender
.
class
));
all
.
add
(
C
(
Http
Moni
tor
.
class
));
all
.
add
(
C
(
Http
Connec
tor
.
class
));
all
.
add
(
C
(
ThirdPartyAlert
Task
.
class
).
req
(
HttpMoni
tor
.
class
,
ThirdPartyAlert
.
class
,
ThirdPartyConfigManager
.
class
));
all
.
add
(
C
(
ThirdPartyAlert
Builder
.
class
).
req
(
HttpConnec
tor
.
class
,
ThirdPartyAlert
.
class
,
ThirdPartyConfigManager
.
class
));
return
all
;
}
...
...
cat-home/src/main/java/com/dianping/cat/report/task/alert/exception/ExceptionAlert.java
浏览文件 @
59979b68
...
...
@@ -82,12 +82,12 @@ public class ExceptionAlert implements Task {
@Override
public
void
run
()
{
boolean
active
=
true
;
try
{
Thread
.
sleep
(
5000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
()
;
active
=
false
;
}
boolean
active
=
true
;
while
(
active
)
{
long
current
=
System
.
currentTimeMillis
();
int
minute
=
Calendar
.
getInstance
().
get
(
Calendar
.
MINUTE
);
...
...
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/Http
Moni
tor.java
→
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/Http
Connec
tor.java
浏览文件 @
59979b68
...
...
@@ -8,11 +8,11 @@ import java.net.HttpURLConnection;
import
java.net.URL
;
import
org.codehaus.plexus.util.StringUtils
;
import
org.unidal.helper.Files
;
public
class
Http
Moni
tor
{
public
class
Http
Connec
tor
{
public
String
readFromGet
(
String
url
)
{
public
boolean
readFromGet
(
String
url
)
{
boolean
result
=
false
;
HttpURLConnection
connection
=
null
;
InputStream
in
=
null
;
BufferedReader
reader
=
null
;
...
...
@@ -26,13 +26,10 @@ public class HttpMonitor {
int
response_code
=
connection
.
getResponseCode
();
if
(
response_code
==
HttpURLConnection
.
HTTP_OK
)
{
in
=
connection
.
getInputStream
();
String
result
=
Files
.
forIO
().
readFrom
(
in
,
"utf-8"
);
return
result
;
result
=
true
;
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
)
;
return
false
;
}
finally
{
if
(
connection
!=
null
)
{
connection
.
disconnect
();
...
...
@@ -45,13 +42,13 @@ public class HttpMonitor {
reader
.
close
();
}
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
return
null
;
return
result
;
}
public
String
readFromPost
(
String
url
,
String
content
)
{
public
boolean
readFromPost
(
String
url
,
String
content
)
{
boolean
result
=
false
;
HttpURLConnection
connection
=
null
;
BufferedReader
reader
=
null
;
OutputStreamWriter
writer
=
null
;
...
...
@@ -76,13 +73,10 @@ public class HttpMonitor {
int
response_code
=
connection
.
getResponseCode
();
if
(
response_code
==
HttpURLConnection
.
HTTP_OK
)
{
in
=
connection
.
getInputStream
();
String
result
=
Files
.
forIO
().
readFrom
(
in
,
"utf-8"
);
return
result
;
result
=
true
;
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
)
;
return
false
;
}
finally
{
if
(
connection
!=
null
)
{
connection
.
disconnect
();
...
...
@@ -98,9 +92,8 @@ public class HttpMonitor {
in
.
close
();
}
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
return
null
;
return
result
;
}
}
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/ThirdPartyAlert.java
浏览文件 @
59979b68
...
...
@@ -22,7 +22,6 @@ import com.dianping.cat.core.dal.Project;
import
com.dianping.cat.core.dal.ProjectDao
;
import
com.dianping.cat.core.dal.ProjectEntity
;
import
com.dianping.cat.helper.TimeUtil
;
import
com.dianping.cat.home.alert.thirdParty.entity.Domain
;
import
com.dianping.cat.message.Event
;
import
com.dianping.cat.message.Transaction
;
import
com.dianping.cat.report.task.alert.sender.MailSender
;
...
...
@@ -85,11 +84,10 @@ public class ThirdPartyAlert implements Task, LogEnabled {
alertEntities
.
add
(
entity
);
}
Map
<
String
,
List
<
ThirdPartyAlertEntity
>>
domain2AlertMap
=
buildDomain2AlertMap
(
alertEntities
);
for
(
Entry
<
String
,
List
<
ThirdPartyAlertEntity
>>
entry
:
domain2AlertMap
.
entrySet
())
{
sendAlert
(
entry
.
getKey
(),
entry
.
getValue
());
}
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
t
.
setStatus
(
e
);
...
...
@@ -113,17 +111,15 @@ public class ThirdPartyAlert implements Task, LogEnabled {
Map
<
String
,
List
<
ThirdPartyAlertEntity
>>
domain2AlertMap
=
new
HashMap
<
String
,
List
<
ThirdPartyAlertEntity
>>();
for
(
ThirdPartyAlertEntity
entity
:
alertEntities
)
{
for
(
Domain
domain
:
entity
.
getDomains
())
{
String
domainId
=
domain
.
getId
();
List
<
ThirdPartyAlertEntity
>
alertList
=
domain2AlertMap
.
get
(
domainId
);
String
domain
=
entity
.
getDomain
();
List
<
ThirdPartyAlertEntity
>
alertList
=
domain2AlertMap
.
get
(
domain
);
if
(
alertList
==
null
)
{
alertList
=
new
ArrayList
<
ThirdPartyAlertEntity
>();
if
(
alertList
==
null
)
{
alertList
=
new
ArrayList
<
ThirdPartyAlertEntity
>();
domain2AlertMap
.
put
(
domainId
,
alertList
);
}
alertList
.
add
(
entity
);
domain2AlertMap
.
put
(
domain
,
alertList
);
}
alertList
.
add
(
entity
);
}
return
domain2AlertMap
;
}
...
...
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/ThirdPartyAlert
Task
.java
→
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/ThirdPartyAlert
Builder
.java
浏览文件 @
59979b68
package
com.dianping.cat.report.task.alert.thirdParty
;
import
java.util.Calendar
;
import
java.util.List
;
import
java.util.
Timer
;
import
java.util.
TimerTask
;
import
java.util.
Map
;
import
java.util.
Map.Entry
;
import
org.codehaus.plexus.logging.LogEnabled
;
import
org.codehaus.plexus.logging.Logger
;
import
org.codehaus.plexus.util.StringUtils
;
import
org.unidal.helper.Threads
;
import
org.unidal.helper.Threads.Task
;
import
org.unidal.lookup.annotation.Inject
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.helper.TimeUtil
;
import
com.dianping.cat.home.alert.thirdParty.entity.Http
;
import
com.dianping.cat.home.alert.thirdParty.entity.Par
;
import
com.dianping.cat.message.Transaction
;
import
com.dianping.cat.system.config.ThirdPartyConfigManager
;
public
class
ThirdPartyAlert
Task
implements
Task
,
LogEnabled
{
public
class
ThirdPartyAlert
Builder
implements
Task
,
LogEnabled
{
@Inject
private
Http
Monitor
m_httpMoni
tor
;
private
Http
Connector
m_httpConnec
tor
;
@Inject
private
ThirdPartyAlert
m_thirdPartyAlert
;
...
...
@@ -37,7 +40,13 @@ public class ThirdPartyAlertTask implements Task, LogEnabled {
while
(
active
)
{
long
current
=
System
.
currentTimeMillis
();
Transaction
t
=
Cat
.
newTransaction
(
"Task"
,
"ThirdPartyAlert"
);
int
minute
=
Calendar
.
getInstance
().
get
(
Calendar
.
MINUTE
);
String
minuteStr
=
String
.
valueOf
(
minute
);
if
(
minute
<
10
)
{
minuteStr
=
'0'
+
minuteStr
;
}
Transaction
t
=
Cat
.
newTransaction
(
"ThirdPartyAlertBuilder"
,
"M"
+
minuteStr
);
try
{
buildAlertEntities
(
current
);
...
...
@@ -65,30 +74,35 @@ public class ThirdPartyAlertTask implements Task, LogEnabled {
m_thirdPartyAlert
.
put
(
entity
);
}
private
String
connectHttpUrl
(
Http
http
)
{
String
type
=
http
.
getType
();
String
result
=
null
;
String
paras
=
http
.
getPars
();
private
String
buildPars
(
Map
<
String
,
Par
>
paras
)
{
String
[]
s
=
new
String
[
paras
.
size
()];
int
i
=
0
;
if
(
StringUtils
.
isNotEmpty
(
paras
))
{
paras
=
paras
.
replaceAll
(
"[;]"
,
"&"
);
http
.
setPars
(
paras
);
for
(
Entry
<
String
,
Par
>
entry
:
paras
.
entrySet
(
))
{
Par
par
=
entry
.
getValue
(
);
s
[
i
++]
=
par
.
getId
()
+
"="
+
entry
.
getValue
().
getValue
(
);
}
return
StringUtils
.
join
(
s
,
"&"
);
}
public
boolean
connectHttpUrl
(
Http
http
)
{
boolean
result
=
false
;
String
type
=
http
.
getType
();
String
url
=
http
.
getUrl
();
Map
<
String
,
Par
>
paras
=
http
.
getPars
();
String
joined
=
null
;
try
{
if
(
"get"
.
equalsIgnoreCase
(
type
))
{
String
url
=
http
.
getUrl
();
if
(
paras
!=
null
)
{
joined
=
buildPars
(
paras
);
}
if
(
StringUtils
.
isNotEmpty
(
paras
))
{
url
+=
"?"
+
paras
;
}
result
=
m_httpMonitor
.
readFromGet
(
url
);
}
else
if
(
"post"
.
equalsIgnoreCase
(
type
))
{
String
url
=
http
.
getUrl
();
result
=
m_httpMonitor
.
readFromPost
(
url
,
paras
);
if
(
"get"
.
equalsIgnoreCase
(
type
))
{
if
(
StringUtils
.
isNotEmpty
(
joined
))
{
url
+=
"?"
+
joined
;
}
}
catch
(
Exception
e
)
{
m_logger
.
error
(
e
.
getMessage
(),
e
);
result
=
m_httpConnector
.
readFromGet
(
url
);
}
else
if
(
"post"
.
equalsIgnoreCase
(
type
))
{
result
=
m_httpConnector
.
readFromPost
(
url
,
joined
);
}
return
result
;
}
...
...
@@ -97,10 +111,8 @@ public class ThirdPartyAlertTask implements Task, LogEnabled {
List
<
Http
>
https
=
m_configManager
.
queryHttps
();
for
(
Http
http
:
https
)
{
String
result
=
connectHttpUrl
(
http
);
if
(
StringUtils
.
isEmpty
(
result
))
{
new
HttpReconnector
(
this
,
http
,
current
+
DURATION
);
if
(!
connectHttpUrl
(
http
))
{
Threads
.
forGroup
(
"Cat"
).
start
(
new
HttpReconnector
(
this
,
http
,
current
+
DURATION
));
}
}
}
...
...
@@ -123,50 +135,56 @@ public class ThirdPartyAlertTask implements Task, LogEnabled {
ThirdPartyAlertEntity
entity
=
new
ThirdPartyAlertEntity
();
String
url
=
http
.
getUrl
();
String
type
=
http
.
getType
();
String
pars
=
http
.
getPars
();
String
details
=
"HTTP URL["
+
url
+
"?"
+
pars
+
"] "
+
type
.
toUpperCase
()
+
"无法访问
"
;
Map
<
String
,
Par
>
pars
=
http
.
getPars
();
String
details
=
"HTTP URL["
+
url
+
"?"
+
buildPars
(
pars
)
+
"] "
+
type
.
toUpperCase
()
+
"访问出现异常
"
;
entity
.
setDomain
s
(
http
.
getDomains
()).
setType
(
type
).
setDetails
(
details
);
entity
.
setDomain
(
http
.
getDomain
()).
setType
(
type
).
setDetails
(
details
);
return
entity
;
}
public
class
HttpReconnector
{
private
Timer
m_timer
;
public
class
HttpReconnector
implements
Task
{
public
HttpReconnector
(
ThirdPartyAlertTask
alertTask
,
Http
http
,
long
deadLine
)
{
m_timer
=
new
Timer
();
m_timer
.
schedule
(
new
RemindTask
(
alertTask
,
http
,
deadLine
),
0
,
5
*
1000
);
}
class
RemindTask
extends
TimerTask
{
private
int
m_reconncetNum
=
2
;
private
ThirdPartyAlertBuilder
m_alertTask
;
private
ThirdPartyAlertTask
m_alertTask
;
private
int
m_retryTimes
=
2
;
private
Http
m_http
;
private
Http
m_http
;
private
long
m_deadLine
;
private
long
m_deadLine
;
public
RemindTask
(
ThirdPartyAlertTask
alertTask
,
Http
http
,
long
deadLine
)
{
m_alertTask
=
alertTask
;
m_http
=
http
;
m_deadLine
=
deadLine
;
}
public
void
run
()
{
if
(
m_reconncetNum
>
0
&&
System
.
currentTimeMillis
()
<
m_deadLine
)
{
m_reconncetNum
--;
String
result
=
m_alertTask
.
connectHttpUrl
(
m_http
);
public
HttpReconnector
(
ThirdPartyAlertBuilder
alertTask
,
Http
http
,
long
deadLine
)
{
m_http
=
http
;
m_alertTask
=
alertTask
;
m_deadLine
=
deadLine
;
}
if
(
StringUtils
.
isNotEmpty
(
result
))
{
m_timer
.
cancel
();
@Override
public
void
run
()
{
while
(
true
)
{
if
(
m_retryTimes
>
0
&&
System
.
currentTimeMillis
()
<
m_deadLine
)
{
m_retryTimes
--;
if
(
m_alertTask
.
connectHttpUrl
(
m_http
))
{
break
;
}
else
{
try
{
Thread
.
sleep
(
5000
);
}
catch
(
InterruptedException
e
)
{
}
}
}
else
{
m_timer
.
cancel
();
m_alertTask
.
putAlertEnity
(
m_alertTask
.
buildAlertEntity
(
m_http
));
break
;
}
}
}
}
@Override
public
String
getName
()
{
return
"http-reconnector"
;
}
@Override
public
void
shutdown
()
{
}
}
}
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/ThirdPartyAlertEntity.java
浏览文件 @
59979b68
package
com.dianping.cat.report.task.alert.thirdParty
;
import
java.util.List
;
import
com.dianping.cat.home.alert.thirdParty.entity.Domain
;
public
class
ThirdPartyAlertEntity
{
private
String
m_type
;
private
List
<
Domain
>
m_domains
;
private
String
m_domain
;
private
String
m_details
;
...
...
@@ -20,8 +16,8 @@ public class ThirdPartyAlertEntity {
return
m_details
;
}
public
List
<
Domain
>
getDomains
()
{
return
m_domain
s
;
public
String
getDomain
()
{
return
m_domain
;
}
public
ThirdPartyAlertEntity
setType
(
String
type
)
{
...
...
@@ -34,8 +30,8 @@ public class ThirdPartyAlertEntity {
return
this
;
}
public
ThirdPartyAlertEntity
setDomain
s
(
List
<
Domain
>
domains
)
{
m_domain
s
=
domains
;
public
ThirdPartyAlertEntity
setDomain
(
String
domain
)
{
m_domain
=
domain
;
return
this
;
}
...
...
cat-home/src/main/resources/META-INF/dal/model/thirdParty-codegen.xml
浏览文件 @
59979b68
...
...
@@ -7,16 +7,16 @@
<entity
name=
"http"
>
<attribute
name=
"url"
value-type=
"String"
/>
<attribute
name=
"type"
value-type=
"String"
/>
<attribute
name=
"
pars
"
value-type=
"String"
/>
<entity-ref
name=
"
domain"
type=
"list"
names=
"domain
s"
/>
<attribute
name=
"
domain
"
value-type=
"String"
/>
<entity-ref
name=
"
par"
type=
"list"
names=
"par
s"
/>
</entity>
<entity
name=
"
domain
"
>
<entity
name=
"
par
"
>
<attribute
name=
"id"
value-type=
"String"
/>
<attribute
name=
"value"
value-type=
"String"
/>
</entity>
<entity
name=
"socket"
>
<attribute
name=
"ip"
value-type=
"String"
/>
<attribute
name=
"port"
value-type=
"int"
/>
<entity-ref
name=
"domain"
type=
"list"
names=
"domains"
/>
</entity>
</model>
cat-home/src/main/resources/META-INF/dal/model/thirdParty-model.xml
浏览文件 @
59979b68
...
...
@@ -7,17 +7,17 @@
</entity>
<entity
name=
"http"
>
<attribute
name=
"url"
value-type=
"String"
/>
<attribute
name=
"type"
value-type=
"String"
default-value=
"get
"
/>
<attribute
name=
"
pars
"
value-type=
"String"
/>
<entity-ref
name=
"
domain"
type=
"list"
names=
"domain
s"
/>
<attribute
name=
"type"
value-type=
"String
"
/>
<attribute
name=
"
domain
"
value-type=
"String"
/>
<entity-ref
name=
"
par"
type=
"map"
names=
"par
s"
/>
</entity>
<entity
name=
"domain"
>
<attribute
name=
"id"
value-type=
"String"
/>
<entity
name=
"par"
>
<attribute
name=
"id"
value-type=
"String"
key=
"true"
/>
<attribute
name=
"value"
value-type=
"String"
/>
</entity>
<entity
name=
"socket"
>
<attribute
name=
"ip"
value-type=
"String"
/>
<attribute
name=
"port"
value-type=
"int"
/>
<entity-ref
name=
"domain"
type=
"list"
names=
"domains"
/>
</entity>
</model>
cat-home/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
59979b68
...
...
@@ -4540,15 +4540,15 @@
</requirements>
</component>
<component>
<role>
com.dianping.cat.report.task.alert.thirdParty.Http
Moni
tor
</role>
<implementation>
com.dianping.cat.report.task.alert.thirdParty.Http
Moni
tor
</implementation>
<role>
com.dianping.cat.report.task.alert.thirdParty.Http
Connec
tor
</role>
<implementation>
com.dianping.cat.report.task.alert.thirdParty.Http
Connec
tor
</implementation>
</component>
<component>
<role>
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlert
Task
</role>
<implementation>
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlert
Task
</implementation>
<role>
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlert
Builder
</role>
<implementation>
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlert
Builder
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.report.task.alert.thirdParty.Http
Moni
tor
</role>
<role>
com.dianping.cat.report.task.alert.thirdParty.Http
Connec
tor
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlert
</role>
...
...
cat-home/src/main/resources/config/default-thirdParty-config.xml
浏览文件 @
59979b68
<third-party-config>
<http
url=
"http://www.51ping.com:8080"
type=
"get"
/>
<http
url=
"http://www.51ping.com:8080"
type=
"get"
domain=
"Cat"
>
<par
id=
"domain"
value=
"Cat"
/>
<par
id=
"group"
value=
"Cat"
/>
</http>
<http
url=
"http://www.51ping.com:8080"
type=
"post"
/>
<socket
ip=
"10.10.10.1"
port=
"80"
/>
<socket
ip=
"10.10.10.1"
port=
"80"
/>
<socket
ip=
"10.10.10.1"
port=
"80"
/>
</third-party-config>
\ No newline at end of file
cat-home/src/test/resources/config/thirdParty-config.xml
浏览文件 @
59979b68
<third-party-config>
<http
url=
"http://www.51ping.com:8080"
type=
"get"
pars=
"name=name;sex=male
"
>
<
domain
id=
"cat1"
/>
<
domain
id=
"cat2"
/>
<http
url=
"http://www.51ping.com:8080"
type=
"get"
domain=
"Cat
"
>
<
par
id=
"domain"
value=
"Cat"
/>
<
par
id=
"group"
value=
"Cat"
/>
</http>
<http
url=
"http://www.51ping.com:8080"
type=
"post"
pars=
"name=abc;sex=male"
/>
<socket
ip=
"10.10.10.1"
port=
"80"
>
<domain
id=
"cat1"
/>
<domain
id=
"cat2"
/>
</socket>
<http
url=
"http://www.51ping.com:8080"
type=
"post"
/>
<socket
ip=
"10.10.10.1"
port=
"80"
/>
<socket
ip=
"10.10.10.1"
port=
"80"
/>
</third-party-config>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录