Permalink
Browse files

Update the taokeeper.sql

  • Loading branch information...
nileader committed Mar 17, 2013
1 parent f836aba commit 64d550ee084556cf8580f170301dd320ad54f168
View
@@ -11,7 +11,6 @@ Any question to: nileader@gmail.com
4. Exec taokeeper-build/build.cmd to generate taokeeper-monitor.war
How to deploy(See more,please to http://rdc.taobao.com/team/jm/archives/1450 )
1. Download taokeeper.sql( https://github.com/downloads/taobao/taokeeper/taokeeper.sql ),init mysql.
@@ -49,4 +48,27 @@ linux:JAVA_OPTS=-DconfigFilePath="/home/admin/taokeeper-monitor/config/taokeep
6. Visit the page: http://127.0.0.1:8080/taokeeper-monitor
Alibaba OpenSource Maven Repository
<profiles>
<profile>
<id>opensource</id>
<repositories>
<repository>
<id>taocodeReleases</id>
<name>taocode nexus</name>
<url>http://mvnrepo.code.taobao.org/nexus/content/repositories/releases/</url>
</repository>
<repository>
<id>taocodeSnapshots</id>
<name>taocode nexus</name>
<url>http://mvnrepo.code.taobao.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
</profile>
</profiles>
View
42 pom.xml
@@ -101,9 +101,6 @@
<apache.standard.taglib.version>1.1.2</apache.standard.taglib.version>
<sitemesh.version>2.4.2</sitemesh.version>
<config.client.version>1.5.6</config.client.version>
<msgcenter.version>1.0.0-SNAPSHOT</msgcenter.version>
</properties>
@@ -465,45 +462,6 @@
<classifier>sources</classifier>
</dependency>
<!-- taobao jar -->
<dependency>
<groupId>com.taobao.configserver</groupId>
<artifactId>config-client</artifactId>
<version>${config.client.version}</version>
</dependency>
<dependency>
<groupId>com.taobao.jm.msgcenter</groupId>
<artifactId>msgcenter-utils</artifactId>
<version>${msgcenter.version}</version>
<exclusions>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.2-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
@@ -6,21 +6,22 @@ USE taokeeper;
-- ----------------------------
DROP TABLE IF EXISTS `alarm_settings`;
CREATE TABLE `alarm_settings` (
`alarm_settings_id` int(11) NOT NULL auto_increment,
`alarm_settings_id` int(11) NOT NULL AUTO_INCREMENT,
`cluster_id` int(11) NOT NULL,
`wangwang_list` varchar(255) default NULL,
`phone_list` varchar(255) default NULL,
`email_list` varchar(255) default NULL,
`max_delay_of_check` varchar(255) default NULL,
`max_cpu_usage` varchar(255) default NULL,
`max_memory_usage` varchar(255) default NULL,
`max_load` varchar(255) default NULL,
`max_connection_per_ip` varchar(255) default NULL,
`max_watch_per_ip` varchar(255) default NULL,
`data_dir` varchar(255) default NULL,
`data_log_dir` varchar(255) default NULL,
`max_disk_usage` varchar(255) default NULL,
PRIMARY KEY (`alarm_settings_id`),
`wangwang_list` varchar(255) DEFAULT NULL,
`phone_list` varchar(255) DEFAULT NULL,
`email_list` varchar(255) DEFAULT NULL,
`max_delay_of_check` varchar(255) DEFAULT NULL,
`max_cpu_usage` varchar(255) DEFAULT NULL,
`max_memory_usage` varchar(255) DEFAULT NULL,
`max_load` varchar(255) DEFAULT NULL,
`max_connection_per_ip` varchar(255) DEFAULT NULL,
`max_watch_per_ip` varchar(255) DEFAULT NULL,
`data_dir` varchar(255) DEFAULT NULL,
`data_log_dir` varchar(255) DEFAULT NULL,
`max_disk_usage` varchar(255) DEFAULT NULL,
`node_path_check_rule` text,
PRIMARY KEY (`alarm_settings_id`),
UNIQUE KEY `uk_alarm_settings_cid` (`cluster_id`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk;
View
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -55,6 +56,11 @@
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.7</version>
</dependency>
<!-- DEPENDENCIES FOR TEST -->
@@ -47,11 +47,10 @@
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 configOfMsgCenter = "";
public static String serverOfMsgCenter = "";
public static String sourceIdOfMsgCenter = "";
@@ -124,9 +124,7 @@ private void initSystem() {
SystemConstant.passwordOfSSH = StringUtil.defaultIfBlank( properties.getProperty( "SystemConstant.passwordOfSSH" ), "123456" );
SystemConstant.portOfSSH = IntegerUtil.defaultIfError( properties.getProperty( "SystemConstant.portOfSSH" ), 22 );
SystemConstant.configOfMsgCenter = StringUtil.trimToEmpty( properties.getProperty( "SystemConstant.configOfMsgCenter" ) );
SystemConstant.parseConfigOfMsgCenter( SystemConstant.configOfMsgCenter );
LOG.warn( ">>>>>>Finish load the properties: " + properties );
SystemConstant.IP_OF_MESSAG_SEND = StringUtil.trimToEmpty( properties.getProperty( "SystemConstant.IP_OF_MESSAG_SEND" ) );
ThreadPoolManager.addJobToMessageSendExecutor( new TbMessageSender( new Message( "银时", "TaoKeeper启动", "TaoKeeper启动",
Message.MessageType.WANGWANG ) ) );
View
@@ -20,27 +20,6 @@
<version>${taokeeper.version}</version>
</dependency>
<!-- Config client -->
<dependency>
<groupId>com.taobao.configserver</groupId>
<artifactId>config-client</artifactId>
</dependency>
<dependency>
<groupId>com.taobao.jm.msgcenter</groupId>
<artifactId>msgcenter-utils</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</dependency>
</dependencies>
@@ -2,23 +2,24 @@
import static common.toolkit.java.constant.SymbolConstant.COMMA;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.taobao.jm.msgcenter.MsgManager;
import com.taobao.jm.msgcenter.common.MsgConstants;
import com.taobao.jm.msgcenter.common.Result;
import com.taobao.taokeeper.common.SystemInfo;
import com.taobao.taokeeper.common.constant.SystemConstant;
import com.taobao.taokeeper.model.type.EnvType;
import com.taobao.taokeeper.model.type.Message;
import common.toolkit.java.entity.Message.MessageType;
import common.toolkit.java.util.StringUtil;
import common.toolkit.java.util.collection.ListUtil;
import common.toolkit.java.util.io.NetUtil;
/**
* Description: 淘宝内部使用:旺旺消息与手机短信
*
* @author 银时 yinshi.nc@taobao.com
* @Date Dec 26, 2011
*/
@@ -35,7 +36,7 @@ public TbMessageSender( Message... messages ) {
@Override
public void run() {
if ( null == messages || 0 == messages.length || StringUtil.isBlank( SystemConstant.configOfMsgCenter ) )
if ( null == messages || 0 == messages.length || StringUtil.isBlank( SystemConstant.IP_OF_MESSAG_SEND ) )
return;
for ( Message message : this.messages ) {
@@ -52,60 +53,46 @@ public void run() {
/**
* 发送消息
* @param targetAddresses
* @param subject
* @param content message content
* @param channel messate tyep:sms,email,wangwang
*
* @param targetAddresses
* @param subject
* @param content
* message content
* @param channel
* messate tyep:sms,email,wangwang
* @return
* @throws Exception
*/
private Result sendMessage( String targetAddresses, String subject, String content, String channel ) {
private boolean sendMessage( String targetAddresses, String subject, String content, String channel ) throws Exception {
if ( StringUtil.isBlank( targetAddresses ) || StringUtil.isBlank( channel ) )
return null;
Result result = null;
String sendType = MsgConstants.CUSTOM_SERVER_LIST_TYPE;
try {
LOG.warn( "Init: setServiceType=" + MsgConstants.CUSTOM_SERVER_LIST_TYPE + ", custom server hosts: " + SystemConstant.serverOfMsgCenter );
MsgManager mcm = new MsgManager();
mcm.setServiceType( MsgConstants.CUSTOM_SERVER_LIST_TYPE );
mcm.setCustomServerHosts( SystemConstant.serverOfMsgCenter );
mcm.init();
if ( EnvType.DAILY.toString().equals( SystemInfo.envName ) ) {
mcm.setServiceType( MsgConstants.CUSTOM_SERVER_LIST_TYPE );
mcm.setCustomServerHosts( SystemConstant.serverOfMsgCenter );
mcm.init();
} else if ( EnvType.ONLINE.toString().equals( SystemInfo.envName ) || EnvType.PREPARE.toString().equals( SystemInfo.envName ) ) {
sendType = "HSF";
mcm.setServiceGroup( "HSF" );
mcm.setServiceVersion( "1.0.0" );
mcm.init();
}
return false;
List<String> targetAddressList = ListUtil.parseList( StringUtil.trimToEmpty( targetAddresses ), COMMA );
String sourceId = SystemConstant.sourceIdOfMsgCenter;
String templateId = SystemConstant.templateIdOfMsgCenter;
String messageTypeId = SystemConstant.messageTypeIdOfMsgCenter;
Map<String, String> map = new HashMap<String, String>();
map.put( "ip", SystemConstant.IP_OF_MESSAG_SEND );
map.put( "subject", URLEncoder.encode( subject, "UTF-8" ) );
map.put( "content", URLEncoder.encode( content, "UTF-8" ) );
String url = "";
if ( channel.equalsIgnoreCase( MessageType.WANGWANG.toString() ) ) {
List< String > targetAddressList = ListUtil.parseList( StringUtil.trimToEmpty( targetAddresses ), COMMA );
for ( String targetAddress : targetAddressList ) {
result = mcm.sendMsg( targetAddress, "title: " + subject, "content: " + content, channel, sourceId, templateId, messageTypeId );
}
if ( result.isSuccess() ) {
LOG.warn( "Send " + channel + " message success, send type is " + sendType + ", targetAddress: " + targetAddresses + ", subject: "
+ subject + ", content: " + content );
} else {
LOG.warn( "Send " + channel + " message failure, send type is " + sendType + ", targetAddress: " + targetAddresses + ", subject: "
+ subject + ", content: " + content );
map.put( "messageType", "sendWangWangMessage" );
map.put( "targetAddress", URLEncoder.encode( targetAddress,"UTF-8" ) );
url = StringUtil.replacePlaceholder( SystemConstant.URL_TEMPLEMENT_OF_MESSAG_SEND, map );
}
} else if ( channel.equalsIgnoreCase( MessageType.SMS.toString() ) ) {
} catch ( Exception e ) {
LOG.warn( "Send " + channel + " message failure, send type is " + sendType + ", targetAddress: " + targetAddresses + ", subject: "
+ subject + ", content: " + content );
LOG.error( e.getMessage() );
for ( String targetAddress : targetAddressList ) {
map.put( "messageType", "sendWangWangMessage" );
map.put( "targetAddress", URLEncoder.encode( targetAddress, "UTF-8" ) );
url = StringUtil.replacePlaceholder( SystemConstant.URL_TEMPLEMENT_OF_MESSAG_SEND, map );
}
}
return result;
return "ok".equalsIgnoreCase( NetUtil.getContentOfUrl( url ) );
}
}
@@ -55,13 +55,6 @@
<version>${taokeeper.version}</version>
</dependency>
<dependency>
<groupId>org.nileader.java</groupId>
<artifactId>makarov-toolkit</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<!-- LOG -->
<dependency>
<groupId>commons-logging</groupId>

0 comments on commit 64d550e

Please sign in to comment.