use of com.ctrip.xpipe.redis.console.model.ConfigModel in project x-pipe by ctripcorp.
the class ConfigServiceImpl method getConfig.
@Override
public ConfigModel getConfig(String key) {
try {
ConfigTbl configTbl = configDao.getByKey(key);
ConfigModel config = new ConfigModel();
config.setKey(key);
config.setVal(configTbl.getValue());
config.setUpdateIP(configTbl.getLatestUpdateIp());
config.setUpdateUser(configTbl.getLatestUpdateUser());
return config;
} catch (DalException e) {
logger.error("[getConfig] {}", e);
return null;
}
}
use of com.ctrip.xpipe.redis.console.model.ConfigModel in project x-pipe by ctripcorp.
the class SentinelAutoProcessChecker method alert.
@Override
void alert() {
ConfigModel config = configService.getConfig(DefaultConsoleDbConfig.KEY_SENTINEL_AUTO_PROCESS);
String user = config.getUpdateUser() == null ? "unkown" : config.getUpdateUser();
String ip = config.getUpdateIP() == null ? "unkown" : config.getUpdateIP();
String message = String.format("Sentinel Auto Process will be online %s, </br> " + "Recent update by: %s <br/> and from IP: %s", configService.getAlertSystemRecoverTime().toString(), user, ip);
alertManager.alert("", "", null, ALERT_TYPE.SENTINEL_AUTO_PROCESS_OFF, message);
}
use of com.ctrip.xpipe.redis.console.model.ConfigModel in project x-pipe by ctripcorp.
the class ConfigControllerTest method testChangeConfig1.
@Test
public void testChangeConfig1() throws Exception {
ConfigModel model = new ConfigModel();
model.setKey(DefaultConsoleDbConfig.KEY_ALERT_SYSTEM_ON);
model.setVal(String.valueOf(false));
RetMessage ret = controller.changeConfig(request, model);
Assert.assertEquals(RetMessage.SUCCESS_STATE, ret.getState());
}
use of com.ctrip.xpipe.redis.console.model.ConfigModel in project x-pipe by ctripcorp.
the class ConfigControllerTest method testChangeConfig2.
@Test
public void testChangeConfig2() throws Exception {
ConfigModel model = new ConfigModel();
model.setKey("Key Unknown");
model.setVal(String.valueOf(false));
RetMessage ret = controller.changeConfig(request, model);
Assert.assertEquals(RetMessage.FAIL_STATE, ret.getState());
Assert.assertEquals("Unknown config key: Key Unknown", ret.getMessage());
}
use of com.ctrip.xpipe.redis.console.model.ConfigModel in project x-pipe by ctripcorp.
the class AlertSystemOffChecker method alert.
@Override
void alert() {
logger.info("[alert] Alert System Off");
ConfigModel config = configService.getConfig(DefaultConsoleDbConfig.KEY_ALERT_SYSTEM_ON);
String user = config.getUpdateUser() == null ? "unkown" : config.getUpdateUser();
String ip = config.getUpdateIP() == null ? "unkown" : config.getUpdateIP();
String message = String.format("Alert System will be online %s, </br> Recent update by: %s <br/> and from IP: %s", configService.getAlertSystemRecoverTime().toString(), user, ip);
logger.info("[alert] sending alert: {}", message);
alertManager.alert("", "", null, ALERT_TYPE.ALERT_SYSTEM_OFF, message);
}
Aggregations