@Test public void testCi() { zabbixServiceImpl.ci("7ab6ed9458b3cb477ecee026d85e5b42",ZabbixServiceImpl.hostStatusEnable, "trade","trade-production-1", "production",11111112L, "release-1", 1,"trade-master",false, "liangjian",0,"master",0); }
@Override public BusinessWrapper<Boolean> ci(String key, int type, String project, String group, String env, Long deployId, String bambooDeployVersion, int bambooBuildNumber, String bambooDeployProject, boolean bambooDeployRollback, String bambooManualBuildTriggerReasonUserName, int errorCode, String branchName, int deployType) { if (!apiCheckKey(key)) return new BusinessWrapper<>(ErrorCode.zabbixCIKeyCheckFailure.getCode(), ErrorCode.zabbixCIKeyCheckFailure.getMsg()); CiDeployStatisticsDO ciDeployStatisticsDO = new CiDeployStatisticsDO(project, group, env, type, deployId, bambooDeployVersion, bambooBuildNumber, bambooDeployProject, bambooDeployRollback, bambooManualBuildTriggerReasonUserName, errorCode, branchName, deployType); ciService.doCiDeployStatistics(ciDeployStatisticsDO); if (deployType != CiDeployStatisticsDO.DeployTypeEnum.war.getCode()) return new BusinessWrapper<>(true); ServerGroupDO serverGroupDO = serverGroupDao.queryServerGroupByName("group_" + project); if (serverGroupDO == null) return new BusinessWrapper<>(ErrorCode.zabbixCIServerGroupNotExist); List<ServerDO> listServerDO = serverDao.acqServersByGroupId(serverGroupDO.getId()); if (listServerDO == null || listServerDO.size() == 0) return new BusinessWrapper<>(ErrorCode.serverGroupServerNull); for (ServerDO serverDO : listServerDO) { String serverEnv = ServerDO.EnvTypeEnum.getEnvTypeName(serverDO.getEnvType()); if (!serverEnv.equals(env)) continue; if (hostUpdateStatus(serverDO, type)) { logger.info("Zabbix : ci update " + serverDO.getServerName() + "/" + serverDO.getInsideIp() + "/" + serverEnv + " status " + type); } else { logger.error("Zabbix : ci update " + serverDO.getServerName() + "/" + serverDO.getInsideIp() + "/" + serverEnv + " status " + type); } } return new BusinessWrapper<>(true); }
ZabbixServiceImpl implements ZabbixService, InitializingBean { @Override public BusinessWrapper<Boolean> ci(String key, int type, String project, String group, String env, Long deployId, String bambooDeployVersion, int bambooBuildNumber, String bambooDeployProject, boolean bambooDeployRollback, String bambooManualBuildTriggerReasonUserName, int errorCode, String branchName, int deployType) { if (!apiCheckKey(key)) return new BusinessWrapper<>(ErrorCode.zabbixCIKeyCheckFailure.getCode(), ErrorCode.zabbixCIKeyCheckFailure.getMsg()); CiDeployStatisticsDO ciDeployStatisticsDO = new CiDeployStatisticsDO(project, group, env, type, deployId, bambooDeployVersion, bambooBuildNumber, bambooDeployProject, bambooDeployRollback, bambooManualBuildTriggerReasonUserName, errorCode, branchName, deployType); ciService.doCiDeployStatistics(ciDeployStatisticsDO); if (deployType != CiDeployStatisticsDO.DeployTypeEnum.war.getCode()) return new BusinessWrapper<>(true); ServerGroupDO serverGroupDO = serverGroupDao.queryServerGroupByName("group_" + project); if (serverGroupDO == null) return new BusinessWrapper<>(ErrorCode.zabbixCIServerGroupNotExist); List<ServerDO> listServerDO = serverDao.acqServersByGroupId(serverGroupDO.getId()); if (listServerDO == null || listServerDO.size() == 0) return new BusinessWrapper<>(ErrorCode.serverGroupServerNull); for (ServerDO serverDO : listServerDO) { String serverEnv = ServerDO.EnvTypeEnum.getEnvTypeName(serverDO.getEnvType()); if (!serverEnv.equals(env)) continue; if (hostUpdateStatus(serverDO, type)) { logger.info("Zabbix : ci update " + serverDO.getServerName() + "/" + serverDO.getInsideIp() + "/" + serverEnv + " status " + type); } else { logger.error("Zabbix : ci update " + serverDO.getServerName() + "/" + serverDO.getInsideIp() + "/" + serverEnv + " status " + type); } } return new BusinessWrapper<>(true); } }
ZabbixServiceImpl implements ZabbixService, InitializingBean { @Override public BusinessWrapper<Boolean> ci(String key, int type, String project, String group, String env, Long deployId, String bambooDeployVersion, int bambooBuildNumber, String bambooDeployProject, boolean bambooDeployRollback, String bambooManualBuildTriggerReasonUserName, int errorCode, String branchName, int deployType) { if (!apiCheckKey(key)) return new BusinessWrapper<>(ErrorCode.zabbixCIKeyCheckFailure.getCode(), ErrorCode.zabbixCIKeyCheckFailure.getMsg()); CiDeployStatisticsDO ciDeployStatisticsDO = new CiDeployStatisticsDO(project, group, env, type, deployId, bambooDeployVersion, bambooBuildNumber, bambooDeployProject, bambooDeployRollback, bambooManualBuildTriggerReasonUserName, errorCode, branchName, deployType); ciService.doCiDeployStatistics(ciDeployStatisticsDO); if (deployType != CiDeployStatisticsDO.DeployTypeEnum.war.getCode()) return new BusinessWrapper<>(true); ServerGroupDO serverGroupDO = serverGroupDao.queryServerGroupByName("group_" + project); if (serverGroupDO == null) return new BusinessWrapper<>(ErrorCode.zabbixCIServerGroupNotExist); List<ServerDO> listServerDO = serverDao.acqServersByGroupId(serverGroupDO.getId()); if (listServerDO == null || listServerDO.size() == 0) return new BusinessWrapper<>(ErrorCode.serverGroupServerNull); for (ServerDO serverDO : listServerDO) { String serverEnv = ServerDO.EnvTypeEnum.getEnvTypeName(serverDO.getEnvType()); if (!serverEnv.equals(env)) continue; if (hostUpdateStatus(serverDO, type)) { logger.info("Zabbix : ci update " + serverDO.getServerName() + "/" + serverDO.getInsideIp() + "/" + serverEnv + " status " + type); } else { logger.error("Zabbix : ci update " + serverDO.getServerName() + "/" + serverDO.getInsideIp() + "/" + serverEnv + " status " + type); } } return new BusinessWrapper<>(true); }  }
ZabbixServiceImpl implements ZabbixService, InitializingBean { @Override public BusinessWrapper<Boolean> ci(String key, int type, String project, String group, String env, Long deployId, String bambooDeployVersion, int bambooBuildNumber, String bambooDeployProject, boolean bambooDeployRollback, String bambooManualBuildTriggerReasonUserName, int errorCode, String branchName, int deployType) { if (!apiCheckKey(key)) return new BusinessWrapper<>(ErrorCode.zabbixCIKeyCheckFailure.getCode(), ErrorCode.zabbixCIKeyCheckFailure.getMsg()); CiDeployStatisticsDO ciDeployStatisticsDO = new CiDeployStatisticsDO(project, group, env, type, deployId, bambooDeployVersion, bambooBuildNumber, bambooDeployProject, bambooDeployRollback, bambooManualBuildTriggerReasonUserName, errorCode, branchName, deployType); ciService.doCiDeployStatistics(ciDeployStatisticsDO); if (deployType != CiDeployStatisticsDO.DeployTypeEnum.war.getCode()) return new BusinessWrapper<>(true); ServerGroupDO serverGroupDO = serverGroupDao.queryServerGroupByName("group_" + project); if (serverGroupDO == null) return new BusinessWrapper<>(ErrorCode.zabbixCIServerGroupNotExist); List<ServerDO> listServerDO = serverDao.acqServersByGroupId(serverGroupDO.getId()); if (listServerDO == null || listServerDO.size() == 0) return new BusinessWrapper<>(ErrorCode.serverGroupServerNull); for (ServerDO serverDO : listServerDO) { String serverEnv = ServerDO.EnvTypeEnum.getEnvTypeName(serverDO.getEnvType()); if (!serverEnv.equals(env)) continue; if (hostUpdateStatus(serverDO, type)) { logger.info("Zabbix : ci update " + serverDO.getServerName() + "/" + serverDO.getInsideIp() + "/" + serverEnv + " status " + type); } else { logger.error("Zabbix : ci update " + serverDO.getServerName() + "/" + serverDO.getInsideIp() + "/" + serverEnv + " status " + type); } } return new BusinessWrapper<>(true); }  @Override String getApiVersion(); @Override boolean hostExists(ServerDO serverDO); @Override int hostGetStatus(ServerDO serverDO); @Deprecated int hostGetByIP(String ip); @Deprecated int hostGetByName(String name); int proxyGet(String hostname); boolean hostgroupCreate(String name); int templateGet(String name); int usergroupGet(String usergroup); @Override BusinessWrapper<Boolean> userCreate(UserDO userDO); @Override int usergroupCreate(ServerGroupDO serverGroupDO); @Override int userGet(UserDO userDO); @Override BusinessWrapper<Boolean> userDelete(UserDO userDO); @Override BusinessWrapper<Boolean> syncUser(); void cleanZabbixUser(); @Override BusinessWrapper<Boolean> checkUser(); @Override BusinessWrapper<Boolean> userUpdate(UserDO userDO); @Deprecated JSONObject itemGetAll(ServerDO serverDO); int itemGet(ServerDO serverDO, String itemName, String itemKey); @Override int actionCreate(ServerGroupDO serverGroupDO); @Override JSONObject historyGet(ServerDO serverDO, String itemName, String itemKey, int historyType, int limit); @Override JSONObject historyGet(ServerDO serverDO, String itemName, String itemKey, int historyType, String timestampFrom, String timestampTill); void api(int statusType, String key, String project, String group, String env); @Override BusinessWrapper<Boolean> refresh(); @Override BusinessWrapper<Boolean> addMonitor(long serverId); @Override BusinessWrapper<Boolean> delMonitor(long serverId); @Override BusinessWrapper<Boolean> disableMonitor(long serverId); @Override BusinessWrapper<Boolean> enableMonitor(long serverId); @Override BusinessWrapper<Boolean> ci(String key, int type, String project, String group, String env, Long deployId, String bambooDeployVersion,
                                       int bambooBuildNumber, String bambooDeployProject, boolean bambooDeployRollback,
                                       String bambooManualBuildTriggerReasonUserName, int errorCode, String branchName, int deployType); int checkUserInUsergroup(UserDO userDO, ServerGroupDO serverGroupDO); @Override void afterPropertiesSet(); }
