ozhera-prometheus-agent/ozhera-prometheus-agent-client/src/main/java/org/apache/ozhera/prometheus/agent/prometheusClient/PrometheusClient.java [250:272]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private void backUpConfig() {
        // Check if the file exists
        if (!isFileExists(filePath)) {
            log.error("PrometheusClient backUpConfig no files here path: {}", filePath);
            return;
        }

        // Create a backup file if it does not exist
        if (!isFileExists(backFilePath)) {
            log.info("PrometheusClient backUpConfig backFile does not exist and begin create");
            FileUtil.GenerateFile(backFilePath);
        }

        // Get the current configuration file
        String content = FileUtil.LoadFile(filePath);
        // write backup
        String writeRes = FileUtil.WriteFile(backFilePath, content);
        if (StringUtils.isEmpty(writeRes)) {
            log.error("PrometheusClient backUpConfig WriteFile Error");
        } else {
            log.info("PrometheusClient backUpConfig WriteFile success");
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



ozhera-prometheus-agent/ozhera-prometheus-agent-client/src/main/java/org/apache/ozhera/prometheus/agent/alertManagerClient/AlertManagerClient.java [249:271]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private void backUpConfig() {
        //Check if the file exists.
        if (!isFileExists(filePath)) {
            log.error("AlertManagerClient backUpConfig no files here path: {}", filePath);
            return;
        }

        //If there is no backup file, create one.
        if (!isFileExists(backFilePath)) {
            log.info("AlertManagerClient backUpConfig backFile does not exist and begin create");
            FileUtil.GenerateFile(backFilePath);
        }

        //Get current configuration file.
        String content = FileUtil.LoadFile(filePath);
        //Write backup.
        String writeRes = FileUtil.WriteFile(backFilePath, content);
        if (StringUtils.isEmpty(writeRes)) {
            log.error("AlertManagerClient backUpConfig WriteFile Error");
        } else {
            log.info("AlertManagerClient backUpConfig WriteFile success");
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



