Search in sources :

Example 1 with ConfListForm

use of com.baidu.disconf.web.service.config.form.ConfListForm in project disconf by knightliao.

the class ConfigConsistencyMonitorServiceImpl method checkAppEnvVersionConfigConsistency.

/**
     * 校验APP/ENV/VERSION 一致性
     */
private void checkAppEnvVersionConfigConsistency(App app, Env env, String version) {
    String monitorInfo = "monitor " + app.getName() + "\t" + env.getName() + "\t" + version;
    LOG.info(monitorInfo);
    //
    //
    //
    ConfListForm confiConfListForm = new ConfListForm();
    confiConfListForm.setAppId(app.getId());
    confiConfListForm.setEnvId(env.getId());
    confiConfListForm.setVersion(version);
    //
    //
    //
    DaoPageResult<ConfListVo> daoPageResult = configMgr.getConfigList(confiConfListForm, true, true);
    // 准备发送邮件通知
    String toEmails = appMgr.getEmails(app.getId());
    List<ConfListVo> confListVos = daoPageResult.getResult();
    List<String> errorList = new ArrayList<String>();
    for (ConfListVo confListVo : confListVos) {
        if (confListVo.getErrorNum() != 0) {
            List<ZkDisconfDataItem> zkDisconfDataItems = confListVo.getMachineList();
            for (ZkDisconfDataItem zkDisconfDataItem : zkDisconfDataItems) {
                if (zkDisconfDataItem.getErrorList().size() != 0) {
                    String data = zkDisconfDataItem.toString() + "<br/><br/><br/><br/><br/><br/>original:" + confListVo.getValue();
                    LOG.warn(data);
                    errorList.add(data + "<br/><br/><br/>");
                }
            }
        }
    }
    if (errorList.size() != 0) {
        logMailBean.sendHtmlEmail(toEmails, " monitor ConfigConsistency ", monitorInfo + "<br/><br/><br/>" + errorList.toString());
    }
}
Also used : ConfListVo(com.baidu.disconf.web.service.config.vo.ConfListVo) ConfListForm(com.baidu.disconf.web.service.config.form.ConfListForm) ArrayList(java.util.ArrayList) ZkDisconfDataItem(com.baidu.disconf.web.service.zookeeper.dto.ZkDisconfData.ZkDisconfDataItem)

Aggregations

ConfListForm (com.baidu.disconf.web.service.config.form.ConfListForm)1 ConfListVo (com.baidu.disconf.web.service.config.vo.ConfListVo)1 ZkDisconfDataItem (com.baidu.disconf.web.service.zookeeper.dto.ZkDisconfData.ZkDisconfDataItem)1 ArrayList (java.util.ArrayList)1