Skip to content

Commit

Permalink
优化告警规则
Browse files Browse the repository at this point in the history
  • Loading branch information
calvin1978 committed Nov 2, 2018
1 parent 8bb35a9 commit 3b95f84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions vjtop/src/main/java/com/vip/vjtools/vjtop/VMDetailView.java
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ private void printTopCpuThreads(ThreadInfoMode mode, boolean console) throws IOE

// 打印线程view的页头
String titleFormat = "%n %6s %-" + getThreadNameWidth() + "s %10s %6s %6s %6s %6s%n";
String dataFormat = " %6d %-" + getThreadNameWidth() + "s %10s %s%5.2f%%%s %s%5.2f%%%s %5.2f%% %5.2f%%%n";
String dataFormat = " %6d %-" + getThreadNameWidth() + "s %10s %5.2f%% %5.2f%% %5.2f%% %5.2f%%%n";
String dataFormatAsText = "thread-%d:%s %s %.2f %.2f %.2f %.2f%n";
if (console) {
System.out.printf(titleFormat, "TID", "NAME ", "STATE", "CPU", "SYSCPU", " TOTAL", "TOLSYS");
Expand Down Expand Up @@ -297,13 +297,9 @@ private void printTopCpuThreads(ThreadInfoMode mode, boolean console) throws IOE
1);

if (console) {
String[] cpuAnsi = Formats.colorAnsi(cpu, warning.cpu);

String[] syscpuAnsi = Formats.colorAnsi(syscpu, warning.syscpu);

System.out.printf(dataFormat, tid, threadName, Formats.leftStr(info.getThreadState().toString(), 10),
cpuAnsi[0], cpu, cpuAnsi[1], syscpuAnsi[0], syscpu, syscpuAnsi[1], totalcpuPercent,
totalsysPercent);
cpu, syscpu, totalcpuPercent, totalsysPercent);
} else {
System.out.printf(dataFormatAsText, tid, threadName, info.getThreadState().toString(), cpu, syscpu,
totalcpuPercent, totalsysPercent);
Expand Down
4 changes: 2 additions & 2 deletions vjtop/src/main/java/com/vip/vjtools/vjtop/WarningRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
public class WarningRule {

public DoubleWarning cpu = new DoubleWarning(50d, 70d);
public DoubleWarning syscpu = new DoubleWarning(30d, 50d);

public LongWarning swap = new LongWarning(1, 1);
public LongWarning thread = new LongWarning();
public LongWarning newThread = new LongWarning();
public LongWarning io = new LongWarning(30 * Formats.MB_SIZE, 100 * Formats.MB_SIZE);
public LongWarning io = new LongWarning(100 * Formats.MB_SIZE, Long.MAX_VALUE);

public LongWarning loadClass = new LongWarning(80000, 150000);
public LongWarning newClass = new LongWarning(1, Long.MAX_VALUE);
Expand Down

0 comments on commit 3b95f84

Please sign in to comment.