Authored by mlge

Merge branch 'master' of http://git.yoho.cn/ops/monitor-service

... ... @@ -6,6 +6,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
... ... @@ -46,13 +47,17 @@ public class SnsMobileConfig {
@PostConstruct
public void init(){
loadMobile();
}
private void loadMobile(){
//大数据报警
bigdataMobile=getUsersInfoUtil.getMobileByAlarmGroup("大数据报警");
if(bigdataMobile==null){
bigdataMobile="";
}
//JAVAAPI错误报警
//JAVAAPI错误报警
javaApiError =getUsersInfoUtil.getMobileByAlarmGroup("JAVAAPI错误报警");
if(javaApiError==null){
javaApiError="";
... ... @@ -100,4 +105,9 @@ public class SnsMobileConfig {
logger.info("testMobile :"+testMobile);
}
@Scheduled(cron = "0 0/30 * * * ?")
public void alarm() {
loadMobile();
}
}
\ No newline at end of file
... ...
package com.monitor.common.contants;
public class AlarmSystemConstant {
public static final String SYSTEM_IDC="yohops_aws_docker";
public static final String SYSTEM_IDC="yohops_aws";
}
... ...
... ... @@ -208,6 +208,9 @@ public class JavaApiClient {
//close 线程池
executorService.shutdownNow();
long endTime = System.currentTimeMillis();
//任务执行完毕
javaApiStatus.cacheStatus();
log.info("task stop cost {} ms ...", endTime - startTime);
}
... ...
... ... @@ -24,9 +24,9 @@ public class JavaApiStatus {
*/
private ConcurrentHashMap<String, AtomicInteger> mapStaticsErr = new ConcurrentHashMap<String, AtomicInteger>();
private ConcurrentHashMap<String, AtomicInteger> mapStaticsOk = new ConcurrentHashMap<String, AtomicInteger>();
private ConcurrentHashMap<String, Long> mapUpdateTime = new ConcurrentHashMap<String, Long>();
//private ConcurrentHashMap<String, Integer> cloudDetailMap = new ConcurrentHashMap<String, Integer>();
private List<JavaApiStaticsRep> statusList=new ArrayList<>();
public void addError(JavaApiStatics javaApiStatics) {
String key=getKey(javaApiStatics);
... ... @@ -53,6 +53,9 @@ public class JavaApiStatus {
public void clear() {
//把最近一次的数据缓存起来
cacheStatus();
mapStaticsErr.clear();
mapStaticsOk.clear();
mapUpdateTime.clear();
... ... @@ -66,12 +69,14 @@ public class JavaApiStatus {
* @return
*/
public List<JavaApiStaticsRep> getStatusList() {
return statusList;
}
List<JavaApiStaticsRep> rel = new ArrayList<JavaApiStaticsRep>();
public void cacheStatus(){
List<JavaApiStaticsRep> rel = new ArrayList<JavaApiStaticsRep>();
MultiKeyMap multiKeyMap = new MultiKeyMap();
Enumeration<String> errkeys = mapStaticsErr.keys();
while (errkeys.hasMoreElements()) {
String key = errkeys.nextElement();
... ... @@ -113,7 +118,7 @@ public class JavaApiStatus {
javaApiStaticsRep.setUpdateTime(DateFormatUtil.parseLongToTimeStr(time));
}
return rel;
statusList =rel;
}
... ...
... ... @@ -38,7 +38,7 @@ public class RedisMonitorTask {
private long updateTime;
//@Scheduled(cron = "${cron_task_redis_monitor}")
@Scheduled(cron = "${cron_task_redis_monitor}")
public void dispathTask() {
updateTime = System.currentTimeMillis();
... ...
... ... @@ -22,9 +22,11 @@ public class CenterSwitchModel {
private String cName;
/**
* toAws
* toAws :aws云不再用了,去掉了
* 或
* toQcloud
* 或者
* toQcloudaz2
*/
private String exe;
... ...
... ... @@ -73,7 +73,7 @@ public class DockerMonitorTask {
}
}
//@Scheduled(cron = "${cron_task_docker_pod_scan}")
@Scheduled(cron = "${cron_task_docker_pod_scan}")
public void monitor() {
if("test1".equals(env)||"test".equals(env)){
return ;
... ...
... ... @@ -30,7 +30,7 @@ public class MysqlMonitorTask {
@Autowired
MysqlMonitorServiceImpl mysqlMonitorService;
//@Scheduled(cron = "${cron_task_mysql_monit}")
@Scheduled(cron = "${cron_task_mysql_monit}")
public void monitor() {
synchronized (lockStr.intern()) {
List<MysqlMobjectRep> mysqlMobjectReps= mobjectService.getMysqlMobject();
... ...
... ... @@ -89,7 +89,9 @@ public class GatewayMonitorTask {
if(meanValueFurther>0&&meanValueClose==0){
//报警
alarmMsgService.sendSms("service_exception",influxdbName+" gateway流量变化异常,最近2分钟均值的0 ",mobile);
if(meanValueFurther>10){
alarmMsgService.sendSms("service_exception",influxdbName+" gateway流量变化异常,最近2分钟均值的0 ",mobile);
}
return ;
}else if(meanValueFurther==0&&meanValueClose==0){
//不报警
... ...
... ... @@ -37,7 +37,7 @@ public class NodePm2Task {
@Autowired
private NodeHostMapper nodeHostMapper;
//@Scheduled(cron = "${cron_task_node_mem}")
@Scheduled(cron = "${cron_task_node_mem}")
public void nodePm2Info() {
logger.info("cron_task_node_mem start");
... ...
... ... @@ -28,8 +28,8 @@ public class CenterSwitchCtrl {
@Autowired
private HttpRestClientService httpRestClientService;
@Value("${SWITCH_DB_URL}")
private String SWITCH_DB_URL;
//@Value("${SWITCH_DB_URL}")
private String SWITCH_DB_URL="http://10.66.4.28:8011/switchdb/switchMysql";
@RequestMapping("/getSwitchList")
@ResponseBody
... ...
... ... @@ -7,21 +7,16 @@ JavaApiExecutorPoolMaxSize=50
nginxsync.agent=172.31.16.167:6060
#zookeeper.address=yoho-ops-zookeeper:2181
zookeeper.address=172.31.50.139:2181
aws.redis.proxy.address=172.31.31.170
#aws.redis.proxy.address=yoho-ops-redis
aws.redis.proxy.port=6379
aws.redis.proxy.auth=
zkAddress=yoho-ops-zookeeper:2181
ddRobotUrl=test
zookeeper.address=yoho-ops-zookeeper:2181
aws.redis.proxy.address=yoho-ops-redis
#zkAddress=172.31.50.139:2181
#ddRobotUrl=https://oapi.dingtalk.com/robot/send?access_token=31cf1a526c98862b7945e561c5a0d857a069350dbee0e807074b83b39fa1e1af
#zookeeper.address=172.31.50.139:2181
#aws.redis.proxy.address=172.31.31.170
#zkAddress=yoho-ops-zookeeper:2181
zkAddress=172.31.50.139:2181
search.aws.url=http://internal-search-1492740248.cn-north-1.elb.amazonaws.com.cn/
search.qq.url=http://10.66.4.30/
... ... @@ -38,7 +33,7 @@ auto.task.test.url=http://qmc.yohops.com:9999/autoTask/executeFromGongDan
#获取伸缩组数据--访问aws、qcloud服务接口
auto.fetchScaling.open=true
#钉钉访问地址
ddRobotUrl=https://oapi.dingtalk.com/robot/send?access_token=31cf1a526c98862b7945e561c5a0d857a069350dbee0e807074b83b39fa1e1af
#ldap统一认证
ldap.flag=1
... ...
datasources:
yh_ops:
servers:
- 10.66.233.13:3306
- 10.66.233.13:3306
- 172.31.50.75:3306
- 172.31.50.75:3306
username: ops
password: eDSKt8NPhLIswOCsMW3kfA==
password: t5/oMgwUCmO/GeMHBAQ2Cg==
maxConnections: 50
minIdle: 10
maxIdle: 50
... ...
#---------jdbc config----------
#local.jdbc.url=jdbc:mysql://172.31.50.75:3306/yh_ops?characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull
#local.jdbc.user=ops
local.jdbc.url=jdbc:mysql://172.31.50.75:3306/yh_ops?characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull
local.jdbc.user=ops
local.jdbc.password=123456
#---------jdbc config----------
\ No newline at end of file
... ...
# ******************** send sms common configs ********************
sendsms.url=http://221.179.180.158:9009/HttpQuickProcess_utf-8/submitMessageAll
sendsms.username=yohoyw
#sendsms.pwd=NCftHmJ9
sendsms.pwd=test
sendsms.pwd=NCftHmJ9
sendsms.notice.productid=8
qcloud_voice_url=https://yun.tim.qq.com/v3/tlsvoicesvr/sendvoiceprompt?sdkappid=1400021400&random=123
qcloud_sms_url=https://yun.tim.qq.com/v3/tlssmssvr/sendmultisms2?sdkappid=1400021400&random=124
#qcloud_sms_key=6e56f948f6f1c0a1bc359e23f7acc140
qcloud_sms_key=test
qcloud_sms_key=6e56f948f6f1c0a1bc359e23f7acc140
java_service_alarm_flag=true
java_service_alarm_cost_threshold=300
... ...
#---------jdbc config----------
#local.jdbc.url=jdbc:mysql://127.0.0.1:3306/yh_ops?characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull
#local.jdbc.user=root
#local.jdbc.password=123456
local.jdbc.url=jdbc:mysql://127.0.0.1:3306/yh_ops?characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull
local.jdbc.user=root
local.jdbc.password=123456
#---------jdbc config----------
\ No newline at end of file
... ...