Beispiel #1
0
  public boolean delete(String id) {
    boolean result = false;
    try {
      WasConfig pvo = (WasConfig) findByID(id + "");
      String ipstr = pvo.getIpaddress();
      String allipstr = SysUtil.doip(ipstr);

      CreateTableManager ctable = new CreateTableManager();
      ctable.deleteTable("wasping", allipstr, "wasping"); // Ping
      ctable.deleteTable("waspinghour", allipstr, "waspinghour"); // Ping
      ctable.deleteTable("waspingday", allipstr, "waspingday"); // Ping

      // 自服务器启动以来的CPU平均使用率
      ctable.deleteTable("wasrcpu", allipstr, "wasrcpu"); // Ping
      ctable.deleteTable("wasrcpuhour", allipstr, "wasrcpuhour"); // Ping
      ctable.deleteTable("wasrcpuday", allipstr, "wasrcpuday"); // Ping

      // 自上次查询以来的平均CPU使用率
      ctable.deleteTable("wasscpu", allipstr, "wasscpu"); // Ping
      ctable.deleteTable("wasscpuhour", allipstr, "wasscpuhour"); // Ping
      ctable.deleteTable("wasscpuday", allipstr, "wasscpuday"); // Ping

      // 缓存命中率
      ctable.deleteTable("wasrate", allipstr, "wasrate"); // Ping
      ctable.deleteTable("wasratehour", allipstr, "wasratehour"); // Ping
      ctable.deleteTable("wasrateday", allipstr, "wasrateday"); // Ping

      // JVM内存利用率
      ctable.deleteTable("wasjvm", allipstr, "wasjvm");
      ctable.deleteTable("wasjvmhour", allipstr, "wasjvmhour");
      ctable.deleteTable("wasjvmday", allipstr, "wasjvmday");

      // 性能表
      ctable.deleteTable("wassystem", allipstr, "wassystem");
      ctable.deleteTable("wassystemhour", allipstr, "wassystemhour");
      ctable.deleteTable("wassystemday", allipstr, "wassystemday");

      ctable.deleteTable("wasjdbc", allipstr, "wasjdbc");
      ctable.deleteTable("wasjdbchour", allipstr, "wasjdbchour");
      ctable.deleteTable("wasjdbcday", allipstr, "wasjdbcday");

      ctable.deleteTable("wassession", allipstr, "wassession");
      ctable.deleteTable("wassessionh", allipstr, "wassessionh"); // wassessionhour
      // 必须保留session字段
      ctable.deleteTable("wassessiond", allipstr, "wassessiond"); // wassessionday

      ctable.deleteTable("wasjvminfo", allipstr, "wasjvminfo");
      ctable.deleteTable("wasjvminfoh", allipstr, "wasjvmhour"); // wasjvminfohour
      // 必须保留jvminfo字段
      ctable.deleteTable("wasjvminfod", allipstr, "wasjvmday"); // wasjvminfoday

      ctable.deleteTable("wascache", allipstr, "wascache");
      ctable.deleteTable("wascachehour", allipstr, "wascachehour");
      ctable.deleteTable("wascacheday", allipstr, "wascacheday");

      ctable.deleteTable("wasthread", allipstr, "wasthread");
      ctable.deleteTable("wasthreadhour", allipstr, "wasthreadhour");
      ctable.deleteTable("wasthreadday", allipstr, "wasthreadday");

      ctable.deleteTable("wastrans", allipstr, "wastrans");
      ctable.deleteTable("wastranshour", allipstr, "wastranshour");
      ctable.deleteTable("wastransday", allipstr, "wastransday");

      conn.addBatch("delete from nms_wasconfig where id=" + id);
      conn.executeBatch();
      result = true;
      try {
        // 同时删除事件表里的相关数据
        EventListDao eventdao = new EventListDao();
        eventdao.delete(Integer.parseInt(id), "wasserver");
      } catch (Exception e) {
        e.printStackTrace();
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      conn.close();
    }

    return result;
  }
  @SuppressWarnings("unchecked")
  public Hashtable collect_Data(NodeGatherIndicators nodeGatherIndicators) {
    WasConfig wasconf = null;
    String id = nodeGatherIndicators.getNodeid();
    SysLogger.info("#######################WebSphere Ping 开始采集###################################");

    try {
      WasConfigDao dao = new WasConfigDao();
      try {
        wasconf = (WasConfig) dao.findByID(id);
        SysLogger.info(
            "###############WebSphere   Ping  名称:"
                + wasconf.getName()
                + " ipaddress:"
                + wasconf.getIpaddress()
                + "#####################");
      } catch (Exception e) {
        e.printStackTrace();
      } finally {
        dao.close();
      }
      Hashtable hst = (Hashtable) ShareData.getWasdata().get(wasconf.getIpaddress());
      if (hst == null) {
        hst = new Hashtable();
      }
      UrlConncetWas conWas = new UrlConncetWas();
      boolean collectWasIsOK = false;
      // 采集数据
      try {
        String url =
            "http://"
                + wasconf.getIpaddress()
                + ":"
                + wasconf.getPortnum()
                + "/wasPerfTool/servlet/perfservlet?refreshConfig=true";
        System.out.println(url);
        collectWasIsOK = conWas.connectWasIsOK(wasconf.getIpaddress(), wasconf.getPortnum());
      } catch (Exception e) {
        e.printStackTrace();
      }
      String pingValue = "0";
      if (collectWasIsOK) {
        pingValue = "100";
        hst.put("ping", "100");
      } else {
        hst.put("ping", "0");
      }

      // 保存数据库
      Pingcollectdata hostdata = new Pingcollectdata();
      hostdata.setIpaddress(wasconf.getIpaddress());
      Calendar date = Calendar.getInstance();
      hostdata.setCollecttime(date);
      hostdata.setCategory("WasPing");
      hostdata.setEntity("Utilization");
      hostdata.setSubentity("ConnectUtilization");
      hostdata.setRestype("dynamic");
      hostdata.setUnit("%");
      hostdata.setThevalue(pingValue);
      WasConfigDao wasconfigdao = new WasConfigDao();
      try {
        wasconfigdao.createHostData(wasconf, hostdata);
      } catch (Exception e) {
        e.printStackTrace();
      } finally {
        wasconfigdao.close();
      }
      ShareData.getWasdata().put(wasconf.getIpaddress(), hst);
      // 告警,只告警PING值
      if (pingValue != null) {
        NodeUtil nodeUtil = new NodeUtil();
        NodeDTO nodeDTO = nodeUtil.conversionToNodeDTO(wasconf);
        // 判断是否存在此告警指标
        AlarmIndicatorsUtil alarmIndicatorsUtil = new AlarmIndicatorsUtil();
        List list =
            alarmIndicatorsUtil.getAlarmInicatorsThresholdForNode(
                nodeDTO.getId() + "", nodeDTO.getType(), nodeDTO.getSubtype());
        CheckEventUtil checkEventUtil = new CheckEventUtil();
        for (int i = 0; i < list.size(); i++) {
          AlarmIndicatorsNode alarmIndicatorsNode = (AlarmIndicatorsNode) list.get(i);
          if ("ping".equalsIgnoreCase(alarmIndicatorsNode.getName())) {
            if (pingValue != null) {
              checkEventUtil.checkEvent(nodeDTO, alarmIndicatorsNode, pingValue);
            }
          }
        }
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }
Beispiel #3
0
  public boolean update(BaseVo vo) {
    boolean flag = true;
    WasConfig vo1 = (WasConfig) vo;
    WasConfig pvo = (WasConfig) findByID(vo1.getId() + "");
    StringBuffer sql = new StringBuffer();
    sql.append("update nms_wasconfig set name='");
    sql.append(vo1.getName());
    sql.append("',ipaddress='");
    sql.append(vo1.getIpaddress());
    sql.append("',portnum='");
    sql.append(vo1.getPortnum());
    sql.append("',nodename='");
    sql.append(vo1.getNodename());
    sql.append("',servername='");
    sql.append(vo1.getServername());
    sql.append("',sendmobiles='");
    sql.append(vo1.getSendmobiles());
    sql.append("',mon_flag='");
    sql.append(vo1.getMon_flag());
    sql.append("',netid='");
    sql.append(vo1.getNetid());
    sql.append("',sendemail='");
    sql.append(vo1.getSendemail());
    sql.append("',supperid='");
    sql.append(vo1.getSupperid());
    sql.append("',version='");
    sql.append(vo1.getVersion());
    sql.append("' where id=" + vo1.getId());
    try {
      conn = new DBManager();
      saveOrUpdate(sql.toString());
      if (!vo1.getIpaddress().equals(pvo.getIpaddress())) {
        String ipstr = pvo.getIpaddress();
        String allipstr = SysUtil.doip(ipstr);

        CreateTableManager ctable = new CreateTableManager();

        // conn = new DBManager();
        ctable.deleteTable("wasping", allipstr, "wasping"); // Ping
        ctable.deleteTable("waspinghour", allipstr, "waspinghour"); // Ping
        ctable.deleteTable("waspingday", allipstr, "waspingday"); // Ping

        // 自服务器启动以来的CPU平均使用率
        ctable.deleteTable("wasrcpu", allipstr, "wasrcpu"); // Ping
        ctable.deleteTable("wasrcpuhour", allipstr, "wasrcpuhour"); // Ping
        ctable.deleteTable("wasrcpuday", allipstr, "wasrcpuday"); // Ping

        // 自上次查询以来的平均CPU使用率
        ctable.deleteTable("wasscpu", allipstr, "wasscpu"); // Ping
        ctable.deleteTable("wasscpuhour", allipstr, "wasscpuhour"); // Ping
        ctable.deleteTable("wasscpuday", allipstr, "wasscpuday"); // Ping

        // 缓存命中率
        ctable.deleteTable("wasrate", allipstr, "wasrate"); // Ping
        ctable.deleteTable("wasratehour", allipstr, "wasratehour"); // Ping
        ctable.deleteTable("wasrateday", allipstr, "wasrateday"); // Ping

        // JVM内存利用率
        ctable.deleteTable("wasjvm", allipstr, "wasjvm");
        ctable.deleteTable("wasjvmhour", allipstr, "wasjvmhour");
        ctable.deleteTable("wasjvmday", allipstr, "wasjvmday");

        // 性能表
        ctable.deleteTable("wassystem", allipstr, "wassystem");
        ctable.deleteTable("wassystemhour", allipstr, "wassystemhour");
        ctable.deleteTable("wassystemday", allipstr, "wassystemday");

        ctable.deleteTable("wasjdbc", allipstr, "wasjdbc");
        ctable.deleteTable("wasjdbchour", allipstr, "wasjdbchour");
        ctable.deleteTable("wasjdbcday", allipstr, "wasjdbcday");

        ctable.deleteTable("wassession", allipstr, "wassession");
        ctable.deleteTable("wassessionh", allipstr, "wassessionh"); // wassessionhour
        // 必须保留session字段
        ctable.deleteTable("wassessiond", allipstr, "wassessiond");

        ctable.deleteTable("wasjvminfo", allipstr, "wasjvminfo");
        ctable.deleteTable("wasjvminfoh", allipstr, "wasjvminfoh"); // wasjvminfohour
        // 必须保留jvminfo字段,详情见函数内部
        ctable.deleteTable("wasjvminfod", allipstr, "wasjvminfod"); // wasjvminfoday

        ctable.deleteTable("wascache", allipstr, "wascache");
        ctable.deleteTable("wascachehour", allipstr, "wascachehour");
        ctable.deleteTable("wascacheday", allipstr, "wascacheday");

        ctable.deleteTable("wasthread", allipstr, "wasthread");
        ctable.deleteTable("wasthreadhour", allipstr, "wasthreadhour");
        ctable.deleteTable("wasthreadday", allipstr, "wasthreadday");

        ctable.deleteTable("wastrans", allipstr, "wastrans");
        ctable.deleteTable("wastranshour", allipstr, "wastranshour");
        ctable.deleteTable("wastransday", allipstr, "wastransday");

        try {
          // 同时删除事件表里的相关数据
          EventListDao eventdao = new EventListDao();
          eventdao.delete(vo1.getId(), "wasserver");
        } catch (Exception e) {
          e.printStackTrace();
        }

        // 测试生成表
        String ip = vo1.getIpaddress();
        allipstr = SysUtil.doip(ip);
        ctable = new CreateTableManager();
        // 可用性
        ctable.createTable("wasping", allipstr, "wasping"); // Ping
        ctable.createTable("waspinghour", allipstr, "waspinghour"); // Ping
        ctable.createTable("waspingday", allipstr, "waspingday"); // Ping

        // 自服务器启动以来的CPU平均使用率
        ctable.createTable("wasrcpu", allipstr, "wasrcpu"); // Ping
        ctable.createTable("wasrcpuhour", allipstr, "wasrcpuhour"); // Ping
        ctable.createTable("wasrcpuday", allipstr, "wasrcpuday"); // Ping

        // 自上次查询以来的平均CPU使用率
        ctable.createTable("wasscpu", allipstr, "wasscpu"); // Ping
        ctable.createTable("wasscpuhour", allipstr, "wasscpuhour"); // Ping
        ctable.createTable("wasscpuday", allipstr, "wasscpuday"); // Ping

        // 缓存命中率
        ctable.createTable("wasrate", allipstr, "wasrate"); // Ping
        ctable.createTable("wasratehour", allipstr, "wasratehour"); // Ping
        ctable.createTable("wasrateday", allipstr, "wasrateday"); // Ping

        // JVM内存利用率
        ctable.createTable("wasjvm", allipstr, "wasjvm");
        ctable.createTable("wasjvmhour", allipstr, "wasjvmhour");
        ctable.createTable("wasjvmday", allipstr, "wasjvmday");

        // 建立性能表
        ctable.createWasTable(conn, "wassystem", allipstr);
        ctable.createWasTable(conn, "wassystemhour", allipstr);
        ctable.createWasTable(conn, "wassystemday", allipstr);

        ctable.createWasTable(conn, "wasjdbc", allipstr);
        ctable.createWasTable(conn, "wasjdbchour", allipstr);
        ctable.createWasTable(conn, "wasjdbcday", allipstr);

        ctable.createWasTable(conn, "wassession", allipstr);
        ctable.createWasTable(conn, "wassessionh", allipstr); // wassessionhour
        ctable.createWasTable(conn, "wassessiond", allipstr);

        ctable.createWasTable(conn, "wasjvminfo", allipstr);
        ctable.createWasTable(conn, "wasjvminfoh", allipstr); // wasjvminfohour
        ctable.createWasTable(conn, "wasjvminfod", allipstr); // wasjvminfoday

        ctable.createWasTable(conn, "wascache", allipstr);
        ctable.createWasTable(conn, "wascachehour", allipstr);
        ctable.createWasTable(conn, "wascacheday", allipstr);

        ctable.createWasTable(conn, "wasthread", allipstr);
        ctable.createWasTable(conn, "wasthreadhour", allipstr);
        ctable.createWasTable(conn, "wasthreadday", allipstr);

        ctable.createWasTable(conn, "wastrans", allipstr);
        ctable.createWasTable(conn, "wastranshour", allipstr);
        ctable.createWasTable(conn, "wastransday", allipstr);
      }

    } catch (Exception e) {
      flag = false;
      e.printStackTrace();
    } finally {
      conn.close();
    }
    return flag;
  }
Beispiel #4
0
  public boolean save(BaseVo vo) {
    boolean flag = true;
    WasConfig vo1 = (WasConfig) vo;
    StringBuffer sql = new StringBuffer();
    sql.append(
        "insert into nms_wasconfig(id,name,ipaddress,nodename,servername,portnum,sendmobiles,mon_flag,netid,sendemail,supperid,version) values(");
    sql.append(vo1.getId());
    sql.append(",'");
    sql.append(vo1.getName());
    sql.append("','");
    sql.append(vo1.getIpaddress());
    sql.append("','");
    sql.append(vo1.getNodename());
    sql.append("','");
    sql.append(vo1.getServername());
    sql.append("','");
    sql.append(vo1.getPortnum());
    sql.append("','");
    sql.append(vo1.getSendmobiles());
    sql.append("','");
    sql.append(vo1.getMon_flag());
    sql.append("','");
    sql.append(vo1.getNetid());
    sql.append("','");
    sql.append(vo1.getSendemail());
    sql.append("','");
    sql.append(vo1.getSupperid());
    sql.append("','");
    sql.append(vo1.getVersion());
    sql.append("')");
    try {
      saveOrUpdate(sql.toString());
      CreateTableManager ctable = new CreateTableManager();
      String ip = vo1.getIpaddress();
      String allipstr = SysUtil.doip(ip);
      // 可用性
      ctable.createTable("wasping", allipstr, "wasping"); // Ping
      ctable.createTable("waspinghour", allipstr, "waspinghour"); // Ping
      ctable.createTable("waspingday", allipstr, "waspingday"); // Ping
      // 自服务器启动以来的CPU平均使用率
      ctable.createTable("wasrcpu", allipstr, "wasrcpu"); // Ping
      ctable.createTable("wasrcpuhour", allipstr, "wasrcpuhour"); // Ping
      ctable.createTable("wasrcpuday", allipstr, "wasrcpuday"); // Ping

      // 自上次查询以来的平均CPU使用率
      ctable.createTable("wasscpu", allipstr, "wasscpu"); // Ping
      ctable.createTable("wasscpuhour", allipstr, "wasscpuhour"); // Ping
      ctable.createTable("wasscpuday", allipstr, "wasscpuday"); // Ping

      // 缓存命中率
      ctable.createTable("wasrate", allipstr, "wasrate"); // Ping
      ctable.createTable("wasratehour", allipstr, "wasratehour"); // Ping
      ctable.createTable("wasrateday", allipstr, "wasrateday"); // Ping

      // JVM内存利用率
      ctable.createTable("wasjvm", allipstr, "wasjvm");
      ctable.createTable("wasjvmhour", allipstr, "wasjvmhour");
      ctable.createTable("wasjvmday", allipstr, "wasjvmday");

      // 建立性能表
      ctable.createWasTable(conn, "wassystem", allipstr);
      ctable.createWasTable(conn, "wassystemhour", allipstr);
      ctable.createWasTable(conn, "wassystemday", allipstr);

      ctable.createWasTable(conn, "wasjdbc", allipstr);
      ctable.createWasTable(conn, "wasjdbchour", allipstr);
      ctable.createWasTable(conn, "wasjdbcday", allipstr);

      ctable.createWasTable(conn, "wassession", allipstr);
      ctable.createWasTable(conn, "wassessionh", allipstr); // wassessionhour
      // 必须保留session字段
      ctable.createWasTable(conn, "wassessiond", allipstr); // wassessionday

      ctable.createWasTable(conn, "wasjvminfo", allipstr);
      ctable.createWasTable(conn, "wasjvminfoh", allipstr); // wasjvminfohour
      ctable.createWasTable(conn, "wasjvminfod", allipstr);

      ctable.createWasTable(conn, "wascache", allipstr);
      ctable.createWasTable(conn, "wascachehour", allipstr);
      ctable.createWasTable(conn, "wascacheday", allipstr);

      ctable.createWasTable(conn, "wasthread", allipstr);
      ctable.createWasTable(conn, "wasthreadhour", allipstr);
      ctable.createWasTable(conn, "wasthreadday", allipstr);

      ctable.createWasTable(conn, "wastrans", allipstr);
      ctable.createWasTable(conn, "wastranshour", allipstr);
      ctable.createWasTable(conn, "wastransday", allipstr);

    } catch (Exception e) {
      e.printStackTrace();
      flag = false;
    } finally {
      try {
        conn.executeBatch();
      } catch (Exception e) {
        e.printStackTrace();
      }
      conn.close();
    }
    return flag;
  }
Beispiel #5
0
  @Override
  public BaseVo loadFromRS(ResultSet rs) {
    WasConfig vo = new WasConfig();
    try {
      vo.setId(rs.getInt("id"));
      vo.setName(rs.getString("name"));
      vo.setNodename(rs.getString("nodename"));
      vo.setServername(rs.getString("servername"));
      vo.setIpaddress(rs.getString("ipaddress"));
      vo.setPortnum(rs.getInt("portnum"));
      vo.setSendmobiles(rs.getString("sendmobiles"));
      vo.setMon_flag(rs.getInt("mon_flag"));
      vo.setNetid(rs.getString("netid"));
      vo.setSendemail(rs.getString("sendemail"));
      vo.setVersion(rs.getString("version"));
      vo.setSupperid(rs.getInt("supperid"));
    } catch (SQLException e) {
      e.printStackTrace();
    }

    return vo;
  }
  public void collect_data(String id, Hashtable gatherHash) {
    WasConfig wasconf = null;
    try {
      int serverflag = 0;
      String ipaddress = "";
      WasConfigDao dao = new WasConfigDao();
      try {
        wasconf = (WasConfig) dao.findByID(id);
      } catch (Exception e) {
        e.printStackTrace();
      } finally {
        dao.close();
      }
      // AdminClient5 wasadmin = new AdminClient5();
      UrlConncetWas conWas = new UrlConncetWas();
      Hashtable hst = new Hashtable();
      com.afunms.polling.node.Was _tnode =
          (com.afunms.polling.node.Was) PollingEngine.getInstance().getWasByID(wasconf.getId());

      Calendar _date = Calendar.getInstance();
      Date _cc = _date.getTime();
      String _tempsenddate = sdf.format(_cc);
      // 初始化Was对象的状态
      _tnode.setLastTime(_tempsenddate);
      _tnode.setAlarm(false);
      _tnode.getAlarmMessage().clear();
      _tnode.setStatus(0);

      if (gatherHash.containsKey("ping")) {
        // 对可用性进行检测
        boolean collectWasIsOK = false;
        try {
          collectWasIsOK = conWas.connectWasIsOK(wasconf.getIpaddress(), wasconf.getPortnum());
        } catch (Exception e) {
          // e.printStackTrace();
        }
        if (collectWasIsOK) {
          // 运行状态
          Pingcollectdata hostdata = null;
          hostdata = new Pingcollectdata();
          hostdata.setIpaddress(wasconf.getIpaddress());
          Calendar date = Calendar.getInstance();
          hostdata.setCollecttime(date);
          hostdata.setCategory("WasPing");
          hostdata.setEntity("Utilization");
          hostdata.setSubentity("ConnectUtilization");
          hostdata.setRestype("dynamic");
          hostdata.setUnit("%");
          hostdata.setThevalue("100");
          WasConfigDao wasconfigdao = new WasConfigDao();
          try {
            wasconfigdao.createHostData(wasconf, hostdata);
            if (wasdata.containsKey("was" + ":" + wasconf.getIpaddress()))
              wasdata.remove("was" + ":" + wasconf.getIpaddress());
          } catch (Exception e) {
            e.printStackTrace();
          } finally {
            wasconfigdao.close();
          }
          // 进行数据采集
          try {
            hst =
                conWas.ConncetWas(
                    wasconf.getIpaddress(),
                    String.valueOf(wasconf.getPortnum()),
                    "",
                    "",
                    wasconf.getVersion(),
                    gatherHash);
          } catch (Exception e) {

          }
        } else {
          // 依据配置判断是否需要告警
          //									if
          // (wlservers.containsKey(weblogicconf.getIpaddress()+":"+server.getServerRuntimeName()))
          //										createSMS(weblogicconf,server);

          try {
            // com.afunms.polling.node.Weblogic tc = new com.afunms.polling.node.Weblogic();
            // BeanUtils.copyProperties(tc, weblogicconf);
            // if (data_ht==null){
            // 需要增加邮件服务所在的服务器是否能连通
            Host host = (Host) PollingEngine.getInstance().getNodeByIP(wasconf.getIpaddress());
            Vector ipPingData = (Vector) ShareData.getPingdata().get(wasconf.getIpaddress());
            ipaddress = wasconf.getIpaddress();
            if (ipPingData != null) {
              Pingcollectdata pingdata = (Pingcollectdata) ipPingData.get(0);
              Calendar tempCal = (Calendar) pingdata.getCollecttime();
              Date cc = tempCal.getTime();
              String _time = sdf.format(cc);
              String lastTime = _time;
              String pingvalue = pingdata.getThevalue();
              if (pingvalue == null || pingvalue.trim().length() == 0) pingvalue = "0";
              double pvalue = new Double(pingvalue);
              if (pvalue == 0) {
                // 主机服务器连接不上***********************************************
                // com.afunms.polling.node.Weblogic
                // tnode=(com.afunms.polling.node.Weblogic)PollingEngine.getInstance().getWeblogicByIP(ipaddress);
                _tnode.setAlarm(true);
                _tnode.setStatus(1);
                List alarmList = _tnode.getAlarmMessage();
                if (alarmList == null) alarmList = new ArrayList();
                _tnode.getAlarmMessage().add("WAS服务停止");
                String sysLocation = "";
                Pingcollectdata hostdata = null;
                hostdata = new Pingcollectdata();
                hostdata.setIpaddress(ipaddress);
                Calendar date = Calendar.getInstance();
                hostdata.setCollecttime(date);
                hostdata.setCategory("WasPing");
                hostdata.setEntity("Utilization");
                hostdata.setSubentity("ConnectUtilization");
                hostdata.setRestype("dynamic");
                hostdata.setUnit("%");
                hostdata.setThevalue("0");
                WasConfigDao wasconfigdao = new WasConfigDao();
                try {
                  wasconfigdao.createHostData(wasconf, hostdata);
                  if (wasdata.containsKey("was" + ":" + wasconf.getIpaddress()))
                    wasdata.remove("was" + ":" + wasconf.getIpaddress());
                } catch (Exception e) {
                  e.printStackTrace();
                } finally {
                  wasconfigdao.close();
                }
                try {
                  SmscontentDao eventdao = new SmscontentDao();
                  String eventdesc =
                      "WAS服务(" + wasconf.getName() + " IP:" + wasconf.getIpaddress() + ")" + "停止";
                  eventdao.createEventWithReasion(
                      "poll",
                      _tnode.getId() + "",
                      _tnode.getAdminIp() + "(" + _tnode.getAdminIp() + ")",
                      eventdesc,
                      3,
                      "wasserver",
                      "ping",
                      "所在的服务器连接不上");
                } catch (Exception e) {
                  e.printStackTrace();
                }
              } else {
                // com.afunms.polling.node.Weblogic
                // tnode=(com.afunms.polling.node.Weblogic)PollingEngine.getInstance().getWeblogicByIP(ipaddress);
                _tnode.setAlarm(true);
                _tnode.setStatus(3);
                List alarmList = _tnode.getAlarmMessage();
                if (alarmList == null) alarmList = new ArrayList();
                _tnode.getAlarmMessage().add("WAS服务停止");
                Pingcollectdata hostdata = null;
                hostdata = new Pingcollectdata();
                hostdata.setIpaddress(ipaddress);
                Calendar date = Calendar.getInstance();
                hostdata.setCollecttime(date);
                hostdata.setCategory("WasPing");
                hostdata.setEntity("Utilization");
                hostdata.setSubentity("ConnectUtilization");
                hostdata.setRestype("dynamic");
                hostdata.setUnit("%");
                hostdata.setThevalue("0");
                WasConfigDao wasconfigdao = new WasConfigDao();
                try {
                  wasconfigdao.createHostData(wasconf, hostdata);
                  if (wasdata.containsKey("was" + ":" + wasconf.getIpaddress()))
                    wasdata.remove("was" + ":" + wasconf.getIpaddress());
                } catch (Exception e) {
                  e.printStackTrace();
                } finally {
                  wasconfigdao.close();
                }
              }

            } else {
              // com.afunms.polling.node.Weblogic
              // tnode=(com.afunms.polling.node.Weblogic)PollingEngine.getInstance().getWeblogicByIP(ipaddress);
              _tnode.setAlarm(true);
              _tnode.setStatus(3);
              List alarmList = _tnode.getAlarmMessage();
              if (alarmList == null) alarmList = new ArrayList();
              _tnode.getAlarmMessage().add("WAS服务停止");
              Pingcollectdata hostdata = null;
              hostdata = new Pingcollectdata();
              hostdata.setIpaddress(ipaddress);
              Calendar date = Calendar.getInstance();
              hostdata.setCollecttime(date);
              hostdata.setCategory("WasPing");
              hostdata.setEntity("Utilization");
              hostdata.setSubentity("ConnectUtilization");
              hostdata.setRestype("dynamic");
              hostdata.setUnit("%");
              hostdata.setThevalue("0");
              WasConfigDao wasconfigdao = new WasConfigDao();
              try {
                wasconfigdao.createHostData(wasconf, hostdata);
                if (wasdata.containsKey("was" + ":" + wasconf.getIpaddress()))
                  wasdata.remove("was" + ":" + wasconf.getIpaddress());
              } catch (Exception e) {
                e.printStackTrace();
              } finally {
                wasconfigdao.close();
              }
            }
            try {
              createSMS("wasserver", wasconf);
              serverflag = 1;
            } catch (Exception e) {
              e.printStackTrace();
            }
          } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
        }
      }
      //				try{
      //					/**
      //					 * Author by QuZhi
      //					 * 可以取到的指标模块名称
      //					 * JVM/JDBCProvider/SessionManager/SystemMetrics/DynaCache/TransactionService/ORB
      //					 * @return /ObjectPool/ThreadPool
      //					 */
      //					//	 com.afunms.common.util.ShareData.setWasdata("was"+":"+wasconf.getIpaddress(),hst);
      //				}catch(Exception ex){
      //					ex.printStackTrace();
      //				}
      if (hst != null) {
        ShareData.getWasdata().put(wasconf.getIpaddress(), hst);
      }
      hst = null;
    } catch (Exception exc) {
      exc.printStackTrace();
    }
  }
  public void createSMS(String was, WasConfig wasconf) {

    // 建立短信
    // 从内存里获得当前这个IP的PING的值
    Calendar date = Calendar.getInstance();
    try {
      if (!sendeddata.containsKey(was + ":" + wasconf.getId())) {
        // 若不在,则建立短信,并且添加到发送列表里
        Smscontent smscontent = new Smscontent();
        String time = sdf.format(date.getTime());
        smscontent.setLevel("2");
        smscontent.setObjid(wasconf.getId() + "");
        if ("wasserver".equals(was)) {
          smscontent.setMessage(
              "WAS" + " (" + wasconf.getName() + ":" + wasconf.getIpaddress() + ")" + "的服务停止!");
        }
        smscontent.setRecordtime(time);
        smscontent.setSubtype("wasserver");
        smscontent.setSubentity("ping");
        smscontent.setIp(wasconf.getIpaddress());
        // smscontent.setMessage("db&"+time+"&"+dbmonitorlist.getId()+"&"+db+"("+dbmonitorlist.getDbName()+" IP:"+dbmonitorlist.getIpAddress()+")"+"的数据库服务停止");
        // 发送短信
        SmscontentDao smsmanager = new SmscontentDao();
        smsmanager.sendURLSmscontent(smscontent);
        sendeddata.put(was + ":" + wasconf.getId(), date);
      } else {
        // 若在,则从已发送短信列表里判断是否已经发送当天的短信
        Calendar formerdate = (Calendar) sendeddata.get(was + ":" + wasconf.getId());
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        Date last = null;
        Date current = null;
        Calendar sendcalen = formerdate;
        Date cc = sendcalen.getTime();
        String tempsenddate = formatter.format(cc);

        Calendar currentcalen = date;
        cc = currentcalen.getTime();
        last = formatter.parse(tempsenddate);
        String currentsenddate = formatter.format(cc);
        current = formatter.parse(currentsenddate);

        long subvalue = current.getTime() - last.getTime();
        if (subvalue / (1000 * 60 * 60 * 24) >= 1) {
          // 超过一天,则再发信息
          Smscontent smscontent = new Smscontent();
          String time = sdf.format(date.getTime());
          smscontent.setLevel("2");
          smscontent.setObjid(wasconf.getId() + "");
          if ("wasserver".equals(was)) {
            smscontent.setMessage(
                "WAS" + " (" + wasconf.getName() + ":" + wasconf.getIpaddress() + ")" + "的服务停止!");
          }
          smscontent.setRecordtime(time);
          smscontent.setSubtype("wasserver");
          smscontent.setSubentity("ping");
          smscontent.setIp(wasconf.getIpaddress());
          // smscontent.setMessage("db&"+time+"&"+dbmonitorlist.getId()+"&"+db+"("+dbmonitorlist.getDbName()+" IP:"+dbmonitorlist.getIpAddress()+")"+"的数据库服务停止");
          // 发送短信
          SmscontentDao smsmanager = new SmscontentDao();
          smsmanager.sendURLSmscontent(smscontent);
          // 修改已经发送的短信记录
          sendeddata.put(was + ":" + wasconf.getId(), date);
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }