|
|
package com.monitor.middleware.redis.service.impl;
|
|
|
|
|
|
import com.model.RedisMonitor;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
public class Test {
|
|
|
public static void main(String[] args) {
|
|
|
StringBuffer buff = new StringBuffer();
|
|
|
List<RedisInfo> list = new ArrayList<RedisInfo>();
|
|
|
List<RedisMonitor> list = new ArrayList<RedisMonitor>();
|
|
|
|
|
|
int width1=12;
|
|
|
int width2=8;
|
|
|
int width21=30;
|
|
|
int width3=4;
|
|
|
|
|
|
RedisInfo redis1 = new RedisInfo();
|
|
|
|
|
|
RedisMonitor redis1 = new RedisMonitor();
|
|
|
redis1.setNodeFrom("AWS");
|
|
|
redis1.setNodeTo("172.31.19.49:6379");
|
|
|
redis1.setLevel(1);
|
|
|
list.add(redis1);
|
|
|
RedisInfo redis2 = new RedisInfo();
|
|
|
RedisMonitor redis2 = new RedisMonitor();
|
|
|
redis2.setNodeFrom("AWS");
|
|
|
redis2.setNodeTo("172.31.24.61:6379");
|
|
|
redis2.setLevel(1);
|
|
|
list.add(redis2);
|
|
|
RedisInfo redis3 = new RedisInfo();
|
|
|
RedisMonitor redis3 = new RedisMonitor();
|
|
|
redis3.setNodeFrom("172.31.19.49:6379");
|
|
|
redis3.setNodeTo("172.31.19.49:16379");
|
|
|
redis3.setLevel(2);
|
|
|
list.add(redis3);
|
|
|
RedisInfo redis4 = new RedisInfo();
|
|
|
RedisMonitor redis4 = new RedisMonitor();
|
|
|
redis4.setNodeFrom("172.31.19.49:6379");
|
|
|
redis4.setNodeTo("172.31.19.49:26379");
|
|
|
redis4.setLevel(2);
|
|
|
list.add(redis4);
|
|
|
RedisInfo redis5 = new RedisInfo();
|
|
|
RedisMonitor redis5 = new RedisMonitor();
|
|
|
redis5.setNodeFrom("172.31.24.61:6379");
|
|
|
redis5.setNodeTo("172.31.24.61:16379");
|
|
|
redis5.setLevel(2);
|
|
|
list.add(redis5);
|
|
|
RedisInfo redis6 = new RedisInfo();
|
|
|
RedisMonitor redis6 = new RedisMonitor();
|
|
|
redis6.setNodeFrom("172.31.24.61:6379");
|
|
|
redis6.setNodeTo("172.31.24.61:26379");
|
|
|
redis6.setLevel(2);
|
|
|
list.add(redis6);
|
|
|
RedisInfo redis7 = new RedisInfo();
|
|
|
RedisMonitor redis7 = new RedisMonitor();
|
|
|
redis7.setNodeFrom("AWS");
|
|
|
redis7.setNodeTo("AWS");
|
|
|
redis7.setLevel(0);
|
|
|
redis7.setParamMonitor("AWS");
|
|
|
list.add(redis7);
|
|
|
|
|
|
RedisInfo redis10 = new RedisInfo();
|
|
|
|
|
|
RedisMonitor redis10 = new RedisMonitor();
|
|
|
redis10.setNodeFrom("Qcloud");
|
|
|
redis10.setNodeTo("10.66.4.2:6379");
|
|
|
redis10.setLevel(1);
|
|
|
list.add(redis10);
|
|
|
RedisInfo redis20 = new RedisInfo();
|
|
|
RedisMonitor redis20 = new RedisMonitor();
|
|
|
redis20.setNodeFrom("10.66.4.2:6379");
|
|
|
redis20.setNodeTo("10.66.4.2:16379");
|
|
|
redis20.setLevel(2);
|
|
|
list.add(redis20);
|
|
|
RedisInfo redis30 = new RedisInfo();
|
|
|
RedisMonitor redis30 = new RedisMonitor();
|
|
|
redis30.setNodeFrom("10.66.4.2:6379");
|
|
|
redis30.setNodeTo("10.66.4.2:26379");
|
|
|
redis30.setLevel(2);
|
|
|
list.add(redis30);
|
|
|
RedisInfo redis40 = new RedisInfo();
|
|
|
RedisMonitor redis40 = new RedisMonitor();
|
|
|
redis40.setNodeFrom("10.66.4.2:6379");
|
|
|
redis40.setNodeTo("10.66.4.10:16379");
|
|
|
redis40.setLevel(2);
|
|
|
list.add(redis40);
|
|
|
RedisInfo redis50 = new RedisInfo();
|
|
|
RedisMonitor redis50 = new RedisMonitor();
|
|
|
redis50.setNodeFrom("10.66.4.2:6379");
|
|
|
redis50.setNodeTo("10.66.4.10:26379");
|
|
|
redis50.setLevel(2);
|
|
|
list.add(redis50);
|
|
|
RedisInfo redis60 = new RedisInfo();
|
|
|
RedisMonitor redis60 = new RedisMonitor();
|
|
|
redis60.setNodeFrom("10.66.4.2:6379");
|
|
|
redis60.setNodeTo("10.66.4.11:16379");
|
|
|
redis60.setLevel(2);
|
|
|
list.add(redis60);
|
|
|
RedisInfo redis70 = new RedisInfo();
|
|
|
RedisMonitor redis70 = new RedisMonitor();
|
|
|
redis70.setNodeFrom("Qcloud");
|
|
|
redis70.setNodeTo("Qcloud");
|
|
|
redis70.setLevel(0);
|
...
|
...
|
@@ -88,12 +90,12 @@ public class Test { |
|
|
|
|
|
buff.append("'<chart charttopmargin=\"0\" chartBottomMargin=\"0\" chartleftmargin=\"0\" chartrightmargin=\"0\" bordercolor=\"#FFFFFF\" border=\"0\" borderAlpha=\"0\" borderThickness=\"0\" canvasBorderThickness=\"0\" canvasBorderColor=\"#FFFFFF\" showFormBtn=\"0\">\\n\\\n");
|
|
|
buff.append("<dataset plotborderAlpha=\"0\" >\\n\\\n");
|
|
|
for(RedisInfo info : list){
|
|
|
for(RedisMonitor info : list){
|
|
|
if(info.getLevel()==0){
|
|
|
buff.append("<set x=\""+width1+"\" y=\"80\" width=\"120\" height=\"40\" name=\""+info.getNodeFrom()+"\" color=\"62D0FE\" id=\""+info.getNodeTo()+"\" tooltext= \""+info.getParamMonitor()+"\" />\\n\\\n");
|
|
|
width1+=18;
|
|
|
}else if(info.getLevel()==1){
|
|
|
if(info.getId().equals("Qcloud")){
|
|
|
if(info.getNodeFrom().equals("Qcloud")){
|
|
|
buff.append("<set x=\""+width21+"\" y=\"70\" width=\"120\" height=\"40\" name=\""+info.getNodeFrom()+"\" color=\"62D0FE\" id=\""+info.getNodeTo()+"\" />\\n\\\n");
|
|
|
width21+=8;
|
|
|
}else{
|
...
|
...
|
@@ -107,7 +109,7 @@ public class Test { |
|
|
}
|
|
|
buff.append("</dataset>\\n\\\n");
|
|
|
buff.append("<connectors color=\"83C6E1\" stdThickness=\"8\">\\n\\\n");
|
|
|
for(RedisInfo info : list){
|
|
|
for(RedisMonitor info : list){
|
|
|
buff.append("<connector strength=\"0.45\" from=\""+info.getNodeFrom()+"\" to=\""+info.getNodeTo()+"\" arrowAtStart=\"0\" arrowAtEnd=\"0\"/>\\n\\\n");
|
|
|
}
|
|
|
buff.append("</connectors>\\n\\\n</chart>'");
|
...
|
...
|
|