提交 d278669a 编写于 作者: Y youyong

modify the alarm page

上级 4550fe05
......@@ -211,7 +211,12 @@ public class MatrixAnalyzer extends AbstractMessageAnalyzer<MatrixReport> implem
for (MatrixReport report : m_reports.values()) {
try {
try {
report.accept(new MatrixReportFilter(50));
} catch (Exception e) {
//ConcurrentModificationException
report.accept(new MatrixReportFilter(50));
}
Set<String> domainNames = report.getDomainNames();
domainNames.clear();
domainNames.addAll(getDomains());
......
......@@ -38,6 +38,9 @@ public class CatHomeModule extends AbstractModule {
Threads.forGroup("Cat").start(taskConsumer);
Threads.forGroup("Cat").start(monthReportTask);
}
//OtherJobReport tuangouMonth = ctx.lookup(OtherJobReport.class);
//Threads.forGroup("Cat").start(tuangouMonth);
}
@Override
......
......@@ -23,6 +23,7 @@ import com.dianping.cat.report.page.health.HistoryGraphs;
import com.dianping.cat.report.task.DailyTaskProducer;
import com.dianping.cat.report.task.DefaultTaskConsumer;
import com.dianping.cat.report.task.TaskConsumer;
import com.dianping.cat.report.task.OtherJobReport;
import com.dianping.cat.report.task.cross.CrossMerger;
import com.dianping.cat.report.task.cross.CrossReportBuilder;
import com.dianping.cat.report.task.database.DatabaseMerger;
......@@ -87,7 +88,8 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
all.add(C(SqlMerger.class));
all.add(C(TransactionReportBuilder.class) //
.req(GraphDao.class, ReportDao.class, DailyreportDao.class, TransactionGraphCreator.class, TransactionMerger.class));
.req(GraphDao.class, ReportDao.class, DailyreportDao.class, TransactionGraphCreator.class,
TransactionMerger.class));
all.add(C(EventReportBuilder.class) //
.req(GraphDao.class, ReportDao.class, DailyreportDao.class, EventGraphCreator.class, EventMerger.class));
......@@ -96,7 +98,8 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
.req(GraphDao.class, ReportDao.class, DailyreportDao.class, ProblemGraphCreator.class, ProblemMerger.class));
all.add(C(HeartbeatReportBuilder.class) //
.req(GraphDao.class, ReportDao.class, DailyreportDao.class, HeartbeatGraphCreator.class, HeartbeatMerger.class));
.req(GraphDao.class, ReportDao.class, DailyreportDao.class, HeartbeatGraphCreator.class,
HeartbeatMerger.class));
all.add(C(MatrixReportBuilder.class) //
.req(GraphDao.class, ReportDao.class, DailyreportDao.class, MatrixMerger.class));
......@@ -137,11 +140,15 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
all.add(C(ModuleManager.class, DefaultModuleManager.class) //
.config(E("topLevelModules").value(CatHomeModule.ID)));
all.add(C(OtherJobReport.class).//
req(DailyreportDao.class, DomainManager.class));
// model service
all.addAll(new ServiceComponentConfigurator().defineComponents());
// database
all.add(C(JdbcDataSourceConfigurationManager.class).config(E("datasourceFile").value("/data/appdatas/cat/datasources.xml")));
all.add(C(JdbcDataSourceConfigurationManager.class).config(
E("datasourceFile").value("/data/appdatas/cat/datasources.xml")));
all.addAll(new CatDatabaseConfigurator().defineComponents());
all.addAll(new UserDatabaseConfigurator().defineComponents());
......
......@@ -7,7 +7,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
......@@ -24,6 +23,7 @@ import com.dianping.cat.home.dal.report.DailyreportEntity;
import com.dianping.cat.message.Message;
import com.dianping.cat.message.Transaction;
import com.site.dal.jdbc.DalException;
import com.site.dal.jdbc.DalNotFoundException;
import com.site.lookup.annotation.Inject;
public class DailyTaskProducer implements com.site.helper.Threads.Task, Initializable {
......@@ -37,8 +37,6 @@ public class DailyTaskProducer implements com.site.helper.Threads.Task, Initiali
private Set<String> m_dailyReportNameSet = new HashSet<String>();
private Logger m_logger;
@Inject
private ReportDao m_reportDao;
......@@ -51,8 +49,10 @@ public class DailyTaskProducer implements com.site.helper.Threads.Task, Initiali
try {
allReports = m_dailyReportDao.findDatabaseAllByPeriod(day, new Date(day.getTime() + DAY),
DailyreportEntity.READSET_DOMAIN_NAME);
} catch (DalNotFoundException notFoundException) {
// Ignore
} catch (DalException e) {
m_logger.warn("DailyTaskProducer isYesterdayTaskGenerated", e);
Cat.logError(e);
}
Set<String> databaseSet = getDatabaseSet(day, new Date(day.getTime() + DAY));
......@@ -70,8 +70,10 @@ public class DailyTaskProducer implements com.site.helper.Threads.Task, Initiali
try {
allReports = m_dailyReportDao.findAllByPeriod(day, new Date(day.getTime() + DAY),
DailyreportEntity.READSET_DOMAIN_NAME);
} catch (DalNotFoundException notFoundException) {
// Ignore
} catch (DalException e) {
m_logger.warn("DailyTaskProducer isYesterdayTaskGenerated", e);
Cat.logError(e);
}
Set<String> domainSet = getDomainSet(day, new Date(day.getTime() + DAY));
......@@ -191,6 +193,11 @@ public class DailyTaskProducer implements com.site.helper.Threads.Task, Initiali
return domainSet;
}
@Override
public String getName() {
return "DailyTask-Producer";
}
@Override
public void initialize() throws InitializationException {
m_dailyReportNameSet.add("event");
......@@ -226,11 +233,6 @@ public class DailyTaskProducer implements com.site.helper.Threads.Task, Initiali
}
}
@Override
public String getName() {
return "DailyTask-Producer";
}
@Override
public void shutdown() {
}
......
......@@ -45,15 +45,23 @@ public class DefaultTaskConsumer extends TaskConsumer {
return task;
}
@Override
public String getName() {
return "Task-Consumer";
}
@Override
protected boolean processTask(Task doing) {
return m_reportFacade.builderReport(doing);
}
@Override
public void shutdown() {
}
@Override
protected void taskNotFoundDuration() {
// Date awakeTime = TaskHelper.nextTaskTime();
// LockSupport.parkUntil(awakeTime.getTime());
try {
Thread.sleep(2 * 60 * 1000);
} catch (InterruptedException e) {
......@@ -105,14 +113,4 @@ public class DefaultTaskConsumer extends TaskConsumer {
return false;
}
}
@Override
public String getName() {
return "Task-Consumer";
}
@Override
public void shutdown() {
}
}
package com.dianping.cat.report.task;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import com.dianping.cat.Cat;
import com.dianping.cat.consumer.cross.model.entity.CrossReport;
import com.dianping.cat.consumer.health.model.entity.HealthReport;
import com.dianping.cat.consumer.health.model.transform.DefaultSaxParser;
import com.dianping.cat.consumer.transaction.model.entity.TransactionName;
import com.dianping.cat.consumer.transaction.model.entity.TransactionReport;
import com.dianping.cat.consumer.transaction.model.entity.TransactionType;
import com.dianping.cat.helper.TimeUtil;
import com.dianping.cat.home.dal.report.Dailyreport;
import com.dianping.cat.home.dal.report.DailyreportDao;
import com.dianping.cat.home.dal.report.DailyreportEntity;
import com.dianping.cat.report.page.cross.DomainManager;
import com.dianping.cat.report.page.cross.display.ProjectInfo;
import com.dianping.cat.report.page.cross.display.TypeDetailInfo;
import com.dianping.cat.report.page.model.cross.CrossReportMerger;
import com.dianping.cat.report.page.model.transaction.TransactionReportMerger;
import com.dianping.cat.report.task.health.HealthReportMerger;
import com.site.helper.Threads.Task;
import com.site.lookup.annotation.Inject;
public class OtherJobReport implements Task {
@Inject
private DailyreportDao m_dailyreportDao;
@Inject
private DomainManager m_domainManager;
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
private void buildOtherDomainCrossInfo(String domain, Date start, Date end, List<String> domains) {
for (long current = start.getTime(); current < end.getTime(); current += TimeUtil.ONE_DAY) {
Date startDate = new Date(current);
Date endDate = new Date(current + TimeUtil.ONE_DAY);
CrossReport crossReport = queryCrossReport(startDate, endDate, domain);
System.out.print(sdf.format(startDate) + "\t");
for (String otherDomain : domains) {
Indicator otherDomainIndicator = getOtherDomainCrossInfo(otherDomain, crossReport);
System.out.print(otherDomainIndicator);
}
System.out.println();
}
}
private void buildServiceDetailInfo(String domain, Date start, Date end, List<String> functionNames) {
for (long current = start.getTime(); current < end.getTime(); current += TimeUtil.ONE_DAY) {
Date startDate = new Date(current);
Date endDate = new Date(current + TimeUtil.ONE_DAY);
TransactionReport transactionReport = queryTransactionReport(startDate, endDate, domain);
System.out.print(sdf.format(startDate) + "\t");
for (String functionName : functionNames) {
Indicator functionIndicator = getFunctionDetailIndicator(functionName, transactionReport);
System.out.print(functionIndicator);
}
System.out.println();
}
}
private void buildServiceTotalInfo(String domain, Date start, Date end) {
System.out.println(domain + " Service Info >>>>>>>>");
for (long current = start.getTime(); current < end.getTime(); current += TimeUtil.ONE_DAY) {
Date startDate = new Date(current);
Date endDate = new Date(current + TimeUtil.ONE_DAY);
TransactionReport transactionReport = queryTransactionReport(startDate, endDate, domain);
HealthReport healthReport = queryHealthReport(startDate, endDate, domain);
Indicator indicator = getServiceTotalIndicator(transactionReport, healthReport);
System.out.println(sdf.format(startDate) + '\t' + indicator);
}
}
private void buildUrlDetailsInfo(String domain, Date start, Date end, List<String> urls) {
for (long current = start.getTime(); current < end.getTime(); current += TimeUtil.ONE_DAY) {
Date startDate = new Date(current);
Date endDate = new Date(current + TimeUtil.ONE_DAY);
TransactionReport transactionReport = queryTransactionReport(startDate, endDate, domain);
System.out.print(sdf.format(startDate) + "\t");
for (String url : urls) {
Indicator functionIndicator = getUrlDetailIndicator(transactionReport, url);
System.out.print(functionIndicator);
}
System.out.println();
}
}
private void buildUrlTotalInfo(String domain, Date start, Date end) {
System.out.println(domain + " Url Info");
for (long current = start.getTime(); current < end.getTime(); current += TimeUtil.ONE_DAY) {
Date startDate = new Date(current);
Date endDate = new Date(current + TimeUtil.ONE_DAY);
TransactionReport transactionReport = queryTransactionReport(startDate, endDate, domain);
Indicator indicator = getUrlTotalIndicator(transactionReport);
System.out.println(sdf.format(startDate) + '\t' + indicator);
}
}
public Date calMonthFirstDay(int step) {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.DAY_OF_MONTH, 1);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
cal.add(Calendar.MONTH, step);
return cal.getTime();
}
private Indicator getFunctionDetailIndicator(String functionName, TransactionReport report) {
TransactionType type = getPigeonServiceTransaction(report);
Indicator indicator = new Indicator();
if (type != null) {
TransactionName name = type.findName(functionName);
if (name == null) {
int index = functionName.indexOf("(");
if (index > 0) {
functionName = functionName.substring(0, index);
name = type.findName(functionName);
}
}
if (name != null) {
indicator.setTotalCount(name.getTotalCount());
indicator.set95Line(name.getLine95Value());
indicator.setAvg(name.getAvg());
indicator.setFailureCount(name.getFailCount());
}
}
return indicator;
}
@Override
public String getName() {
return "TuanGouRemote";
}
private Indicator getOtherDomainCrossInfo(String otherDomain, CrossReport report) {
ProjectInfo projectInfo = new ProjectInfo(TimeUtil.ONE_HOUR);
projectInfo.setDomainManager(m_domainManager);
projectInfo.setClientIp("All");
projectInfo.visitCrossReport(report);
List<TypeDetailInfo> types = projectInfo.getServiceProjectsInfo();
Indicator indicator = new Indicator();
for (TypeDetailInfo info : types) {
if (info.getProjectName().equals(otherDomain)) {
indicator.setAvg(info.getAvg());
indicator.setTotalCount(info.getTotalCount());
indicator.setFailureCount(info.getTotalCount());
break;
}
}
return indicator;
}
private TransactionType getPigeonServiceTransaction(TransactionReport report) {
TransactionType type = report.findOrCreateMachine("All").getTypes().get("Service");
if (type == null) {
type = report.getMachines().get("All").getTypes().get("PigeonService");
}
String pigeonName = "piegonService:heartTaskService:heartBeat()";
if (type != null) {
TransactionName name = type.findName(pigeonName);
if (name == null) {
name = type.findName("piegonService:heartTaskService:heartBeat");
}
if (name != null) {
type.setTotalCount(type.getTotalCount() - name.getTotalCount());
double sum = type.getSum() - name.getSum();
type.setAvg(sum / type.getTotalCount());
}
}
return type;
}
private Indicator getServiceTotalIndicator(TransactionReport transactionReport, HealthReport healthReport) {
TransactionType type = getPigeonServiceTransaction(transactionReport);
Indicator indicator = new Indicator();
if (type != null) {
indicator.set95Line(type.getLine95Value());
indicator.setAvg(type.getAvg());
indicator.setTotalCount(type.getTotalCount());
}
try {
indicator.setFailureCount(healthReport.getClientService().getBaseInfo().getErrorTotal());
} catch (Exception e) {
}
return indicator;
}
private Indicator getUrlDetailIndicator(TransactionReport transactionReport, String detailUrl) {
TransactionType type = transactionReport.findOrCreateMachine("All").findType("URL");
Indicator indicator = new Indicator();
if (type != null) {
TransactionName name = type.findName(detailUrl);
if (name != null) {
indicator.set95Line(name.getLine95Value());
indicator.setAvg(name.getAvg());
indicator.setTotalCount(name.getTotalCount());
indicator.setFailureCount(name.getFailCount());
}
}
return indicator;
}
private Indicator getUrlTotalIndicator(TransactionReport transactionReport) {
TransactionType type = transactionReport.findOrCreateMachine("All").findType("URL");
Indicator indicator = new Indicator();
if (type != null) {
indicator.set95Line(type.getLine95Value());
indicator.setAvg(type.getAvg());
indicator.setTotalCount(type.getTotalCount());
indicator.setFailureCount(type.getFailCount());
}
return indicator;
}
public CrossReport queryCrossReport(Date start, Date end, String domain) {
CrossReport crossReport = null;
try {
List<Dailyreport> reports = m_dailyreportDao.findAllByDomainNameDuration(start, end, domain, "cross",
DailyreportEntity.READSET_FULL);
CrossReportMerger merger = new CrossReportMerger(new CrossReport(domain));
for (Dailyreport report : reports) {
String xml = report.getContent();
CrossReport reportModel = com.dianping.cat.consumer.cross.model.transform.DefaultSaxParser.parse(xml);
reportModel.accept(merger);
}
crossReport = merger.getCrossReport();
} catch (Exception e) {
Cat.logError(e);
}
return crossReport;
}
private HealthReport queryHealthReport(Date startDate, Date endDate, String domain) {
try {
List<Dailyreport> reports = m_dailyreportDao.findAllByDomainNameDuration(startDate, endDate, domain, "health",
DailyreportEntity.READSET_FULL);
HealthReportMerger merger = new HealthReportMerger(new HealthReport(domain));
HealthReport healthReport = merger.getHealthReport();
merger.setDuration(endDate.getTime() - startDate.getTime());
for (Dailyreport report : reports) {
String xml = report.getContent();
HealthReport model = DefaultSaxParser.parse(xml);
model.accept(merger);
healthReport.getDomainNames().addAll(model.getDomainNames());
}
return healthReport;
} catch (Exception e) {
Cat.logError(e);
}
return new HealthReport(domain);
}
private TransactionReport queryTransactionReport(Date startDate, Date endDate, String domain) {
TransactionReport transactionReport = null;
try {
List<Dailyreport> reports = m_dailyreportDao.findAllByDomainNameDuration(startDate, endDate, domain,
"transaction", DailyreportEntity.READSET_FULL);
TransactionReportMerger merger = new TransactionReportMerger(new TransactionReport(domain));
for (Dailyreport report : reports) {
String xml = report.getContent();
TransactionReport reportModel = com.dianping.cat.consumer.transaction.model.transform.DefaultSaxParser
.parse(xml);
reportModel.accept(merger);
}
transactionReport = merger.getTransactionReport();
} catch (Exception e) {
Cat.logError(e);
}
return transactionReport;
}
@Override
public void run() {
Date lastMonth = calMonthFirstDay(-2);
Date nextMonth = calMonthFirstDay(1);
List<String> otherDomains = new ArrayList<String>();
List<String> urls = new ArrayList<String>();
String domain = "TuanGouRemote";
otherDomains.add("MobileApi");
otherDomains.add("TuanGouWeb");
otherDomains.add("TuanGouApiMobile");
otherDomains.add("ShopWeb");
List<String> functionNames = new ArrayList<String>();
functionNames.add("dealRemoteService:dealRemoteService_1.0.0:getDeal(Integer)");
functionNames.add("dealGroupRemoteService:dealGroupRemoteService_1.0.0:getActiveDealGroupList(DealListRequest)");
functionNames.add("receiptRemoteService:receiptRemoteService_1.0.0:getReceiptList(Integer,Integer,Boolean)");
try {
Thread.sleep(1000 * 2);
} catch (InterruptedException e) {
}
buildServiceTotalInfo(domain, lastMonth, nextMonth);
buildServiceDetailInfo(domain, lastMonth, nextMonth, functionNames);
buildOtherDomainCrossInfo(domain, lastMonth, nextMonth, otherDomains);
domain = "TuanGouWeb";
urls.add("/index");
urls.add("/detail");
buildUrlTotalInfo(domain, lastMonth, nextMonth);
buildUrlDetailsInfo(domain, lastMonth, nextMonth, urls);
domain = "BCTuangouWeb";
buildUrlTotalInfo(domain, lastMonth, nextMonth);
domain = "TuanGouApi";
buildUrlTotalInfo(domain, lastMonth, nextMonth);
domain = "TuanGouApiMobile";
buildUrlTotalInfo(domain, lastMonth, nextMonth);
}
@Override
public void shutdown() {
}
public static class Indicator {
private long m_totalCount;
private long m_failureCount;
private double m_avg;
private double m_95Line;
public double get95Line() {
return m_95Line;
}
public double getAvg() {
return m_avg;
}
public long getFailureCount() {
return m_failureCount;
}
public long getTotalCount() {
return m_totalCount;
}
public void set95Line(double line) {
m_95Line = line;
}
public void setAvg(double avg) {
m_avg = avg;
}
public void setFailureCount(long failureCount) {
m_failureCount = failureCount;
}
public void setTotalCount(long totalCount) {
m_totalCount = totalCount;
}
public String toString() {
return new StringBuilder().append(m_totalCount).append('\t').append(m_failureCount).append('\t').append(m_avg)
.append('\t').append(m_95Line).append('\t').toString();
}
}
}
......@@ -167,6 +167,18 @@ public class HealthReportCreator {
m_healthReport.setMachineInfo(info);
}
private double queryOldgcNumber(com.dianping.cat.consumer.heartbeat.model.entity.Machine machine){
double oldgcTotal =0;
List<Period> periods = machine.getPeriods();
long l = periods.get(periods.size() - 1).getOldGcCount() - periods.get(0).getOldGcCount();
if (l >= 0) {
oldgcTotal = l;
} else {
oldgcTotal = periods.get(periods.size() - 1).getOldGcCount();
}
return oldgcTotal;
}
private void buildMachinInfos(MachineInfo info, HeartbeatReport heartBeatReport) {
Map<String, Double> loads = new HashMap<String, Double>();
Map<String, Double> gcs = new HashMap<String, Double>();
......@@ -186,12 +198,7 @@ public class HealthReportCreator {
int i = 0;
List<Period> periods = machine.getPeriods();
long l = periods.get(periods.size() - 1).getOldGcCount() - periods.get(0).getOldGcCount();
if (l > 0) {
oldgcTotal = l;
} else {
oldgcTotal = periods.get(periods.size() - 1).getOldGcCount();
}
oldgcTotal = queryOldgcNumber(machine);
for (; i < periods.size(); i++) {
loadTotal += periods.get(i).getSystemLoadAverage();
......
......@@ -29,6 +29,7 @@ import com.dianping.cat.report.page.model.problem.ProblemReportMerger;
import com.dianping.cat.report.page.model.transaction.TransactionReportMerger;
import com.dianping.cat.report.task.TaskHelper;
import com.site.dal.jdbc.DalException;
import com.site.dal.jdbc.DalNotFoundException;
import com.site.helper.Threads.Task;
import com.site.lookup.annotation.Inject;
......@@ -120,8 +121,9 @@ public class MonthReportBuilderTask implements Task {
for (Monthreport report : monthreports) {
domains.add(report.getDomain());
}
} catch (DalNotFoundException e1) {
} catch (DalException e) {
e.printStackTrace();
Cat.logError(e);
}
return domains;
......@@ -217,6 +219,7 @@ public class MonthReportBuilderTask implements Task {
}
for (String domain : allDomains) {
Transaction t = Cat.newTransaction("MonthReport", domain);
t.setStatus(Transaction.SUCCESS);
try {
MonthReport report = buildMonthReport(domain, lastMonth, currentMonth);
......@@ -227,7 +230,6 @@ public class MonthReportBuilderTask implements Task {
entity.setPeriod(lastMonth);
m_monthreportDao.insert(entity);
t.setStatus(Transaction.SUCCESS);
} catch (Exception e) {
Cat.logError(e);
t.setStatus(e);
......
......@@ -12,4 +12,11 @@ public class Model extends ViewModel<SystemPage, Action, Context> {
public Action getDefaultAction() {
return Action.VIEW;
}
public String getDomain(){
return "";
}
public String getDate(){
return "";
}
}
......@@ -30,6 +30,10 @@ public class Payload implements ActionPayload<SystemPage, Action> {
m_page = SystemPage.getByName(page, SystemPage.ALARM);
}
public String getReportType(){
return "";
}
@Override
public void validate(ActionContext<?> ctx) {
}
......
......@@ -367,6 +367,18 @@
<topLevelModules>cat-home</topLevelModules>
</configuration>
</component>
<component>
<role>com.dianping.cat.report.task.OtherJobReport</role>
<implementation>com.dianping.cat.report.task.OtherJobReport</implementation>
<requirements>
<requirement>
<role>com.dianping.cat.home.dal.report.DailyreportDao</role>
</requirement>
<requirement>
<role>com.dianping.cat.report.page.cross.DomainManager</role>
</requirement>
</requirements>
</component>
<component>
<role>com.dianping.cat.report.page.model.spi.ModelService</role>
<role-hint>transaction-local</role-hint>
......
......@@ -29,18 +29,18 @@
</c:if>
</c:forEach>
</ul></td>
<%-- <td width="20%"><ul class="tabs">
<td width="20%"><ul class="tabs">
<c:forEach var="page" items="${navBar.systemPages}">
<c:if test="${page.standalone}">
<li ${model.page.name == page.name ? 'class="selected"' : ''}><a
href="${model.webapp}/${page.moduleName}/${page.path}?domain=${model.domain}&date=${model.date}&reportType=${payload.reportType}&op=${payload.action.name}">${page.title}</a></li>
href="${model.webapp}/${page.moduleName}/${page.path}">${page.title}</a></li>
</c:if>
<c:if
test="${not page.standalone and model.page.name == page.name}">
<li class="selected">${page.title}</li>
</c:if>
</c:forEach>
</ul></td> --%>
</ul></td>
</tr>
</table>
<jsp:doBody />
......
.body-content {
height: 1200px;
text-align: left;
width: 100%;
}
.content-left {
float: left;
width: 15%;
text-indent: 1em;
height: 1200px;
text-align: left;
}
.content-right {
float: left;
width: 85%;
}
\ No newline at end of file
.dtree {
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 13px;
color: #666;
white-space: nowrap;
}
.dtree img {
border: 0px;
vertical-align: middle;
}
.dtree a {
color: #333;
text-decoration: none;
}
.dtree a.node,.dtree a.nodeSel {
white-space: nowrap;
padding: 1px 2px 1px 2px;
}
.dtree a.node:hover,.dtree a.nodeSel:hover {
color: #333;
text-decoration: underline;
}
.dtree a.nodeSel {
background-color: #c0d2ec;
}
.dtree .clip {
overflow: hidden;
}
\ No newline at end of file
function Node(id, pid, name, url, title, target, icon, iconOpen, open) { this.id = id; this.pid = pid; this.name = name; this.url = url; this.title = title; this.target = target; this.icon = icon; this.iconOpen = iconOpen; this._io = open || false; this._is = false; this._ls = false; this._hc = false; this._ai = 0; this._p; }; // Tree object function dTree(objName) { this.config = { target : null, folderLinks : true, useSelection : true, useCookies : true, useLines : true, useIcons : true, useStatusText : false, closeSameLevel : false, inOrder : false }; this.icon = { root : '/cat/img/base.gif', folder : '/cat/img/folder.gif', folderOpen : '/cat/img/folderopen.gif', node : '/cat/img/page.gif', empty : '/cat/img/empty.gif', line : '/cat/img/line.gif', join : '/cat/img/join.gif', joinBottom : '/cat/img/joinbottom.gif', plus : '/cat/img/plus.gif', plusBottom : '/cat/img/plusbottom.gif', minus : '/cat/img/minus.gif', minusBottom : '/cat/img/minusbottom.gif', nlPlus : '/cat/img/nolines_plus.gif', nlMinus : '/cat/img/nolines_minus.gif' }; this.obj = objName; this.aNodes = []; this.aIndent = []; this.root = new Node(-1); this.selectedNode = null; this.selectedFound = false; this.completed = false; }; // Adds a new node to the node array dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) { this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open); }; // Open/close all nodes dTree.prototype.openAll = function() { this.oAll(true); }; dTree.prototype.closeAll = function() { this.oAll(false); }; // Outputs the tree to the page dTree.prototype.toString = function() { var str = '<div class="dtree">\n'; if (document.getElementById) { if (this.config.useCookies) this.selectedNode = this.getSelected(); str += this.addNode(this.root); } else str += 'Browser not supported.'; str += '</div>'; if (!this.selectedFound) this.selectedNode = null; this.completed = true; return str; }; // Creates the tree structure dTree.prototype.addNode = function(pNode) { var str = ''; var n = 0; if (this.config.inOrder) n = pNode._ai; for (n; n < this.aNodes.length; n++) { if (this.aNodes[n].pid == pNode.id) { var cn = this.aNodes[n]; cn._p = pNode; cn._ai = n; this.setCS(cn); if (!cn.target && this.config.target) cn.target = this.config.target; if (cn._hc && !cn._io && this.config.useCookies) cn._io = this.isOpen(cn.id); if (!this.config.folderLinks && cn._hc) cn.url = null; if (this.config.useSelection && cn.id == this.selectedNode && !this.selectedFound) { cn._is = true; this.selectedNode = n; this.selectedFound = true; } str += this.node(cn, n); if (cn._ls) break; } } return str; }; // Creates the node icon, url and text dTree.prototype.node = function(node, nodeId) { var str = '<div class="dTreeNode">' + this.indent(node, nodeId); if (this.config.useIcons) { if (!node.icon) node.icon = (this.root.id == node.pid) ? this.icon.root : ((node._hc) ? this.icon.folder : this.icon.node); if (!node.iconOpen) node.iconOpen = (node._hc) ? this.icon.folderOpen : this.icon.node; if (this.root.id == node.pid) { node.icon = this.icon.root; node.iconOpen = this.icon.root; } str += '<img id="i' + this.obj + nodeId + '" src="' + ((node._io) ? node.iconOpen : node.icon) + '" alt="" />'; } if (node.url) { str += '<a id="s' + this.obj + nodeId + '" class="' + ((this.config.useSelection) ? ((node._is ? 'nodeSel' : 'node')) : 'node') + '" href="' + node.url + '"'; if (node.title) str += ' title="' + node.title + '"'; if (node.target) str += ' target="' + node.target + '"'; if (this.config.useStatusText) str += ' onmouseover="window.status=\'' + node.name + '\';return true;" onmouseout="window.status=\'\';return true;" '; if (this.config.useSelection && ((node._hc && this.config.folderLinks) || !node._hc)) str += ' onclick="javascript: ' + this.obj + '.s(' + nodeId + ');"'; str += '>'; } else if ((!this.config.folderLinks || !node.url) && node._hc && node.pid != this.root.id) str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');" class="node">'; str += node.name; if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += '</a>'; str += '</div>'; if (node._hc) { str += '<div id="d' + this.obj + nodeId + '" class="clip" style="display:' + ((this.root.id == node.pid || node._io) ? 'block' : 'none') + ';">'; str += this.addNode(node); str += '</div>'; } this.aIndent.pop(); return str; }; // Adds the empty and line icons dTree.prototype.indent = function(node, nodeId) { var str = ''; if (this.root.id != node.pid) { for ( var n = 0; n < this.aIndent.length; n++) str += '<img src="' + ((this.aIndent[n] == 1 && this.config.useLines) ? this.icon.line : this.icon.empty) + '" alt="" />'; (node._ls) ? this.aIndent.push(0) : this.aIndent.push(1); if (node._hc) { str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');"><img id="j' + this.obj + nodeId + '" src="'; if (!this.config.useLines) str += (node._io) ? this.icon.nlMinus : this.icon.nlPlus; else str += ((node._io) ? ((node._ls && this.config.useLines) ? this.icon.minusBottom : this.icon.minus) : ((node._ls && this.config.useLines) ? this.icon.plusBottom : this.icon.plus)); str += '" alt="" /></a>'; } else str += '<img src="' + ((this.config.useLines) ? ((node._ls) ? this.icon.joinBottom : this.icon.join) : this.icon.empty) + '" alt="" />'; } return str; }; // Checks if a node has any children and if it is the last sibling dTree.prototype.setCS = function(node) { var lastId; for ( var n = 0; n < this.aNodes.length; n++) { if (this.aNodes[n].pid == node.id) node._hc = true; if (this.aNodes[n].pid == node.pid) lastId = this.aNodes[n].id; } if (lastId == node.id) node._ls = true; }; // Returns the selected node dTree.prototype.getSelected = function() { var sn = this.getCookie('cs' + this.obj); return (sn) ? sn : null; }; // Highlights the selected node dTree.prototype.s = function(id) { if (!this.config.useSelection) return; var cn = this.aNodes[id]; if (cn._hc && !this.config.folderLinks) return; if (this.selectedNode != id) { if (this.selectedNode || this.selectedNode == 0) { eOld = document.getElementById("s" + this.obj + this.selectedNode); eOld.className = "node"; } eNew = document.getElementById("s" + this.obj + id); eNew.className = "nodeSel"; this.selectedNode = id; if (this.config.useCookies) this.setCookie('cs' + this.obj, cn.id); } }; // Toggle Open or close dTree.prototype.o = function(id) { var cn = this.aNodes[id]; this.nodeStatus(!cn._io, id, cn._ls); cn._io = !cn._io; if (this.config.closeSameLevel) this.closeLevel(cn); if (this.config.useCookies) this.updateCookie(); }; // Open or close all nodes dTree.prototype.oAll = function(status) { for ( var n = 0; n < this.aNodes.length; n++) { if (this.aNodes[n]._hc && this.aNodes[n].pid != this.root.id) { this.nodeStatus(status, n, this.aNodes[n]._ls); this.aNodes[n]._io = status; } } if (this.config.useCookies) this.updateCookie(); }; // Opens the tree to a specific node dTree.prototype.openTo = function(nId, bSelect, bFirst) { if (!bFirst) { for ( var n = 0; n < this.aNodes.length; n++) { if (this.aNodes[n].id == nId) { nId = n; break; } } } var cn = this.aNodes[nId]; if (cn.pid == this.root.id || !cn._p) return; cn._io = true; cn._is = bSelect; if (this.completed && cn._hc) this.nodeStatus(true, cn._ai, cn._ls); if (this.completed && bSelect) this.s(cn._ai); else if (bSelect) this._sn = cn._ai; this.openTo(cn._p._ai, false, true); }; // Closes all nodes on the same level as certain node dTree.prototype.closeLevel = function(node) { for ( var n = 0; n < this.aNodes.length; n++) { if (this.aNodes[n].pid == node.pid && this.aNodes[n].id != node.id && this.aNodes[n]._hc) { this.nodeStatus(false, n, this.aNodes[n]._ls); this.aNodes[n]._io = false; this.closeAllChildren(this.aNodes[n]); } } }; // Closes all children of a node dTree.prototype.closeAllChildren = function(node) { for ( var n = 0; n < this.aNodes.length; n++) { if (this.aNodes[n].pid == node.id && this.aNodes[n]._hc) { if (this.aNodes[n]._io) this.nodeStatus(false, n, this.aNodes[n]._ls); this.aNodes[n]._io = false; this.closeAllChildren(this.aNodes[n]); } } }; // Change the status of a node(open or closed) dTree.prototype.nodeStatus = function(status, id, bottom) { eDiv = document.getElementById('d' + this.obj + id); eJoin = document.getElementById('j' + this.obj + id); if (this.config.useIcons) { eIcon = document.getElementById('i' + this.obj + id); eIcon.src = (status) ? this.aNodes[id].iconOpen : this.aNodes[id].icon; } eJoin.src = (this.config.useLines) ? ((status) ? ((bottom) ? this.icon.minusBottom : this.icon.minus) : ((bottom) ? this.icon.plusBottom : this.icon.plus)) : ((status) ? this.icon.nlMinus : this.icon.nlPlus); eDiv.style.display = (status) ? 'block' : 'none'; }; // [Cookie] Clears a cookie dTree.prototype.clearCookie = function() { var now = new Date(); var yesterday = new Date(now.getTime() - 1000 * 60 * 60 * 24); this.setCookie('co' + this.obj, 'cookieValue', yesterday); this.setCookie('cs' + this.obj, 'cookieValue', yesterday); }; // [Cookie] Sets value in a cookie dTree.prototype.setCookie = function(cookieName, cookieValue, expires, path, domain, secure) { document.cookie = escape(cookieName) + '=' + escape(cookieValue) + (expires ? '; expires=' + expires.toGMTString() : '') + (path ? '; path=' + path : '') + (domain ? '; domain=' + domain : '') + (secure ? '; secure' : ''); }; // [Cookie] Gets a value from a cookie dTree.prototype.getCookie = function(cookieName) { var cookieValue = ''; var posName = document.cookie.indexOf(escape(cookieName) + '='); if (posName != -1) { var posValue = posName + (escape(cookieName) + '=').length; var endPos = document.cookie.indexOf(';', posValue); if (endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos)); else cookieValue = unescape(document.cookie.substring(posValue)); } return (cookieValue); }; // [Cookie] Returns ids of open nodes as a string dTree.prototype.updateCookie = function() { var str = ''; for ( var n = 0; n < this.aNodes.length; n++) { if (this.aNodes[n]._io && this.aNodes[n].pid != this.root.id) { if (str) str += '.'; str += this.aNodes[n].id; } } this.setCookie('co' + this.obj, str); }; // [Cookie] Checks if a node id is in a cookie dTree.prototype.isOpen = function(id) { var aOpen = this.getCookie('co' + this.obj).split('.'); for ( var n = 0; n < aOpen.length; n++) if (aOpen[n] == id) return true; return false; }; // If Push and pop is not implemented by the browser if (!Array.prototype.push) { Array.prototype.push = function array_push() { for ( var i = 0; i < arguments.length; i++) this[this.length] = arguments[i]; return this.length; }; }; if (!Array.prototype.pop) { Array.prototype.pop = function array_pop() { lastElement = this[this.length - 1]; this.length = Math.max(this.length - 1, 0); return lastElement; }; };
\ No newline at end of file
<%@ page contentType="text/html; charset=utf-8" %>
<jsp:useBean id="ctx" type="com.dianping.cat.system.page.alarm.Context" scope="request"/>
<jsp:useBean id="payload" type="com.dianping.cat.system.page.alarm.Payload" scope="request"/>
<jsp:useBean id="model" type="com.dianping.cat.system.page.alarm.Model" scope="request"/>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="a" uri="/WEB-INF/app.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="res" uri="http://www.unidal.org/webres"%>
<%@ taglib prefix="w" uri="http://www.unidal.org/web/core"%>
View of alarm page under system
\ No newline at end of file
<jsp:useBean id="ctx" type="com.dianping.cat.system.page.alarm.Context" scope="request" />
<jsp:useBean id="payload" type="com.dianping.cat.system.page.alarm.Payload" scope="request" />
<jsp:useBean id="model" type="com.dianping.cat.system.page.alarm.Model" scope="request" />
<a:body>
<res:useJs value="${res.js.local['dtree.js']}" target="head-js"/>
<res:useCss value='${res.css.local.dtree_css}' target="head-css" />
<res:useCss value='${res.css.local.alarm_css}' target="head-css" />
<div class="body-content">
<div class="content-left">
<p align="center">
<script type="text/javascript">
d = new dTree('d');
d.add(0, -1, 'CAT告警', '');
d.add(1, 0, '个人告警记录', 'javascript:getJRobinGraphList()');
d.add(2, 0, '告警规则订阅', '');
d.add(3, 0, '告警模板配置', '');
document.write(d);
d.openAll();
</script>
</div>
<div class="content-right">
<br>
TODO
</div>
</div>
</a:body>
\ No newline at end of file
CREATE TABLE `logview` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`message_id` varchar(64) NOT NULL COMMENT '消息ID',
`data_path` varchar(200) NOT NULL COMMENT '消息路径',
`data_offset` bigint(20) NOT NULL COMMENT '消息偏移量',
`data_length` int(11) NOT NULL COMMENT '消息长度',
`tag_thread` varchar(128) DEFAULT NULL COMMENT '消息的线程标志',
`tag_session` varchar(128) DEFAULT NULL COMMENT '消息的会话标志',
`tag_request` varchar(128) DEFAULT NULL COMMENT '消息请求标志',
`creation_date` timestamp NOT NULL COMMENT '创建时间',
PRIMARY KEY (`id`),
KEY `message_id` (`message_id`),
KEY `tag_thread` (`tag_thread`),
KEY `tag_session` (`tag_session`),
KEY `tag_request` (`tag_request`)
) DEFAULT CHARSET=utf8 COMMENT='logview用于存放错误的消息的索引,用来标志它在HDFS上的存放路径';
CREATE TABLE `report` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(20) NOT NULL COMMENT '报表名称, transaction, problem...',
`ip` varchar(20) NOT NULL COMMENT '报表来自于哪台cat-consumer机器',
`domain` varchar(20) NOT NULL COMMENT '报表处理的Domain信息',
`period` timestamp NOT NULL COMMENT '报表时间段',
`type` tinyint(4) NOT NULL COMMENT '报表数据格式, 1/xml, 2/json, 默认1',
`content` mediumtext NOT NULL COMMENT '报表内容',
`creation_date` timestamp NOT NULL COMMENT '报表创建时间',
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8 COMMENT='用于存放以小时为单位的报表信息';
CREATE TABLE `sqlreport` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`domain` varchar(50) NOT NULL COMMENT 'SQL报表的内容',
`name` varchar(100) NOT NULL COMMENT 'SQL的名称',
`statement` varchar(3000) NOT NULL COMMENT 'SQL的简写',
`total_count` int(11) NOT NULL COMMENT '总数',
`failure_count` int(11) NOT NULL COMMENT '错误数目',
`long_sqls` int(11) NOT NULL COMMENT 'longsql的数目',
`min_value` double NOT NULL COMMENT '最小值',
`max_value` double NOT NULL COMMENT '最大值',
`avg2_value` double NOT NULL COMMENT '90%的平均值',
`sum_value` double NOT NULL COMMENT '和',
`sum2_value` double NOT NULL COMMENT '平方和',
`sample_link` varchar(64) NOT NULL COMMENT '链接',
`transaction_date` datetime NOT NULL COMMENT 'SQL的时间段',
`creation_date` datetime NOT NULL COMMENT '数据库创建时间',
`duration_distribution` varchar(512) NOT NULL COMMENT 'SQL处理的时间分布信息',
`hits_over_time` varchar(512) NOT NULL COMMENT 'SQL在当前一个小时处理信息',
`duration_over_time` varchar(512) NOT NULL COMMENT 'SQL处理时间的信息',
`failure_over_time` varchar(512) NOT NULL COMMENT '在一个小时内的错误分布',
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8 COMMENT='用于存放Hadoop处理的SQL报表信息';
CREATE TABLE `comment` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`domain` varchar(50) NOT NULL COMMENT '报表Domain',
`author` varchar(32) NOT NULL COMMENT '作者',
`content` varchar(1024) NOT NULL COMMENT '事件内容',
`status` tinyint(4) NOT NULL COMMENT '执行状态: 0/active, 1/inactive',
`happened` datetime NOT NULL COMMENT '事件发生时间',
`creation_date` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8 COMMENT='用于存放故障/事件信息';
CREATE TABLE `task` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`producer` varchar(20) NOT NULL COMMENT '任务创建者ip',
`consumer` varchar(20) NULL COMMENT '任务执行者ip',
`failure_count` tinyint(4) NOT NULL COMMENT '任务失败次数',
`report_name` varchar(20) NOT NULL COMMENT '报表名称, transaction, problem...',
`report_domain` varchar(20) NOT NULL COMMENT '报表处理的Domain信息',
`report_period` datetime NOT NULL COMMENT '报表时间',
`status` tinyint(4) NOT NULL COMMENT '执行状态: 1/todo, 2/doing, 3/done 4/failed',
`task_type` tinyint(4) NOT NULL COMMENT '执行状态: /daily',
`creation_date` datetime NOT NULL COMMENT '任务创建时间',
`start_date` datetime NULL COMMENT '开始时间, 这次执行开始时间',
`end_date` datetime NULL COMMENT '结束时间, 这次执行结束时间',
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8 COMMENT='用于存放故障/事件信息';
CREATE UNIQUE INDEX task_period_domain_name ON task (report_period, report_domain, report_name);
CREATE TABLE `graph` (
CREATE TABLE `dailygraph` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(20) NOT NULL COMMENT '报表名称',
`ip` varchar(20) NULL COMMENT '报表来自于哪台cat-client机器ip, NULL表示合并同domain所有ip',
`ip` varchar(20) NULL COMMENT '报表来自于哪台cat-client机器ip, 空串表示合并同domain所有ip',
`domain` varchar(20) NOT NULL COMMENT '报表处理的Domain信息',
`period` datetime NOT NULL COMMENT '报表时间段',
`type` tinyint(4) NOT NULL COMMENT '报表数据格式, 1/xml, 2/json, 3/csv, 默认3',
`detail_content` mediumtext NOT NULL COMMENT '详细绘图内容',
`summary_content` mediumtext NOT NULL COMMENT '概要绘图内容',
`creation_date` datetime NOT NULL COMMENT '报表创建时间',
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8 COMMENT='用于存放以小时为单位的绘图数据';
CREATE UNIQUE INDEX graph_period_ip_domain_name ON graph (period, ip, domain, name);
PRIMARY KEY (`id`),
UNIQUE KEY `dailygraph_period_ip_domain_name` (`period`,`ip`,`domain`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用于月报的画图曲线';
CREATE TABLE `dailyreport` (
`id` int(11) NOT NULL AUTO_INCREMENT,
......@@ -105,25 +22,34 @@ CREATE TABLE `dailyreport` (
`type` tinyint(4) NOT NULL COMMENT '报表数据格式, 1/xml, 2/json, 默认1',
`content` mediumtext NOT NULL COMMENT '报表内容',
`creation_date` datetime NOT NULL COMMENT '报表创建时间',
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8 COMMENT='用于存放以天为单位的报表信息';
CREATE UNIQUE INDEX dailyreport_period_domain_name ON dailyreport (period, domain, name);
PRIMARY KEY (`id`),
UNIQUE KEY `period` (`period`,`domain`,`name`),
KEY `type` (`type`)
) ENGINE=InnoDB AUTO_INCREMENT=16027 DEFAULT CHARSET=utf8 COMMENT='天报表';
CREATE TABLE `dailygraph` (
CREATE TABLE `graph` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(20) NOT NULL COMMENT '报表名称',
`ip` varchar(20) NULL COMMENT '报表来自于哪台cat-client机器ip, 空串表示合并同domain所有ip',
`ip` varchar(20) NULL COMMENT '报表来自于哪台cat-client机器ip, NULL表示合并同domain所有ip',
`domain` varchar(20) NOT NULL COMMENT '报表处理的Domain信息',
`period` datetime NOT NULL COMMENT '报表时间段',
`type` tinyint(4) NOT NULL COMMENT '报表数据格式, 1/xml, 2/json, 3/csv, 默认3',
`detail_content` mediumtext NOT NULL COMMENT '详细绘图内容',
`summary_content` mediumtext NOT NULL COMMENT '概要绘图内容',
`creation_date` datetime NOT NULL COMMENT '报表创建时间',
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8 COMMENT='用于存放以天为单位的绘图数据';
PRIMARY KEY (`id`),
UNIQUE KEY `graph_period_ip_domain_name` (`period`,`ip`,`domain`,`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1588163 DEFAULT CHARSET=utf8 COMMENT='小时图表曲线';
CREATE UNIQUE INDEX dailygraph_period_ip_domain_name ON dailygraph (period, ip, domain, name);
CREATE TABLE `hostinfo` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ip` varchar(50) NOT NULL COMMENT '部署机器IP',
`domain` varchar(50) NOT NULL COMMENT '部署机器对应的项目名',
`creation_date` datetime NOT NULL,
`last_modified_date` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ip_index` (`ip`)
) ENGINE=InnoDB AUTO_INCREMENT=226602 DEFAULT CHARSET=utf8;
CREATE TABLE `location` (
`id` int(11) NOT NULL AUTO_INCREMENT,
......@@ -132,30 +58,110 @@ CREATE TABLE `location` (
`total` int(11) NOT NULL,
`transaction_date` datetime NOT NULL,
`creation_date` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `transaction_date_lat_lng` (`transaction_date`,`lat`,`lng`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='热点数据';
CREATE TABLE `maillog` (
`id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
`address` varchar(500) NOT NULL COMMENT '收件人',
`title` varchar(500) NOT NULL COMMENT '邮件标题',
`content` text NOT NULL COMMENT '邮件内容',
`sendtime` datetime NOT NULL COMMENT '发送时间',
`status` int(11) NOT NULL COMMENT '发送状态(0、发送成功;1、发送失败)',
`error` varchar(1000) DEFAULT NULL COMMENT '发送失败错误信息',
`cc` varchar(500) DEFAULT NULL COMMENT '邮件抄送人',
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8 COMMENT='热点数据';
) ENGINE=InnoDB AUTO_INCREMENT=2224 DEFAULT CHARSET=utf8 COMMENT='邮件提醒发送记录';
CREATE TABLE `monthreport` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`domain` varchar(100) DEFAULT NULL,
`period` datetime DEFAULT NULL,
`content` mediumtext,
`creation_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_2` (`name`,`domain`,`period`)
) ENGINE=InnoDB AUTO_INCREMENT=65 DEFAULT CHARSET=utf8;
CREATE UNIQUE INDEX transaction_date_lat_lng ON location (transaction_date, lat, lng);
CREATE TABLE `hostinfo` (
CREATE TABLE `report` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ip` varchar(50) NOT NULL COMMENT '机器的IP信息',
`domain` varchar(50) NOT NULL COMMENT 'IP对应项目信息',
`creation_date` datetime NOT NULL,
`last_modified_date` datetime NOT NULL,
`type` tinyint(4) NOT NULL COMMENT '报表类型',
`name` varchar(20) NOT NULL COMMENT '报表名称',
`ip` varchar(20) DEFAULT NULL COMMENT '报表来自于哪台机器',
`domain` varchar(50) NOT NULL,
`period` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '报表时间段',
`content` longtext NOT NULL,
`creation_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '报表创建时间',
PRIMARY KEY (`id`),
UNIQUE KEY `ip_index` (`ip`)
)
KEY `IX_Domain_Name_Period` (`domain`,`name`,`period`),
KEY `IX_Name_Period` (`name`,`period`),
KEY `IX_Period` (`period`)
) ENGINE=InnoDB AUTO_INCREMENT=433981 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED COMMENT='用于存放实时报表信息,处理之后的结果';
CREATE TABLE `sqlreport` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`domain` varchar(50) NOT NULL,
`name` varchar(100) NOT NULL COMMENT 'SQL的名称',
`statement` varchar(3000) NOT NULL COMMENT 'SQL的简写',
`total_count` int(11) NOT NULL COMMENT '总数',
`failure_count` int(11) NOT NULL COMMENT '错误数目',
`long_sqls` int(11) NOT NULL COMMENT 'longsql的数目',
`min_value` double NOT NULL COMMENT '最小值',
`max_value` double NOT NULL COMMENT '最大值',
`avg2_value` double NOT NULL COMMENT '90%的平均值',
`sum_value` double NOT NULL COMMENT '和',
`sum2_value` double NOT NULL COMMENT '平方和',
`sample_link` varchar(64) NOT NULL COMMENT '链接',
`transaction_date` datetime NOT NULL COMMENT 'SQL的时间段',
`creation_date` datetime NOT NULL COMMENT '数据库创建时间',
`duration_distribution` varchar(512) NOT NULL COMMENT 'SQL处理的时间分布信息',
`hits_over_time` varchar(512) NOT NULL COMMENT 'SQL在当前一个小时处理信息',
`duration_over_time` varchar(512) NOT NULL COMMENT 'SQL处理时间的信息',
`failure_over_time` varchar(512) NOT NULL COMMENT '在一个小时内的错误分布',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=196645 DEFAULT CHARSET=utf8 COMMENT='用于存放Hadoop处理的SQL报表信息';
CREATE TABLE `sqltable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`domain` varchar(50) DEFAULT NULL COMMENT '这条sql语句的属于项目名',
`sql_name` varchar(100) DEFAULT NULL COMMENT 'sql 语句的简写',
`table_name` varchar(100) DEFAULT NULL COMMENT 'sql语句操作的表名',
`sql_statement` varchar(1000) DEFAULT NULL COMMENT '具体的sql名称',
`sql_statement` text,
`creation_date` datetime DEFAULT NULL COMMENT '创建时间',
`modify_date` datetime DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`),
KEY `domain` (`domain`),
KEY `sql_name` (`sql_name`)
)
) ENGINE=InnoDB AUTO_INCREMENT=767 DEFAULT CHARSET=utf8;
CREATE TABLE `subscriber` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`domain` char(250) NOT NULL COMMENT '域名',
`group` char(250) NOT NULL COMMENT '域名',
`owner` char(250) NOT NULL COMMENT '域名',
`address` varchar(1000) NOT NULL COMMENT '订阅者地址',
`type` int(4) NOT NULL DEFAULT '0' COMMENT '订阅类型(0,表示邮件;1,表示短信)',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8 COMMENT='通知订阅者表';
CREATE TABLE `task` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`producer` varchar(20) NOT NULL COMMENT '任务创建者ip',
`consumer` varchar(20) NULL COMMENT '任务执行者ip',
`failure_count` tinyint(4) NOT NULL COMMENT '任务失败次数',
`report_name` varchar(20) NOT NULL COMMENT '报表名称, transaction, problem...',
`report_domain` varchar(20) NOT NULL COMMENT '报表处理的Domain信息',
`report_period` datetime NOT NULL COMMENT '报表时间',
`status` tinyint(4) NOT NULL COMMENT '执行状态: 1/todo, 2/doing, 3/done 4/failed',
`task_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '0表示小时任务,1表示天任务',
`creation_date` datetime NOT NULL COMMENT '任务创建时间',
`start_date` datetime NULL COMMENT '开始时间, 这次执行开始时间',
`end_date` datetime NULL COMMENT '结束时间, 这次执行结束时间',
PRIMARY KEY (`id`),
UNIQUE KEY `task_period_domain_name_type` (`report_period`,`report_domain`,`report_name`,`task_type`)
) ENGINE=InnoDB AUTO_INCREMENT=471692 DEFAULT CHARSET=utf8 COMMENT='后台任务';
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册