|
|
package com.monitor.middleware.redis.service.impl;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import com.model.RedisInfo;
|
|
|
|
|
|
public class Test {
|
|
|
public static void main(String[] args) {
|
|
|
StringBuffer buff = new StringBuffer();
|
|
|
List<RedisInfo> list = new ArrayList<RedisInfo>();
|
|
|
|
|
|
int width1=12;
|
|
|
int width2=8;
|
|
|
int width21=30;
|
|
|
int width3=4;
|
|
|
|
|
|
RedisInfo redis1 = new RedisInfo();
|
|
|
redis1.setNodeFrom("AWS");
|
|
|
redis1.setNodeTo("172.31.19.49:6379");
|
|
|
redis1.setLevel(1);
|
|
|
list.add(redis1);
|
|
|
RedisInfo redis2 = new RedisInfo();
|
|
|
redis2.setNodeFrom("AWS");
|
|
|
redis2.setNodeTo("172.31.24.61:6379");
|
|
|
redis2.setLevel(1);
|
|
|
list.add(redis2);
|
|
|
RedisInfo redis3 = new RedisInfo();
|
|
|
redis3.setNodeFrom("172.31.19.49:6379");
|
|
|
redis3.setNodeTo("172.31.19.49:16379");
|
|
|
redis3.setLevel(2);
|
|
|
list.add(redis3);
|
|
|
RedisInfo redis4 = new RedisInfo();
|
|
|
redis4.setNodeFrom("172.31.19.49:6379");
|
|
|
redis4.setNodeTo("172.31.19.49:26379");
|
|
|
redis4.setLevel(2);
|
|
|
list.add(redis4);
|
|
|
RedisInfo redis5 = new RedisInfo();
|
|
|
redis5.setNodeFrom("172.31.24.61:6379");
|
|
|
redis5.setNodeTo("172.31.24.61:16379");
|
|
|
redis5.setLevel(2);
|
|
|
list.add(redis5);
|
|
|
RedisInfo redis6 = new RedisInfo();
|
|
|
redis6.setNodeFrom("172.31.24.61:6379");
|
|
|
redis6.setNodeTo("172.31.24.61:26379");
|
|
|
redis6.setLevel(2);
|
|
|
list.add(redis6);
|
|
|
RedisInfo redis7 = new RedisInfo();
|
|
|
redis7.setNodeFrom("AWS");
|
|
|
redis7.setNodeTo("AWS");
|
|
|
redis7.setLevel(0);
|
|
|
redis7.setParamMonitor("AWS");
|
|
|
list.add(redis7);
|
|
|
|
|
|
RedisInfo redis10 = new RedisInfo();
|
|
|
redis10.setNodeFrom("Qcloud");
|
|
|
redis10.setNodeTo("10.66.4.2:6379");
|
|
|
redis10.setLevel(1);
|
|
|
list.add(redis10);
|
|
|
RedisInfo redis20 = new RedisInfo();
|
|
|
redis20.setNodeFrom("10.66.4.2:6379");
|
|
|
redis20.setNodeTo("10.66.4.2:16379");
|
|
|
redis20.setLevel(2);
|
|
|
list.add(redis20);
|
|
|
RedisInfo redis30 = new RedisInfo();
|
|
|
redis30.setNodeFrom("10.66.4.2:6379");
|
|
|
redis30.setNodeTo("10.66.4.2:26379");
|
|
|
redis30.setLevel(2);
|
|
|
list.add(redis30);
|
|
|
RedisInfo redis40 = new RedisInfo();
|
|
|
redis40.setNodeFrom("10.66.4.2:6379");
|
|
|
redis40.setNodeTo("10.66.4.10:16379");
|
|
|
redis40.setLevel(2);
|
|
|
list.add(redis40);
|
|
|
RedisInfo redis50 = new RedisInfo();
|
|
|
redis50.setNodeFrom("10.66.4.2:6379");
|
|
|
redis50.setNodeTo("10.66.4.10:26379");
|
|
|
redis50.setLevel(2);
|
|
|
list.add(redis50);
|
|
|
RedisInfo redis60 = new RedisInfo();
|
|
|
redis60.setNodeFrom("10.66.4.2:6379");
|
|
|
redis60.setNodeTo("10.66.4.11:16379");
|
|
|
redis60.setLevel(2);
|
|
|
list.add(redis60);
|
|
|
RedisInfo redis70 = new RedisInfo();
|
|
|
redis70.setNodeFrom("Qcloud");
|
|
|
redis70.setNodeTo("Qcloud");
|
|
|
redis70.setLevel(0);
|
|
|
list.add(redis70);
|
|
|
|
|
|
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){
|
|
|
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")){
|
|
|
buff.append("<set x=\""+width21+"\" y=\"70\" width=\"120\" height=\"40\" name=\""+info.getNodeFrom()+"\" color=\"62D0FE\" id=\""+info.getNodeTo()+"\" />\\n\\\n");
|
|
|
width21+=8;
|
|
|
}else{
|
|
|
buff.append("<set x=\""+width2+"\" y=\"70\" width=\"120\" height=\"40\" name=\""+info.getNodeFrom()+"\" color=\"62D0FE\" id=\""+info.getNodeTo()+"\" />\\n\\\n");
|
|
|
width2+=8;
|
|
|
}
|
|
|
}else if(info.getLevel()==2){
|
|
|
buff.append("<set x=\""+width3+"\" y=\"55\" width=\"55\" height=\"40\" name=\""+info.getNodeFrom()+"\" color=\"62D0FE\" id=\""+info.getNodeTo()+"\" />\\n\\\n");
|
|
|
width3+=4;
|
|
|
}
|
|
|
}
|
|
|
buff.append("</dataset>\\n\\\n");
|
|
|
buff.append("<connectors color=\"83C6E1\" stdThickness=\"8\">\\n\\\n");
|
|
|
for(RedisInfo 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>'");
|
|
|
buff.toString();
|
|
|
System.out.println(buff.toString());
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|