Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ops
/
monitor-service
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
FengRuwei
9 years ago
Commit
55a5b44fa5afb6b709107a3042e207aad32be5aa
1 parent
3dcc9e1b
update
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
monitor-service-influxdb/src/main/java/com/monitor/influxdb/mapper/impl/JavaApiStaticsMapper.java
monitor-service-javaserver/src/main/java/com/monitor/javaserver/common/JavaApiTask.java
monitor-service-influxdb/src/main/java/com/monitor/influxdb/mapper/impl/JavaApiStaticsMapper.java
View file @
55a5b44
...
...
@@ -23,7 +23,7 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper {
BatchPoints
batchPoints
=
BatchPoints
.
database
(
InfluxDBContants
.
YOHO
_ALARM
).
retentionPolicy
(
"default"
)
.
database
(
InfluxDBContants
.
APP
_ALARM
).
retentionPolicy
(
"default"
)
.
build
();
Point
point
=
Point
.
measurement
(
InfluxDBContants
.
YOMO_TB_JAVAAPI
)
.
addField
(
"java_api_info"
,
statics
.
get
(
"javaApiInfo"
).
toString
())
...
...
@@ -31,10 +31,8 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper {
.
addField
(
"start"
,
statics
.
getLongValue
(
"start"
))
.
addField
(
"end"
,
statics
.
getLongValue
(
"end"
)).
build
();
batchPoints
.
point
(
point
);
if
(
influxDBName
==
null
)
{
influxDBName
=
inluxDBSingle
.
getDBNames
().
get
(
0
);
}
inluxDBSingle
.
getInfluxDBByName
(
influxDBName
).
getInfluxDB
()
inluxDBSingle
.
getInfluxDBByName
(
InfluxDBContants
.
AWS
).
getInfluxDB
()
.
write
(
batchPoints
);
...
...
monitor-service-javaserver/src/main/java/com/monitor/javaserver/common/JavaApiTask.java
View file @
55a5b44
...
...
@@ -46,15 +46,15 @@ public class JavaApiTask implements Callable<JavaApiStatics> {
if
(
javaApiInfo
.
getApiReqMethod
()
==
0
)
{
jsonRep
=
restTemplate
.
getForObject
(
url
,
JSONObject
.
class
);
}
else
{
JSONObject
req
=
null
;
JSONObject
req
=
JSONObject
.
parse
(
javaApiInfo
.
getApiData
(),
JSONObject
.
class
)
;
jsonRep
=
restTemplate
.
postForObject
(
url
,
req
,
JSONObject
.
class
);
}
}
catch
(
Exception
e
)
{
log
.
warn
(
"exception {} "
,
url
);
log
.
warn
(
"exception {} "
,
url
);
apiStatics
.
setHasException
(
true
);
apiStatics
.
setException
(
e
);
}
finally
{
}
finally
{
apiStatics
.
setEndTime
(
System
.
currentTimeMillis
());
apiStatics
.
setResponse
(
jsonRep
);
}
...
...
@@ -72,7 +72,14 @@ public class JavaApiTask implements Callable<JavaApiStatics> {
log
.
warn
(
"get url failed has null prop. "
);
return
null
;
}
String
url
=
"http://"
+
mObjectInfo
.
getMoHostIp
()
+
":"
+
mObjectInfo
.
getMoTags
()
+
"/"
+
javaApiInfo
.
getApiUrl
();
String
url
=
"http://"
+
mObjectInfo
.
getMoHostIp
();
if
(
mObjectInfo
.
getMoTags
()
!=
null
&&
!
mObjectInfo
.
getMoTags
().
equals
(
""
))
{
url
+=
":"
+
mObjectInfo
.
getMoTags
();
}
url
+=
"/"
+
javaApiInfo
.
getApiUrl
();
return
url
;
}
}
...
...
Please
register
or
login
to post a comment