ZabbixServiceImpl implements ZabbixService, InitializingBean { @Override public BusinessWrapper<Boolean> ci(String key, int type, String project, String group, String env, Long deployId, String bambooDeployVersion, int bambooBuildNumber, String bambooDeployProject, boolean bambooDeployRollback, String bambooManualBuildTriggerReasonUserName, int errorCode, String branchName, int deployType) { if (!apiCheckKey(key)) return new BusinessWrapper<>(ErrorCode.zabbixCIKeyCheckFailure.getCode(), ErrorCode.zabbixCIKeyCheckFailure.getMsg()); CiDeployStatisticsDO ciDeployStatisticsDO = new CiDeployStatisticsDO(project, group, env, type, deployId, bambooDeployVersion, bambooBuildNumber, bambooDeployProject, bambooDeployRollback, bambooManualBuildTriggerReasonUserName, errorCode, branchName, deployType); ciService.doCiDeployStatistics(ciDeployStatisticsDO); if (deployType != CiDeployStatisticsDO.DeployTypeEnum.war.getCode()) return new BusinessWrapper<>(true); ServerGroupDO serverGroupDO = serverGroupDao.queryServerGroupByName("group_" + project); if (serverGroupDO == null) return new BusinessWrapper<>(ErrorCode.zabbixCIServerGroupNotExist); List<ServerDO> listServerDO = serverDao.acqServersByGroupId(serverGroupDO.getId()); if (listServerDO == null || listServerDO.size() == 0) return new BusinessWrapper<>(ErrorCode.serverGroupServerNull); for (ServerDO serverDO : listServerDO) { String serverEnv = ServerDO.EnvTypeEnum.getEnvTypeName(serverDO.getEnvType()); if (!serverEnv.equals(env)) continue; if (hostUpdateStatus(serverDO, type)) { logger.info("Zabbix : ci update " + serverDO.getServerName() + "/" + serverDO.getInsideIp() + "/" + serverEnv + " status " + type); } else { logger.error("Zabbix : ci update " + serverDO.getServerName() + "/" + serverDO.getInsideIp() + "/" + serverEnv + " status " + type); } } return new BusinessWrapper<>(true); }  @Override String getApiVersion(); @Override boolean hostExists(ServerDO serverDO); @Override int hostGetStatus(ServerDO serverDO); @Deprecated int hostGetByIP(String ip); @Deprecated int hostGetByName(String name); int proxyGet(String hostname); boolean hostgroupCreate(String name); int templateGet(String name); int usergroupGet(String usergroup); @Override BusinessWrapper<Boolean> userCreate(UserDO userDO); @Override int usergroupCreate(ServerGroupDO serverGroupDO); @Override int userGet(UserDO userDO); @Override BusinessWrapper<Boolean> userDelete(UserDO userDO); @Override BusinessWrapper<Boolean> syncUser(); void cleanZabbixUser(); @Override BusinessWrapper<Boolean> checkUser(); @Override BusinessWrapper<Boolean> userUpdate(UserDO userDO); @Deprecated JSONObject itemGetAll(ServerDO serverDO); int itemGet(ServerDO serverDO, String itemName, String itemKey); @Override int actionCreate(ServerGroupDO serverGroupDO); @Override JSONObject historyGet(ServerDO serverDO, String itemName, String itemKey, int historyType, int limit); @Override JSONObject historyGet(ServerDO serverDO, String itemName, String itemKey, int historyType, String timestampFrom, String timestampTill); void api(int statusType, String key, String project, String group, String env); @Override BusinessWrapper<Boolean> refresh(); @Override BusinessWrapper<Boolean> addMonitor(long serverId); @Override BusinessWrapper<Boolean> delMonitor(long serverId); @Override BusinessWrapper<Boolean> disableMonitor(long serverId); @Override BusinessWrapper<Boolean> enableMonitor(long serverId); @Override BusinessWrapper<Boolean> ci(String key, int type, String project, String group, String env, Long deployId, String bambooDeployVersion,
                                       int bambooBuildNumber, String bambooDeployProject, boolean bambooDeployRollback,
                                       String bambooManualBuildTriggerReasonUserName, int errorCode, String branchName, int deployType); int checkUserInUsergroup(UserDO userDO, ServerGroupDO serverGroupDO); @Override void afterPropertiesSet(); static final String zabbix_host_monitor_public_ip; static final String zabbix_proxy_id; static final String zabbix_proxy_name; static final int hostStatusDisable; static final int hostStatusEnable; static final int isMonitor; static final int noMonitor; }