-
Notifications
You must be signed in to change notification settings - Fork 669
/
SystemConstant.java
84 lines (60 loc) · 3.68 KB
/
SystemConstant.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package com.taobao.taokeeper.common.constant;
import common.toolkit.java.constant.SymbolConstant;
import common.toolkit.java.util.StringUtil;
/**
* Description: System constant,有些变量在Spring初始化的时候会注入。
*
* @author yinshi.nc
* @Date 2011-10-26
*/
public class SystemConstant {
public final static String ZOOKEEPER_MONITOR_PATH = "/YINSHI.MONITOR.ALIVE.CHECK";
public final static String AUTHENTICATION_TYPE = "digest";
public final static String AUTHENTICATION_KEY = "yinshi.nc:taobao";
/** delay of check zookeeper watcher notify */
public final static int DELAY_SECS_OF_TWO_SERVER_ALIVE_CHECK_ZOOKEEPER = 5; // 两个ip检测的间隔
// s
public final static int DELAY_MINS_OF_TWO_CYCLE_ALIVE_CHECK_ZOOKEEPER = 1; // 两次存活性检查间隔
// mins
public final static int MINS_RATE_OF_CHECK_ZOOKEEPER = 1;
public final static int MINS_RATE_OF_COLLECT_ZOOKEEPER = 1;
public final static int MINS_RATE_OF_COLLECT_HOST_PERFORMANCE = 2;
public final static int MINS_RATE_OF_DUMP_ZOOKEEPER_CLUSTER = 1;
public final static int HOURS_RATE_OF_ZOOKEEPER_NODE_CHECK = 1;
public final static String COMMAND_CONS = "echo cons | nc {0} {1}";
public final static String COMMAND_STAT = "echo stat | nc {0} {1}";
public final static String COMMAND_WCHS = "echo wchs | nc {0} {1}";
public final static String COMMAND_WCHC = "echo wchc | nc {0} {1}";
public static String userNameOfSSH = "nobody";
public static String passwordOfSSH = "look";
public static int portOfSSH = 22;
/** ZooKeeper监控信息存储设置客户端统计信息文件存放目录 */
public static String dataStoreBasePath = "/home/yinshi.nc/zookeeper-monitor";
public static String dataStoreCategoryPath_clientStat = "/ZooKeeperClientThroughputStat/";
public static String PREFIX_OF_ZOOKEEPER_CLIENT_STAT_FILE_NAME = "zookeeper-client-";
public static String URL_TEMPLEMENT_OF_MESSAG_SEND = "http://${ip}/mchttpapi/module/api/${messageType}.htm?nickname=${targetAddress}&title=${subject}&message=${content}";
public static String IP_OF_MESSAG_SEND = "";
public static String serverOfMsgCenter = "";
public static String sourceIdOfMsgCenter = "";
public static String templateIdOfMsgCenter = "";
public static String messageTypeIdOfMsgCenter = "";
public void setDataStoreBasePath( String dataStoreBasePath ) {
SystemConstant.dataStoreBasePath = StringUtil.defaultIfBlank( dataStoreBasePath, SystemConstant.dataStoreBasePath );
}
public static void parseConfigOfMsgCenter( String configOfMsgCenter ) {
try {
if ( StringUtil.isBlank( configOfMsgCenter ) )
throw new Exception( "configOfMsgCenter can't be null" );
String[] configOfMsgCenterArray = configOfMsgCenter.split( SymbolConstant.SLASH );
if ( 4 != configOfMsgCenterArray.length )
throw new Exception( "Illegal configOfMsgCenter formart" );
SystemConstant.serverOfMsgCenter = StringUtil.defaultIfBlank( configOfMsgCenterArray[0], SystemConstant.serverOfMsgCenter );
SystemConstant.sourceIdOfMsgCenter = StringUtil.defaultIfBlank( configOfMsgCenterArray[1], SystemConstant.sourceIdOfMsgCenter );
SystemConstant.templateIdOfMsgCenter = StringUtil.defaultIfBlank( configOfMsgCenterArray[2], SystemConstant.templateIdOfMsgCenter );
SystemConstant.messageTypeIdOfMsgCenter = StringUtil.defaultIfBlank( configOfMsgCenterArray[3], SystemConstant.messageTypeIdOfMsgCenter );
} catch ( Exception e ) {
throw new RuntimeException( "Parse configOfMsgCenter( " + configOfMsgCenter
+ " ) error, please config like this:1.2.3.4:9999,1.2.3.5:9999/a*b/3545656/67657" + e.getMessage(), e );
}
}
}