Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
f7c23eed
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,发现更多精彩内容 >>
提交
f7c23eed
编写于
7月 22, 2014
作者:
J
jialinsun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
before pull
上级
a52815cb
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
787 addition
and
25 deletion
+787
-25
cat-core/src/main/java/com/dianping/cat/config/app/AppDataService.java
...main/java/com/dianping/cat/config/app/AppDataService.java
+36
-20
cat-home/pom.xml
cat-home/pom.xml
+1
-0
cat-home/src/main/java/com/dianping/cat/CatHomeModule.java
cat-home/src/main/java/com/dianping/cat/CatHomeModule.java
+12
-0
cat-home/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
...n/java/com/dianping/cat/build/ComponentsConfigurator.java
+11
-0
cat-home/src/main/java/com/dianping/cat/report/task/alert/exception/AlertExceptionBuilder.java
...at/report/task/alert/exception/AlertExceptionBuilder.java
+3
-2
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/HttpMonitor.java
...ianping/cat/report/task/alert/thirdParty/HttpMonitor.java
+106
-0
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/ThirdPartyAlert.java
...ing/cat/report/task/alert/thirdParty/ThirdPartyAlert.java
+104
-0
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/ThirdPartyAlertEntity.java
...t/report/task/alert/thirdParty/ThirdPartyAlertEntity.java
+47
-0
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/ThirdPartyAlertTask.java
...cat/report/task/alert/thirdParty/ThirdPartyAlertTask.java
+166
-0
cat-home/src/main/java/com/dianping/cat/system/config/ThirdPartyConfigManager.java
...m/dianping/cat/system/config/ThirdPartyConfigManager.java
+102
-0
cat-home/src/main/java/com/dianping/cat/system/page/config/Action.java
...main/java/com/dianping/cat/system/page/config/Action.java
+3
-1
cat-home/src/main/java/com/dianping/cat/system/page/config/Handler.java
...ain/java/com/dianping/cat/system/page/config/Handler.java
+11
-0
cat-home/src/main/java/com/dianping/cat/system/page/config/JspFile.java
...ain/java/com/dianping/cat/system/page/config/JspFile.java
+3
-1
cat-home/src/main/java/com/dianping/cat/system/page/config/JspViewer.java
...n/java/com/dianping/cat/system/page/config/JspViewer.java
+3
-1
cat-home/src/main/resources/META-INF/dal/model/thirdParty-codegen.xml
.../main/resources/META-INF/dal/model/thirdParty-codegen.xml
+22
-0
cat-home/src/main/resources/META-INF/dal/model/thirdParty-manifest.xml
...main/resources/META-INF/dal/model/thirdParty-manifest.xml
+6
-0
cat-home/src/main/resources/META-INF/dal/model/thirdParty-model.xml
...rc/main/resources/META-INF/dal/model/thirdParty-model.xml
+23
-0
cat-home/src/main/resources/META-INF/plexus/components.xml
cat-home/src/main/resources/META-INF/plexus/components.xml
+56
-0
cat-home/src/main/resources/META-INF/wizard/model/wizard.xml
cat-home/src/main/resources/META-INF/wizard/model/wizard.xml
+3
-0
cat-home/src/main/resources/config/default-thirdParty-config.xml
...e/src/main/resources/config/default-thirdParty-config.xml
+7
-0
cat-home/src/main/webapp/jsp/system/configTree.jsp
cat-home/src/main/webapp/jsp/system/configTree.jsp
+1
-0
cat-home/src/main/webapp/jsp/system/thirdParty/thirdPartyConfig.jsp
...rc/main/webapp/jsp/system/thirdParty/thirdPartyConfig.jsp
+48
-0
cat-home/src/test/resources/config/thirdParty-config.xml
cat-home/src/test/resources/config/thirdParty-config.xml
+13
-0
未找到文件。
cat-core/src/main/java/com/dianping/cat/config/app/AppDataService.java
浏览文件 @
f7c23eed
...
...
@@ -10,7 +10,6 @@ import java.util.Map.Entry;
import
org.unidal.dal.jdbc.DalException
;
import
org.unidal.lookup.annotation.Inject
;
import
org.unidal.tuple.Pair
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.app.AppDataCommand
;
...
...
@@ -52,20 +51,20 @@ public class AppDataService {
if
(
SUCCESS
.
equals
(
type
))
{
datas
=
m_dao
.
findDataByMinuteCode
(
commandId
,
period
,
city
,
operator
,
network
,
appVersion
,
connnectType
,
code
,
platform
,
AppDataCommandEntity
.
READSET_SUCCESS_DATA
);
Pair
<
Integer
,
Map
<
Integer
,
List
<
AppDataCommand
>>>
dataPair
=
convert2AppDataCommandMap
(
datas
);
AppDataCommandMap
convertedData
=
convert2AppDataCommandMap
(
datas
);
return
querySuccessRatio
(
commandId
,
dataPair
);
return
querySuccessRatio
(
commandId
,
convertedData
);
}
else
if
(
REQUEST
.
equals
(
type
))
{
datas
=
m_dao
.
findDataByMinute
(
commandId
,
period
,
city
,
operator
,
network
,
appVersion
,
connnectType
,
code
,
platform
,
AppDataCommandEntity
.
READSET_COUNT_DATA
);
Pair
<
Integer
,
Map
<
Integer
,
List
<
AppDataCommand
>>>
dataPair
=
convert2AppDataCommandMap
(
datas
);
return
queryRequestCount
(
dataPair
);
AppDataCommandMap
convertedData
=
convert2AppDataCommandMap
(
datas
);
return
queryRequestCount
(
convertedData
);
}
else
if
(
DELAY
.
equals
(
type
))
{
datas
=
m_dao
.
findDataByMinute
(
commandId
,
period
,
city
,
operator
,
network
,
appVersion
,
connnectType
,
code
,
platform
,
AppDataCommandEntity
.
READSET_AVG_DATA
);
Pair
<
Integer
,
Map
<
Integer
,
List
<
AppDataCommand
>>>
dataPair
=
convert2AppDataCommandMap
(
datas
);
AppDataCommandMap
dataPair
=
convert2AppDataCommandMap
(
datas
);
return
queryDelayAvg
(
dataPair
);
}
else
{
throw
new
RuntimeException
(
"unexpected query type, type:"
+
type
);
...
...
@@ -76,7 +75,7 @@ public class AppDataService {
return
null
;
}
private
Pair
<
Integer
,
Map
<
Integer
,
List
<
AppDataCommand
>>>
convert2AppDataCommandMap
(
List
<
AppDataCommand
>
fromDatas
)
{
private
AppDataCommandMap
convert2AppDataCommandMap
(
List
<
AppDataCommand
>
fromDatas
)
{
Map
<
Integer
,
List
<
AppDataCommand
>>
dataMap
=
new
LinkedHashMap
<
Integer
,
List
<
AppDataCommand
>>();
int
max
=
-
1
;
...
...
@@ -95,18 +94,16 @@ public class AppDataService {
}
data
.
add
(
from
);
}
int
n
=
max
/
5
;
return
new
Pair
<
Integer
,
Map
<
Integer
,
List
<
AppDataCommand
>>>
(
n
,
dataMap
);
return
new
AppDataCommandMap
(
n
,
dataMap
);
}
public
double
[]
querySuccessRatio
(
int
commandId
,
Pair
<
Integer
,
Map
<
Integer
,
List
<
AppDataCommand
>>>
dataPair
)
{
double
[]
value
=
new
double
[
dataPair
.
getKey
()];
Map
<
Integer
,
List
<
AppDataCommand
>>
dataMap
=
dataPair
.
getValue
();
public
double
[]
querySuccessRatio
(
int
commandId
,
AppDataCommandMap
convertedData
)
{
double
[]
value
=
new
double
[
convertedData
.
getMaxSize
()];
try
{
for
(
Entry
<
Integer
,
List
<
AppDataCommand
>>
entry
:
dataMap
.
entrySet
())
{
for
(
Entry
<
Integer
,
List
<
AppDataCommand
>>
entry
:
convertedData
.
getAppDataCommands
()
.
entrySet
())
{
int
key
=
entry
.
getKey
();
long
success
=
0
;
long
sum
=
0
;
...
...
@@ -139,10 +136,10 @@ public class AppDataService {
return
false
;
}
public
double
[]
queryRequestCount
(
Pair
<
Integer
,
Map
<
Integer
,
List
<
AppDataCommand
>>>
dataPair
)
{
double
[]
value
=
new
double
[
dataPair
.
getKey
()];
public
double
[]
queryRequestCount
(
AppDataCommandMap
convertedData
)
{
double
[]
value
=
new
double
[
convertedData
.
getMaxSize
()];
for
(
Entry
<
Integer
,
List
<
AppDataCommand
>>
entry
:
dataPair
.
getValue
().
entrySet
())
{
for
(
Entry
<
Integer
,
List
<
AppDataCommand
>>
entry
:
convertedData
.
getAppDataCommands
().
entrySet
())
{
for
(
AppDataCommand
data
:
entry
.
getValue
())
{
long
count
=
data
.
getAccessNumberSum
();
...
...
@@ -152,10 +149,10 @@ public class AppDataService {
return
value
;
}
public
double
[]
queryDelayAvg
(
Pair
<
Integer
,
Map
<
Integer
,
List
<
AppDataCommand
>>>
dataPair
)
{
double
[]
value
=
new
double
[
dataPair
.
getKey
()];
public
double
[]
queryDelayAvg
(
AppDataCommandMap
convertedData
)
{
double
[]
value
=
new
double
[
convertedData
.
getMaxSize
()];
for
(
Entry
<
Integer
,
List
<
AppDataCommand
>>
entry
:
dataPair
.
getValue
().
entrySet
())
{
for
(
Entry
<
Integer
,
List
<
AppDataCommand
>>
entry
:
convertedData
.
getAppDataCommands
().
entrySet
())
{
for
(
AppDataCommand
data
:
entry
.
getValue
())
{
long
count
=
data
.
getAccessNumberSum
();
long
sum
=
data
.
getResponseSumTimeSum
();
...
...
@@ -166,5 +163,24 @@ public class AppDataService {
}
return
value
;
}
public
class
AppDataCommandMap
{
private
int
m_maxSize
;
private
Map
<
Integer
,
List
<
AppDataCommand
>>
m_appDataCommands
;
public
int
getMaxSize
()
{
return
m_maxSize
;
}
public
Map
<
Integer
,
List
<
AppDataCommand
>>
getAppDataCommands
()
{
return
m_appDataCommands
;
}
public
AppDataCommandMap
(
int
maxSize
,
Map
<
Integer
,
List
<
AppDataCommand
>>
appDataCommands
)
{
m_maxSize
=
maxSize
;
m_appDataCommands
=
appDataCommands
;
}
}
}
cat-home/pom.xml
浏览文件 @
f7c23eed
...
...
@@ -161,6 +161,7 @@
${basedir}/src/main/resources/META-INF/dal/model/monitor-rules-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/alertconfig-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/alertsummary-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/thirdParty-manifest.xml,
</manifest>
</configuration>
</execution>
...
...
cat-home/src/main/java/com/dianping/cat/CatHomeModule.java
浏览文件 @
f7c23eed
...
...
@@ -18,6 +18,8 @@ import com.dianping.cat.report.task.alert.business.BusinessAlert;
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.ThirdPartyAlertTask
;
import
com.dianping.cat.report.task.product.ProjectUpdateTask
;
import
com.dianping.cat.report.view.DomainNavManager
;
import
com.dianping.cat.system.config.ConfigReloadTask
;
...
...
@@ -48,6 +50,10 @@ 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
);
...
...
@@ -55,12 +61,18 @@ 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);
Threads
.
forGroup
(
"Cat"
).
start
(
networkAlert
);
Threads
.
forGroup
(
"Cat"
).
start
(
systemAlert
);
Threads
.
forGroup
(
"Cat"
).
start
(
metricAlert
);
Threads
.
forGroup
(
"Cat"
).
start
(
exceptionAlert
);
Threads
.
forGroup
(
"Cat"
).
start
(
productUpdateTask
);
Threads
.
forGroup
(
"Cat"
).
start
(
thirdPartyAlert
);
Threads
.
forGroup
(
"Cat"
).
start
(
thirdPartyAlertTask
);
}
executeAlarmModule
(
ctx
);
}
...
...
cat-home/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
浏览文件 @
f7c23eed
...
...
@@ -76,6 +76,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.HttpMonitor
;
import
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlert
;
import
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlertTask
;
import
com.dianping.cat.report.task.product.ProjectUpdateTask
;
import
com.dianping.cat.report.view.DomainNavManager
;
import
com.dianping.cat.service.IpService
;
...
...
@@ -89,6 +92,7 @@ import com.dianping.cat.system.config.MetricGroupConfigManager;
import
com.dianping.cat.system.config.NetGraphConfigManager
;
import
com.dianping.cat.system.config.NetworkRuleConfigManager
;
import
com.dianping.cat.system.config.SystemRuleConfigManager
;
import
com.dianping.cat.system.config.ThirdPartyConfigManager
;
import
com.dianping.cat.system.tool.DefaultMailImpl
;
import
com.dianping.cat.system.tool.MailSMS
;
...
...
@@ -127,6 +131,12 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
ExceptionConfigManager
.
class
,
AlertExceptionBuilder
.
class
,
AlertDao
.
class
).
req
(
ModelService
.
class
,
TopAnalyzer
.
ID
));
all
.
add
(
C
(
ThirdPartyAlert
.
class
));
all
.
add
(
C
(
HttpMonitor
.
class
));
all
.
add
(
C
(
ThirdPartyAlertTask
.
class
).
req
(
HttpMonitor
.
class
,
ThirdPartyAlert
.
class
,
ThirdPartyConfigManager
.
class
));
return
all
;
}
...
...
@@ -215,6 +225,7 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
all
.
add
(
C
(
BusinessRuleConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
AlertConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
NetGraphConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
ThirdPartyConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
ConfigReloadTask
.
class
).
req
(
MetricConfigManager
.
class
,
ProductLineConfigManager
.
class
));
return
all
;
...
...
cat-home/src/main/java/com/dianping/cat/report/task/alert/exception/AlertExceptionBuilder.java
浏览文件 @
f7c23eed
...
...
@@ -41,7 +41,7 @@ public class AlertExceptionBuilder {
double
totalWarnLimit
=
totalLimitPair
.
getKey
();
double
totalErrorLimit
=
totalLimitPair
.
getValue
();
double
totalException
=
0
;
for
(
Entry
<
String
,
Double
>
entry
:
item
.
getException
().
entrySet
())
{
String
exceptionName
=
entry
.
getKey
();
...
...
@@ -127,7 +127,8 @@ public class AlertExceptionBuilder {
public
String
buildMailContent
(
String
exceptions
,
String
domain
,
String
contactInfo
)
{
String
content
=
buildContent
(
exceptions
,
domain
,
contactInfo
);
String
url
=
"http://cat.dianpingoa.com/cat/r/p?domain="
+
domain
;
String
date
=
new
SimpleDateFormat
(
"yyyyMMddHH"
).
format
(
new
Date
());
String
url
=
"http://cat.dianpingoa.com/cat/r/p?domain="
+
domain
+
"&date="
+
date
;
String
mailContent
=
content
+
"<br/>"
+
" <a href='"
+
url
+
"'>点击此处查看详情</a>"
;
return
mailContent
;
...
...
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/HttpMonitor.java
0 → 100644
浏览文件 @
f7c23eed
package
com.dianping.cat.report.task.alert.thirdParty
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStreamWriter
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
org.codehaus.plexus.util.StringUtils
;
import
org.unidal.helper.Files
;
public
class
HttpMonitor
{
public
String
readFromGet
(
String
url
)
{
HttpURLConnection
connection
=
null
;
InputStream
in
=
null
;
BufferedReader
reader
=
null
;
try
{
URL
address_url
=
new
URL
(
url
);
connection
=
(
HttpURLConnection
)
address_url
.
openConnection
();
connection
.
setRequestMethod
(
"GET"
);
connection
.
setConnectTimeout
(
5000
);
connection
.
setReadTimeout
(
5000
);
int
response_code
=
connection
.
getResponseCode
();
if
(
response_code
==
HttpURLConnection
.
HTTP_OK
)
{
in
=
connection
.
getInputStream
();
String
result
=
Files
.
forIO
().
readFrom
(
in
,
"utf-8"
);
return
result
;
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
finally
{
if
(
connection
!=
null
)
{
connection
.
disconnect
();
}
try
{
if
(
in
!=
null
)
{
in
.
close
();
}
if
(
reader
!=
null
)
{
reader
.
close
();
}
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
return
null
;
}
public
String
readFromPost
(
String
url
,
String
content
)
{
HttpURLConnection
connection
=
null
;
BufferedReader
reader
=
null
;
OutputStreamWriter
writer
=
null
;
InputStream
in
=
null
;
try
{
URL
postUrl
=
new
URL
(
url
);
connection
=
(
HttpURLConnection
)
postUrl
.
openConnection
();
connection
.
setDoOutput
(
true
);
connection
.
setDoInput
(
true
);
connection
.
setRequestMethod
(
"POST"
);
connection
.
setUseCaches
(
false
);
connection
.
setInstanceFollowRedirects
(
true
);
connection
.
setConnectTimeout
(
5000
);
connection
.
setReadTimeout
(
5000
);
if
(
StringUtils
.
isNotEmpty
(
content
))
{
writer
=
new
OutputStreamWriter
(
connection
.
getOutputStream
());
writer
.
write
(
content
);
writer
.
flush
();
}
int
response_code
=
connection
.
getResponseCode
();
if
(
response_code
==
HttpURLConnection
.
HTTP_OK
)
{
in
=
connection
.
getInputStream
();
String
result
=
Files
.
forIO
().
readFrom
(
in
,
"utf-8"
);
return
result
;
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
finally
{
if
(
connection
!=
null
)
{
connection
.
disconnect
();
}
try
{
if
(
reader
!=
null
)
{
reader
.
close
();
}
if
(
writer
!=
null
)
{
writer
.
close
();
}
if
(
in
!=
null
)
{
in
.
close
();
}
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
return
null
;
}
}
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/ThirdPartyAlert.java
0 → 100644
浏览文件 @
f7c23eed
package
com.dianping.cat.report.task.alert.thirdParty
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.List
;
import
java.util.concurrent.ArrayBlockingQueue
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.TimeUnit
;
import
org.codehaus.plexus.logging.LogEnabled
;
import
org.codehaus.plexus.logging.Logger
;
import
org.unidal.helper.Threads.Task
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.helper.TimeUtil
;
import
com.dianping.cat.message.Transaction
;
public
class
ThirdPartyAlert
implements
Task
,
LogEnabled
{
private
Logger
m_logger
;
private
static
final
long
DURATION
=
TimeUtil
.
ONE_MINUTE
;
private
BlockingQueue
<
ThirdPartyAlertEntity
>
m_entities
=
new
ArrayBlockingQueue
<
ThirdPartyAlertEntity
>(
5000
);
public
boolean
put
(
ThirdPartyAlertEntity
entity
)
{
boolean
result
=
true
;
try
{
boolean
temp
=
m_entities
.
offer
(
entity
,
5
,
TimeUnit
.
MILLISECONDS
);
if
(!
temp
)
{
result
=
temp
;
}
return
result
;
}
catch
(
Exception
e
)
{
m_logger
.
error
(
e
.
getMessage
());
}
return
false
;
}
@Override
public
void
run
()
{
boolean
active
=
true
;
try
{
Thread
.
sleep
(
5000
);
}
catch
(
InterruptedException
e
)
{
active
=
false
;
}
while
(
active
)
{
long
current
=
System
.
currentTimeMillis
();
int
minute
=
Calendar
.
getInstance
().
get
(
Calendar
.
MINUTE
);
String
minuteStr
=
String
.
valueOf
(
minute
);
if
(
minute
<
10
)
{
minuteStr
=
'0'
+
minuteStr
;
}
Transaction
t
=
Cat
.
newTransaction
(
"ThirdPartyAlert"
,
"M"
+
minuteStr
);
try
{
List
<
ThirdPartyAlertEntity
>
alertEntities
=
new
ArrayList
<
ThirdPartyAlertEntity
>();
while
(
m_entities
.
size
()
>
0
)
{
ThirdPartyAlertEntity
entity
=
m_entities
.
poll
(
5
,
TimeUnit
.
MILLISECONDS
);
alertEntities
.
add
(
entity
);
}
for
(
ThirdPartyAlertEntity
entity
:
alertEntities
)
{
System
.
out
.
println
(
entity
.
toString
());
}
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
t
.
setStatus
(
e
);
}
finally
{
t
.
complete
();
}
long
duration
=
System
.
currentTimeMillis
()
-
current
;
try
{
if
(
duration
<
DURATION
)
{
Thread
.
sleep
(
DURATION
-
duration
);
}
}
catch
(
InterruptedException
e
)
{
active
=
false
;
}
}
}
@Override
public
void
enableLogging
(
Logger
logger
)
{
m_logger
=
logger
;
}
@Override
public
String
getName
()
{
return
"thirdParty-alert"
;
}
@Override
public
void
shutdown
()
{
}
}
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/ThirdPartyAlertEntity.java
0 → 100644
浏览文件 @
f7c23eed
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_details
;
public
String
getType
()
{
return
m_type
;
}
public
String
getDetails
()
{
return
m_details
;
}
public
List
<
Domain
>
getDomains
()
{
return
m_domains
;
}
public
ThirdPartyAlertEntity
setType
(
String
type
)
{
m_type
=
type
;
return
this
;
}
public
ThirdPartyAlertEntity
setDetails
(
String
details
)
{
m_details
=
details
;
return
this
;
}
public
ThirdPartyAlertEntity
setDomains
(
List
<
Domain
>
domains
)
{
m_domains
=
domains
;
return
this
;
}
@Override
public
String
toString
()
{
return
"ThirdPartyAlertEntity [m_type="
+
m_type
+
", m_domains="
+
m_domains
+
", m_details="
+
m_details
+
"]"
;
}
}
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/ThirdPartyAlertTask.java
0 → 100644
浏览文件 @
f7c23eed
package
com.dianping.cat.report.task.alert.thirdParty
;
import
java.util.List
;
import
java.util.Timer
;
import
java.util.TimerTask
;
import
org.codehaus.plexus.logging.LogEnabled
;
import
org.codehaus.plexus.logging.Logger
;
import
org.codehaus.plexus.util.StringUtils
;
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.message.Transaction
;
import
com.dianping.cat.system.config.ThirdPartyConfigManager
;
public
class
ThirdPartyAlertTask
implements
Task
,
LogEnabled
{
@Inject
private
HttpMonitor
m_httpMonitor
;
@Inject
private
ThirdPartyAlert
m_thirdPartyAlert
;
@Inject
private
ThirdPartyConfigManager
m_configManager
;
private
static
final
long
DURATION
=
TimeUtil
.
ONE_MINUTE
;
private
Logger
m_logger
;
@Override
public
void
run
()
{
boolean
active
=
true
;
while
(
active
)
{
long
current
=
System
.
currentTimeMillis
();
Transaction
t
=
Cat
.
newTransaction
(
"Task"
,
"ThirdPartyAlert"
);
try
{
buildAlertEntities
(
current
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
t
.
setStatus
(
e
);
m_logger
.
error
(
e
.
getMessage
());
}
finally
{
t
.
complete
();
}
long
duration
=
System
.
currentTimeMillis
()
-
current
;
try
{
if
(
duration
<
DURATION
)
{
Thread
.
sleep
(
DURATION
-
duration
);
}
}
catch
(
InterruptedException
e
)
{
active
=
false
;
}
}
}
public
void
putAlertEnity
(
ThirdPartyAlertEntity
entity
)
{
m_thirdPartyAlert
.
put
(
entity
);
}
private
String
connectHttpUrl
(
Http
http
)
{
String
type
=
http
.
getType
();
String
result
=
""
;
String
paras
=
http
.
getPars
();
if
(
StringUtils
.
isNotEmpty
(
paras
))
{
paras
=
http
.
getPars
().
replaceAll
(
";"
,
"&"
);
}
if
(
"get"
.
equalsIgnoreCase
(
http
.
getType
()))
{
String
url
=
http
.
getUrl
();
url
+=
"?"
+
paras
;
result
=
m_httpMonitor
.
readFromGet
(
url
);
}
else
if
(
"post"
.
equalsIgnoreCase
(
type
))
{
String
url
=
http
.
getUrl
();
result
=
m_httpMonitor
.
readFromPost
(
url
,
paras
);
}
else
{
throw
new
RuntimeException
(
"Illeagle access type: "
+
type
);
}
return
result
;
}
private
void
buildAlertEntities
(
long
current
)
{
List
<
Http
>
https
=
m_configManager
.
queryHttps
();
for
(
Http
http
:
https
)
{
String
result
=
connectHttpUrl
(
http
);
if
(
StringUtils
.
isEmpty
(
result
))
{
new
HttpReconnector
(
this
,
http
,
current
+
DURATION
);
}
}
}
@Override
public
String
getName
()
{
return
"thirdParty-alert-task"
;
}
@Override
public
void
enableLogging
(
Logger
logger
)
{
m_logger
=
logger
;
}
@Override
public
void
shutdown
()
{
}
public
ThirdPartyAlertEntity
buildAlertEntity
(
Http
http
)
{
ThirdPartyAlertEntity
entity
=
new
ThirdPartyAlertEntity
();
String
url
=
http
.
getUrl
();
String
type
=
http
.
getType
();
String
pars
=
http
.
getPars
();
String
details
=
"HTTP URL["
+
url
+
"?"
+
pars
+
"] "
+
type
.
toUpperCase
()
+
"无法访问"
;
entity
.
setDomains
(
http
.
getDomains
()).
setType
(
type
).
setDetails
(
details
);
return
entity
;
}
public
class
HttpReconnector
{
private
Timer
m_timer
;
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
ThirdPartyAlertTask
m_alertTask
;
private
Http
m_http
;
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
);
if
(
StringUtils
.
isNotEmpty
(
result
))
{
m_timer
.
cancel
();
}
}
else
{
m_timer
.
cancel
();
m_alertTask
.
putAlertEnity
(
m_alertTask
.
buildAlertEntity
(
m_http
));
}
}
}
}
}
cat-home/src/main/java/com/dianping/cat/system/config/ThirdPartyConfigManager.java
0 → 100644
浏览文件 @
f7c23eed
package
com.dianping.cat.system.config
;
import
java.util.List
;
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.alert.thirdParty.entity.Http
;
import
com.dianping.cat.home.alert.thirdParty.entity.Socket
;
import
com.dianping.cat.home.alert.thirdParty.entity.ThirdPartyConfig
;
import
com.dianping.cat.home.alert.thirdParty.transform.DefaultSaxParser
;
public
class
ThirdPartyConfigManager
implements
Initializable
{
@Inject
private
ConfigDao
m_configDao
;
private
int
m_configId
;
private
ThirdPartyConfig
m_thirdPartyConfig
;
private
static
final
String
CONFIG_NAME
=
"thirdPartyConfig"
;
public
List
<
Http
>
queryHttps
()
{
return
m_thirdPartyConfig
.
getHttps
();
}
public
List
<
Socket
>
querSockets
()
{
return
m_thirdPartyConfig
.
getSockets
();
}
public
ThirdPartyConfig
getConfig
()
{
return
m_thirdPartyConfig
;
}
public
boolean
insert
(
String
xml
)
{
try
{
m_thirdPartyConfig
=
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_thirdPartyConfig
.
toString
());
m_configDao
.
updateByPK
(
config
,
ConfigEntity
.
UPDATESET_FULL
);
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
return
false
;
}
}
return
true
;
}
@Override
public
void
initialize
()
throws
InitializationException
{
try
{
Config
config
=
m_configDao
.
findByName
(
CONFIG_NAME
,
ConfigEntity
.
READSET_FULL
);
String
content
=
config
.
getContent
();
m_thirdPartyConfig
=
DefaultSaxParser
.
parse
(
content
);
m_configId
=
config
.
getId
();
}
catch
(
DalNotFoundException
e
)
{
try
{
String
content
=
Files
.
forIO
().
readFrom
(
this
.
getClass
().
getResourceAsStream
(
"/config/default-thirdParty-config.xml"
),
"utf-8"
);
Config
config
=
m_configDao
.
createLocal
();
config
.
setName
(
CONFIG_NAME
);
config
.
setContent
(
content
);
m_configDao
.
insert
(
config
);
m_thirdPartyConfig
=
DefaultSaxParser
.
parse
(
content
);
m_configId
=
config
.
getId
();
}
catch
(
Exception
ex
)
{
Cat
.
logError
(
ex
);
}
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
if
(
m_thirdPartyConfig
==
null
)
{
m_thirdPartyConfig
=
new
ThirdPartyConfig
();
}
}
}
cat-home/src/main/java/com/dianping/cat/system/page/config/Action.java
浏览文件 @
f7c23eed
...
...
@@ -95,7 +95,9 @@ public enum Action implements org.unidal.web.mvc.Action {
NET_GRAPH_CONFIG_UPDATE
(
"netGraphConfigUpdate"
),
APP_CONFIG_UPDATE
(
"appConfigUpdate"
);
APP_CONFIG_UPDATE
(
"appConfigUpdate"
),
THIRD_PARTY_CONFIG_UPDATE
(
"thirdPartyConfigUpdate"
);
private
String
m_name
;
...
...
cat-home/src/main/java/com/dianping/cat/system/page/config/Handler.java
浏览文件 @
f7c23eed
...
...
@@ -55,6 +55,7 @@ import com.dianping.cat.system.config.MetricGroupConfigManager;
import
com.dianping.cat.system.config.NetGraphConfigManager
;
import
com.dianping.cat.system.config.NetworkRuleConfigManager
;
import
com.dianping.cat.system.config.SystemRuleConfigManager
;
import
com.dianping.cat.system.config.ThirdPartyConfigManager
;
public
class
Handler
implements
PageHandler
<
Context
>
{
@Inject
...
...
@@ -114,6 +115,9 @@ public class Handler implements PageHandler<Context> {
@Inject
private
NetGraphConfigManager
m_netGraphConfigManager
;
@Inject
private
ThirdPartyConfigManager
m_thirdPartyConfigManager
;
private
void
deleteAggregationRule
(
Payload
payload
)
{
m_aggreationConfigManager
.
deleteAggregationRule
(
payload
.
getPattern
());
}
...
...
@@ -468,6 +472,13 @@ public class Handler implements PageHandler<Context> {
}
model
.
setContent
(
m_appConfigManager
.
getConfig
().
toString
());
break
;
case
THIRD_PARTY_CONFIG_UPDATE:
String
thirdPartyConfig
=
payload
.
getContent
();
if
(!
StringUtils
.
isEmpty
(
thirdPartyConfig
))
{
model
.
setOpState
(
m_thirdPartyConfigManager
.
insert
(
thirdPartyConfig
));
}
model
.
setContent
(
m_thirdPartyConfigManager
.
getConfig
().
toString
());
break
;
}
m_jspViewer
.
view
(
ctx
,
model
);
}
...
...
cat-home/src/main/java/com/dianping/cat/system/page/config/JspFile.java
浏览文件 @
f7c23eed
...
...
@@ -61,7 +61,9 @@ public enum JspFile {
NET_GRAPH_CONFIG_UPDATE
(
"/jsp/system/netGraphConfig/netGraphConfig.jsp"
),
APP_CONFIG_UPDATE
(
"/jsp/system/appConfig/appConfig.jsp"
);
APP_CONFIG_UPDATE
(
"/jsp/system/appConfig/appConfig.jsp"
),
THIRD_PARTY_CONFIG_UPDATE
(
"/jsp/system/thirdParty/thirdPartyConfig.jsp"
);
private
String
m_path
;
...
...
cat-home/src/main/java/com/dianping/cat/system/page/config/JspViewer.java
浏览文件 @
f7c23eed
...
...
@@ -108,8 +108,10 @@ public class JspViewer extends BaseJspViewer<SystemPage, Action, Context, Model>
return
JspFile
.
METRIC_GROUP_CONFIG_UPDATE
.
getPath
();
case
APP_CONFIG_UPDATE:
return
JspFile
.
APP_CONFIG_UPDATE
.
getPath
();
case
THIRD_PARTY_CONFIG_UPDATE:
return
JspFile
.
THIRD_PARTY_CONFIG_UPDATE
.
getPath
();
}
throw
new
RuntimeException
(
"Unknown action: "
+
action
);
}
}
cat-home/src/main/resources/META-INF/dal/model/thirdParty-codegen.xml
0 → 100644
浏览文件 @
f7c23eed
<?xml version="1.0" encoding="UTF-8"?>
<model>
<entity
name=
"third-party-config"
root=
"true"
>
<entity-ref
name=
"http"
type=
"list"
names=
"https"
/>
<entity-ref
name=
"socket"
type=
"list"
names=
"sockets"
/>
</entity>
<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=
"domains"
/>
</entity>
<entity
name=
"domain"
>
<attribute
name=
"id"
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-manifest.xml
0 → 100644
浏览文件 @
f7c23eed
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<file
path=
"thirdParty-codegen.xml"
/>
<file
path=
"thirdParty-model.xml"
/>
</manifest>
cat-home/src/main/resources/META-INF/dal/model/thirdParty-model.xml
0 → 100644
浏览文件 @
f7c23eed
<?xml version="1.0" encoding="UTF-8"?>
<model
model-package=
"com.dianping.cat.home.alert.thirdParty"
enable-merger=
"false"
enable-sax-parser=
"true"
enable-base-visitor=
"false"
>
<entity
name=
"third-party-config"
root=
"true"
>
<entity-ref
name=
"http"
type=
"list"
names=
"https"
/>
<entity-ref
name=
"socket"
type=
"list"
names=
"sockets"
/>
</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=
"domains"
/>
</entity>
<entity
name=
"domain"
>
<attribute
name=
"id"
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
浏览文件 @
f7c23eed
...
...
@@ -193,6 +193,15 @@
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.system.config.ThirdPartyConfigManager
</role>
<implementation>
com.dianping.cat.system.config.ThirdPartyConfigManager
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.core.config.ConfigDao
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.system.config.ConfigReloadTask
</role>
<implementation>
com.dianping.cat.system.config.ConfigReloadTask
</implementation>
...
...
@@ -4161,6 +4170,9 @@
<requirement>
<role>
com.dianping.cat.system.config.NetGraphConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.system.config.ThirdPartyConfigManager
</role>
</requirement>
</requirements>
</component>
<component>
...
...
@@ -4229,6 +4241,15 @@
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.system.config.ThirdPartyConfigManager
</role>
<implementation>
com.dianping.cat.system.config.ThirdPartyConfigManager
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.core.config.ConfigDao
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.system.page.plugin.Handler
</role>
<implementation>
com.dianping.cat.system.page.plugin.Handler
</implementation>
...
...
@@ -4488,6 +4509,29 @@
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlert
</role>
<implementation>
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlert
</implementation>
</component>
<component>
<role>
com.dianping.cat.report.task.alert.thirdParty.HttpMonitor
</role>
<implementation>
com.dianping.cat.report.task.alert.thirdParty.HttpMonitor
</implementation>
</component>
<component>
<role>
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlertTask
</role>
<implementation>
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlertTask
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.report.task.alert.thirdParty.HttpMonitor
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlert
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.system.config.ThirdPartyConfigManager
</role>
</requirement>
</requirements>
</component>
<component>
<role>
org.unidal.initialization.Module
</role>
<role-hint>
cat-home
</role-hint>
...
...
@@ -7912,6 +7956,9 @@
<requirement>
<role>
com.dianping.cat.system.config.NetGraphConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.system.config.ThirdPartyConfigManager
</role>
</requirement>
</requirements>
</component>
<component>
...
...
@@ -7980,6 +8027,15 @@
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.system.config.ThirdPartyConfigManager
</role>
<implementation>
com.dianping.cat.system.config.ThirdPartyConfigManager
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.core.config.ConfigDao
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.system.page.plugin.Handler
</role>
<implementation>
com.dianping.cat.system.page.plugin.Handler
</implementation>
...
...
cat-home/src/main/resources/META-INF/wizard/model/wizard.xml
浏览文件 @
f7c23eed
...
...
@@ -54,4 +54,7 @@
<model
package=
"com.dianping.cat.home.alertsummary"
name=
"alertsummary"
>
<sample-model>
/Users/leon/Desktop/AlertSummary.xml
</sample-model>
</model>
<model
package=
"com.dianping.cat.home.alert.thirdParty"
name=
"thirdParty"
>
<sample-model>
src/test/resources/config/thirdParty-config.xml
</sample-model>
</model>
</wizard>
cat-home/src/main/resources/config/default-thirdParty-config.xml
0 → 100644
浏览文件 @
f7c23eed
<third-party-config>
<http
url=
"http://www.51ping.com:8080"
type=
"get"
/>
<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/main/webapp/jsp/system/configTree.jsp
浏览文件 @
f7c23eed
...
...
@@ -12,6 +12,7 @@
<li
class=
"text-right"
id=
"urlPatternList"
><a
href=
"?op=urlPatterns"
><strong>
URL合并规则
</strong></a></li>
<li
class=
"text-right"
id=
"aggregationList"
><a
href=
"?op=aggregations"
><strong>
JS合并规则
</strong></a></li>
<li
class=
"text-right"
id=
"appConfigUpdate"
><a
href=
"?op=appConfigUpdate"
><strong>
APP监控配置
</strong></a></li>
<li
class=
"text-right"
id=
"thirdPartyConfigUpdate"
><a
href=
"?op=thirdPartyConfigUpdate"
><strong>
第三方监控配置
</strong></a></li>
<li
class=
'nav-header'
><h4>
业务监控配置
</h4></li>
<li
class=
"text-right"
id=
"metricConfigList"
><a
href=
"?op=metricConfigList"
><strong>
业务监控规则
</strong></a></li>
<li
class=
"text-right"
id=
"metricGroupConfigUpdate"
><a
href=
"?op=metricGroupConfigUpdate"
><strong>
业务指标分组
</strong></a></li>
...
...
cat-home/src/main/webapp/jsp/system/thirdParty/thirdPartyConfig.jsp
0 → 100644
浏览文件 @
f7c23eed
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<%@ taglib
prefix=
"a"
uri=
"/WEB-INF/app.tld"
%>
<%@ taglib
prefix=
"c"
uri=
"http://java.sun.com/jsp/jstl/core"
%>
<%@ taglib
prefix=
"res"
uri=
"http://www.unidal.org/webres"
%>
<%@ taglib
prefix=
"w"
uri=
"http://www.unidal.org/web/core"
%>
<a:body>
<res:useJs
value=
"
${
res
.
js
.
local
[
'jquery.validate.min.js'
]
}
"
target=
"head-js"
/>
<res:useJs
value=
"
${
res
.
js
.
local
[
'dependencyConfig.js'
]
}
"
target=
"head-js"
/>
<res:useJs
value=
"
${
res
.
js
.
local
[
'alarm_js'
]
}
"
target=
"head-js"
/>
<res:useCss
value=
"
${
res
.
css
.
local
[
'select2.css'
]
}
"
target=
"head-css"
/>
<res:useJs
value=
"
${
res
.
js
.
local
[
'select2.min.js'
]
}
"
target=
"head-js"
/>
<div
class=
"row-fluid"
>
<div
class=
"span2"
>
<%@include
file=
"../configTree.jsp"
%>
</div>
<div
class=
"span10"
>
<form
name=
"thirdPartyConfigUpdate"
id=
"form"
method=
"post"
action=
"${model.pageUri}?op=thirdPartyConfigUpdate"
>
<h4
class=
"text-center text-error"
id=
"state"
>
</h4>
<h4
class=
"text-center text-error"
>
第三方监控配置
</h4>
<table
class=
"table table-striped table-bordered table-condensed table-hover"
>
<tr>
<td><textarea
name=
"content"
style=
"width:auto"
rows=
"20"
cols=
"150"
>
${model.content}
</textarea></td>
</tr>
<tr>
<td
style=
"text-align:center"
><input
class=
'btn btn-primary'
type=
"submit"
name=
"submit"
value=
"提交"
/></td>
</tr>
</table>
</form>
</div>
</div>
</a:body>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
$
(
'
#thirdPartyConfigUpdate
'
).
addClass
(
'
active
'
);
var
state
=
'
${model.opState}
'
;
if
(
state
==
'
Success
'
){
$
(
'
#state
'
).
html
(
'
操作成功
'
);
}
else
{
$
(
'
#state
'
).
html
(
'
操作失败
'
);
}
setInterval
(
function
(){
$
(
'
#state
'
).
html
(
'
'
);
},
3000
);
});
</script>
\ No newline at end of file
cat-home/src/test/resources/config/thirdParty-config.xml
0 → 100644
浏览文件 @
f7c23eed
<third-party-config>
<http
url=
"http://www.51ping.com:8080"
type=
"get"
pars=
"name=name;sex=male"
>
<domain
id=
"cat1"
/>
<domain
id=
"cat2"
/>
</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>
<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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录