01 package com.aqua.examples;
02
03 import jsystem.framework.monitor.Monitor;
04 import jsystem.utils.MiscUtils;
05
06 public class PingMonitor extends Monitor {
07 String host;
08 public PingMonitor(String host) {
09 super("PingMonitor_" + host);
10 this.host = host;
11 }
12
13 public void run() {
14 while(true){
15 if(!MiscUtils.isPing(host)){
16 report.report("Fail to ping to host: " + host, false);
17 setFail(true);
18 }
19 try {
20 Thread.sleep(5000);
21 } catch (InterruptedException ex){
22 return;
23 }
24 }
25 }
26 }
|
|
|
|