示例#1
0
 public Collations(
     String name,
     String characterSetName,
     int id,
     boolean isDefault,
     boolean isCompiled,
     long sortlen) {
   this.name = name;
   this.characterSetName = characterSetName;
   this.id = id;
   this.isDefault = BooleanUtils.toInteger(isDefault);
   this.isCompiled = BooleanUtils.toInteger(isCompiled);
   this.sortlen = sortlen;
 }
  public String updateHost(
      String hostid,
      String hostname,
      String fqdn,
      List<Hostgroup> hostgroups,
      Boolean status,
      Boolean userIp,
      String ip,
      String proxyHostid) {
    HostUpdateParam param = new HostUpdateParam();
    param.setHostid(hostid);
    param.setHost(hostname);
    param.setGroups(hostgroups);
    param.setDns(fqdn);
    param.setPort(10050);
    if (status != null) {
      param.setStatus(status ? 0 : 1); // 有効の場合は0、無効の場合は1
    }
    if (userIp != null) {
      param.setUseip(BooleanUtils.toInteger(userIp)); // DNSの場合は0、IPの場合は1
      param.setIp(StringUtils.isEmpty(ip) ? "0.0.0.0" : ip);
    }
    if (StringUtils.isNotEmpty(proxyHostid)) {
      param.setProxyHostid(proxyHostid);
    }

    List<String> hostids = zabbixClient.host().update(param);
    hostid = hostids.get(0);

    if (log.isInfoEnabled()) {
      List<String> groupids = new ArrayList<String>();
      if (hostgroups != null) {
        for (Hostgroup hostgroup : hostgroups) {
          groupids.add(hostgroup.getGroupid());
        }
      }
      log.info(MessageUtils.getMessage("IPROCESS-100312", hostid, fqdn, groupids, status));
    }
    return hostid;
  }