|
@ -139,10 +139,11 @@ public class MonitorScheduler {
|
|
|
/**
|
|
|
* 服务器列表保存
|
|
|
*/
|
|
|
@Scheduled(initialDelay=3000,cron = "0 0 12 * * ?") //每天中午12点触发
|
|
|
// @Scheduled(cron = "0 0 12 * * ?") //每天中午12点触发
|
|
|
@Scheduled(fixedDelay = 3600*24*1000,initialDelay=3000) //每天中午12点触发
|
|
|
public void checkHost() {
|
|
|
MongodbUtil monoEnv = new MongodbUtil("monitor");
|
|
|
mongoOperations = new MongoTemplate(mongo, "monitor");
|
|
|
MongodbUtil monoEnv = new MongodbUtil(MonitorConstant.MONITOR);
|
|
|
mongoOperations = new MongoTemplate(mongo, MonitorConstant.MONITOR);
|
|
|
DBCollection envCollection = mongoOperations.getCollection(MonitorConstant.HOST);
|
|
|
BasicDBObject queryObject = new BasicDBObject().append(QueryOperators.AND,
|
|
|
new BasicDBObject[]{
|
|
@ -151,7 +152,7 @@ public class MonitorScheduler {
|
|
|
DBCursor cursor = envCollection.find(queryObject);
|
|
|
if (cursor.size() < 1) {
|
|
|
try {
|
|
|
org.json.JSONObject result = new org.json.JSONObject();
|
|
|
Document result = new Document();
|
|
|
InetAddress addr = null;
|
|
|
addr = InetAddress.getLocalHost();
|
|
|
result.put("name", addr.getHostName());
|