From ae894b29bcc7e94cd75d1cc865c29a286fa7add6 Mon Sep 17 00:00:00 2001 From: Daniel Eisenberg Date: Sun, 9 Nov 2025 13:39:50 +0200 Subject: [PATCH] prometheus support locally managed --- .../security_apps/orchestration/orchestration_comp.cc | 8 +++++++- .../update_communication/fog_authenticator.cc | 5 +++++ nodes/orchestration/package/orchestration_package.sh | 10 ++++++++-- nodes/orchestration/package/watchdog/watchdog | 5 +++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/components/security_apps/orchestration/orchestration_comp.cc b/components/security_apps/orchestration/orchestration_comp.cc index 79c3891..08bed76 100755 --- a/components/security_apps/orchestration/orchestration_comp.cc +++ b/components/security_apps/orchestration/orchestration_comp.cc @@ -1522,6 +1522,12 @@ private: agent_data_report << make_pair("registeredServer", i_agent_details->getRegisteredServer()); + const char *prometheus_env = getenv("PROMETHEUS"); + if (prometheus_env != nullptr) { + auto enable_prometheus = string(prometheus_env) == "true"; + agent_data_report << AgentReportFieldWithLabel("enablePrometheus", enable_prometheus ? "true" : "false"); + } + #if defined(gaia) || defined(smb) if (i_details_resolver->compareCheckpointVersion(8100, greater_equal())) { agent_data_report << AgentReportFieldWithLabel("isCheckpointVersionGER81", "true"); @@ -2272,4 +2278,4 @@ OrchestrationComp::preload() registerExpectedSetting("successUpgradeInterval"); registerExpectedConfigFile("orchestration", Config::ConfigFileType::Policy); registerExpectedConfigFile("registration-data", Config::ConfigFileType::Policy); -} +} \ No newline at end of file diff --git a/components/security_apps/orchestration/update_communication/fog_authenticator.cc b/components/security_apps/orchestration/update_communication/fog_authenticator.cc index b5ffdf1..4cf62a9 100755 --- a/components/security_apps/orchestration/update_communication/fog_authenticator.cc +++ b/components/security_apps/orchestration/update_communication/fog_authenticator.cc @@ -227,6 +227,11 @@ FogAuthenticator::registerAgent( request << make_pair("userEdition", getUserEdition()); + const char *prometheus_env = getenv("PROMETHEUS"); + if (prometheus_env != nullptr) { + request << make_pair("enablePrometheus", string(prometheus_env) == "true" ? "true" : "false"); + } + if (getDeplymentType() == "Docker" || getDeplymentType() == "K8S") { const char *image_version_otp = getenv("IMAGE_VERSION"); if (image_version_otp) { diff --git a/nodes/orchestration/package/orchestration_package.sh b/nodes/orchestration/package/orchestration_package.sh index 8071244..1dee032 100755 --- a/nodes/orchestration/package/orchestration_package.sh +++ b/nodes/orchestration/package/orchestration_package.sh @@ -209,6 +209,9 @@ save_local_policy_config() if [ -n "${CP_ENV_FILESYSTEM}" ] ; then export FILESYSTEM_PATH=$CP_ENV_FILESYSTEM fi +if [ -n "${PROMETHEUS}" ] ; then + export PROMETHEUS=$PROMETHEUS +fi if [ -n "${CP_ENV_LOG_FILE}" ] ; then LOG_FILE_PATH=$CP_ENV_LOG_FILE fi @@ -433,7 +436,7 @@ if command -v which &>/dev/null; then var_which_cmd_exists=1 fi -if [ $var_arch != "gaia" ] && [ $var_arch != "gaia_arm" ] && [ $var_which_cmd_exists -eq 1 ]; then +if [ $var_arch != "gaia" ] && [ $var_arch != "gaia_arm" ] && [ $var_which_cmd_exists -eq 1 ]; then if [ -n "$(which systemctl)" ]; then var_startup_service="systemd" else @@ -974,7 +977,7 @@ install_orchestration() fi ${INSTALL_COMMAND} lib/*.so* ${USR_LIB_PATH}/ ${INSTALL_COMMAND} lib/boost/*.so* ${USR_LIB_PATH}/ - cp_print "Done successfully doing only unpacking lib64 to Path: ${USR_LIB_PATH}" ${FORCE_STDOUT} + cp_print "Done successfully doing only unpacking lib64 to Path: ${USR_LIB_PATH}" ${FORCE_STDOUT} exit 0 fi @@ -1149,6 +1152,9 @@ install_orchestration() if [ -n "${FILESYSTEM_PATH}" ]; then echo "CP_ENV_FILESYSTEM=${FILESYSTEM_PATH}" >> ${FILESYSTEM_PATH}/${ENV_DETAILS_FILE} fi + if [ -n "${PROMETHEUS}" ]; then + echo "PROMETHEUS=${PROMETHEUS}" >> ${FILESYSTEM_PATH}/${ENV_DETAILS_FILE} + fi if [ -n "${VS_ID}" ]; then echo "CP_VS_ID=${VS_ID}" >> ${FILESYSTEM_PATH}/${ENV_DETAILS_FILE} fi diff --git a/nodes/orchestration/package/watchdog/watchdog b/nodes/orchestration/package/watchdog/watchdog index b02e562..b305c54 100755 --- a/nodes/orchestration/package/watchdog/watchdog +++ b/nodes/orchestration/package/watchdog/watchdog @@ -115,6 +115,11 @@ load_paths() if [ -n "${CP_ENV_LOG_FILE}" ]; then LOG_FILE_PATH=$CP_ENV_LOG_FILE fi + + if [ -n "${PROMETHEUS}" ]; then + export PROMETHEUS=$PROMETHEUS + fi + if [ -n "${CP_VS_ID}" ]; then VS_ID=${CP_VS_ID} VS_EVAL_PREFIX="ip netns exec CTX0000${VS_ID} env"