提交 596b95ad 编写于 作者: L leon.li

add new model: AlertType

上级 1ae23391
......@@ -154,14 +154,15 @@
${basedir}/src/main/resources/META-INF/dal/model/heavy-report-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/utilization-report-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/domainGroup-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/metric-group-config-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/metric-group-config-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/metric-aggregation-config-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/netgraph-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/alert-report-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/monitor-rules-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/alertconfig-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/alertsummary-manifest.xml,
</manifest>
${basedir}/src/main/resources/META-INF/dal/model/alert-type-manifest.xml,
</manifest>
</configuration>
</execution>
<execution>
......@@ -202,20 +203,20 @@
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.26</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<contextPath>/cat</contextPath>
<defaultsDescriptor>src/main/webapp/WEB-INF/web.xml</defaultsDescriptor>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>2281</port>
<maxIdleTime>500000</maxIdleTime>
</connector>
</connectors>
</configuration>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.26</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<contextPath>/cat</contextPath>
<defaultsDescriptor>src/main/webapp/WEB-INF/web.xml</defaultsDescriptor>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>2281</port>
<maxIdleTime>500000</maxIdleTime>
</connector>
</connectors>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -41,7 +41,7 @@ public class AlertExceptionBuilder {
double totalWarnLimit = totalLimitPair.getKey();
double totalErrorLimit = totalLimitPair.getValue();
double totalException = 0;
for (Entry<String, Double> entry : item.getException().entrySet()) {
String exceptionName = entry.getKey();
......@@ -138,7 +138,7 @@ public class AlertExceptionBuilder {
String time = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date());
sb.append("[CAT异常告警] [项目: ").append(domain).append("] : ");
sb.append(exceptions).append("[时间: ").append(time).append("]");
sb.append(exceptions).append("[时间: ").append(time).append("]").append("\n");
sb.append(contactInfo);
return sb.toString();
......
<?xml version="1.0" encoding="UTF-8"?>
<model>
<entity name="alert-type" root="true">
<entity-ref name="category" type="list" names="categories" />
</entity>
<entity name="category">
<attribute name="id" value-type="String" />
<entity-ref name="domain" type="list" names="domains" />
</entity>
<entity name="domain">
<attribute name="id" value-type="String" />
<entity-ref name="type" type="list" names="types" />
</entity>
<entity name="type">
<attribute name="id" value-type="String" />
<attribute name="sendSms" value-type="boolean" />
<attribute name="sendMail" value-type="boolean" />
<attribute name="sendWeixin" value-type="boolean" />
</entity>
</model>
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<file path="alert-type-codegen.xml" />
<file path="alert-type-model.xml" />
</manifest>
<?xml version="1.0" encoding="UTF-8"?>
<model model-package="com.dianping.cat.home.alert.type"
enable-sax-parser="true" enable-xml-parser="true" enable-xml-builder="true">
<entity name="alert-type" root="true">
<entity-ref name="category" type="map" names="categories"
method-find-or-create='true' />
</entity>
<entity name="category">
<attribute name="id" value-type="String" key="true" />
<entity-ref name="domain" type="map" names="domains"
method-find-or-create='true' />
</entity>
<entity name="domain">
<attribute name="id" value-type="String" key="true" />
<entity-ref name="type" type="map" names="types"
method-find-or-create='true' />
</entity>
<entity name="type">
<attribute name="id" value-type="String" key="true" />
<attribute name="sendSms" value-type="boolean" />
<attribute name="sendMail" value-type="boolean" />
<attribute name="sendWeixin" value-type="boolean" />
</entity>
</model>
......@@ -54,4 +54,7 @@
<model package="com.dianping.cat.home.alertsummary" name="alertsummary">
<sample-model>/Users/leon/Desktop/AlertSummary.xml</sample-model>
</model>
<model package="com.dianping.cat.home.alert.type" name="alert-type">
<sample-model>/Users/leon/Documents/GitRepo/cat/cat-home/src/test/resources/config/alert-type.xml</sample-model>
</model>
</wizard>
<alert-type>
<category id="network">
<domain id="cat">
<type id="error" sendSms="true" sendMail="true" sendWeixin="true" />
<type id="warning" sendSms="true" sendMail="true" sendWeixin="true" />
<type id="error" sendSms="true" sendMail="true" sendWeixin="true" />
</domain>
<domain id="cat">
<type id="error" sendSms="true" sendMail="true" sendWeixin="true" />
<type id="error" sendSms="true" sendMail="true" sendWeixin="true" />
<type id="error" sendSms="true" sendMail="true" sendWeixin="true" />
</domain>
<domain id="cat">
<type id="error" sendSms="true" sendMail="true" sendWeixin="true" />
<type id="error" sendSms="true" sendMail="true" sendWeixin="true" />
<type id="error" sendSms="true" sendMail="true" sendWeixin="true" />
</domain>
</category>
<category id="exception">
<domain id="cat">
<type id="error" sendSms="true" sendMail="true" sendWeixin="true" />
<type id="error" sendSms="true" sendMail="true" sendWeixin="true" />
<type id="error" sendSms="true" sendMail="true" sendWeixin="true" />
</domain>
</category>
</alert-type>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册