From 7b01224f17f390b72b4523d1a1af8b992eb1379d Mon Sep 17 00:00:00 2001 From: Costa Tsaousis Date: Tue, 17 Dec 2024 17:05:35 +0200 Subject: [PATCH] fix the renamed function under windows (#19240) --- src/daemon/win_system-info.c | 67 ++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/src/daemon/win_system-info.c b/src/daemon/win_system-info.c index 517692dff44f54..8609c9d60351b5 100644 --- a/src/daemon/win_system-info.c +++ b/src/daemon/win_system-info.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later #include "win_system-info.h" +#include "database/rrdhost-system-info.h" #ifdef OS_WINDOWS @@ -41,21 +42,21 @@ static void netdata_windows_cpu_from_system_info(struct rrdhost_system_info *sys char cpuData[256]; (void)snprintf(cpuData, 255, "%d", sysInfo.dwNumberOfProcessors); - (void)rrdhost_set_system_info_variable(systemInfo, "NETDATA_SYSTEM_CPU_LOGICAL_CPU_COUNT", cpuData); + (void)rrdhost_system_info_set_by_name(systemInfo, "NETDATA_SYSTEM_CPU_LOGICAL_CPU_COUNT", cpuData); char *arch = netdata_windows_arch(sysInfo.wProcessorArchitecture); - (void)rrdhost_set_system_info_variable(systemInfo, "NETDATA_SYSTEM_ARCHITECTURE", arch); + (void)rrdhost_system_info_set_by_name(systemInfo, "NETDATA_SYSTEM_ARCHITECTURE", arch); - (void)rrdhost_set_system_info_variable( + (void)rrdhost_system_info_set_by_name( systemInfo, "NETDATA_SYSTEM_VIRTUALIZATION", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_NONE); - (void)rrdhost_set_system_info_variable( + (void)rrdhost_system_info_set_by_name( systemInfo, "NETDATA_SYSTEM_VIRT_DETECTION", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_NONE); - (void)rrdhost_set_system_info_variable( + (void)rrdhost_system_info_set_by_name( systemInfo, "NETDATA_SYSTEM_CONTAINER", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_NONE); - (void)rrdhost_set_system_info_variable( + (void)rrdhost_system_info_set_by_name( systemInfo, "NETDATA_SYSTEM_CONTAINER_DETECTION", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_NONE); } @@ -67,7 +68,7 @@ static void netdata_windows_cpu_vendor_model(struct rrdhost_system_info *systemI { char cpuData[256]; long ret = netdata_registry_get_string_from_open_key(cpuData, 255, lKey, key); - (void)rrdhost_set_system_info_variable(systemInfo, + (void)rrdhost_system_info_set_by_name(systemInfo, variable, (ret == ERROR_SUCCESS) ? cpuData : NETDATA_DEFAULT_SYSTEM_INFO_VALUE_UNKNOWN); } @@ -88,13 +89,13 @@ static void netdata_windows_cpu_from_registry(struct rrdhost_system_info *system if (cpuFreq) (void)snprintf(cpuData, 255, "%lu", (unsigned long)cpuFreq); - (void)rrdhost_set_system_info_variable(systemInfo, + (void)rrdhost_system_info_set_by_name(systemInfo, "NETDATA_SYSTEM_CPU_FREQ", (!cpuFreq) ? NETDATA_DEFAULT_SYSTEM_INFO_VALUE_UNKNOWN : cpuData); netdata_windows_cpu_vendor_model(systemInfo, lKey, "NETDATA_SYSTEM_CPU_VENDOR", "VendorIdentifier"); netdata_windows_cpu_vendor_model(systemInfo, lKey, "NETDATA_SYSTEM_CPU_MODEL", "ProcessorNameString"); - (void)rrdhost_set_system_info_variable(systemInfo, "NETDATA_SYSTEM_CPU_DETECTION", NETDATA_WIN_DETECTION_METHOD); + (void)rrdhost_system_info_set_by_name(systemInfo, "NETDATA_SYSTEM_CPU_DETECTION", NETDATA_WIN_DETECTION_METHOD); } static void netdata_windows_get_cpu(struct rrdhost_system_info *systemInfo) @@ -114,10 +115,10 @@ static void netdata_windows_get_mem(struct rrdhost_system_info *systemInfo) else (void)snprintf(memSize, 255, "%llu", size * 1024); // to bytes - (void)rrdhost_set_system_info_variable(systemInfo, + (void)rrdhost_system_info_set_by_name(systemInfo, "NETDATA_SYSTEM_TOTAL_RAM", (!size) ? NETDATA_DEFAULT_SYSTEM_INFO_VALUE_UNKNOWN : memSize); - (void)rrdhost_set_system_info_variable(systemInfo, "NETDATA_SYSTEM_RAM_DETECTION", NETDATA_WIN_DETECTION_METHOD); + (void)rrdhost_system_info_set_by_name(systemInfo, "NETDATA_SYSTEM_RAM_DETECTION", NETDATA_WIN_DETECTION_METHOD); } static ULONGLONG netdata_windows_get_disk_size(char *cVolume) @@ -160,8 +161,8 @@ static void netdata_windows_get_total_disk_size(struct rrdhost_system_info *syst char diskSize[256]; (void)snprintf(diskSize, 255, "%llu", total); - (void)rrdhost_set_system_info_variable(systemInfo, "NETDATA_SYSTEM_TOTAL_DISK_SIZE", diskSize); - (void)rrdhost_set_system_info_variable(systemInfo, "NETDATA_SYSTEM_DISK_DETECTION", NETDATA_WIN_DETECTION_METHOD); + (void)rrdhost_system_info_set_by_name(systemInfo, "NETDATA_SYSTEM_TOTAL_DISK_SIZE", diskSize); + (void)rrdhost_system_info_set_by_name(systemInfo, "NETDATA_SYSTEM_DISK_DETECTION", NETDATA_WIN_DETECTION_METHOD); } // Host @@ -245,63 +246,63 @@ static void netdata_windows_os_kernel_version(char *out, DWORD length, DWORD bui static void netdata_windows_host(struct rrdhost_system_info *systemInfo) { char osVersion[4096]; - (void)rrdhost_set_system_info_variable(systemInfo, "NETDATA_HOST_OS_NAME", "Microsoft Windows"); + (void)rrdhost_system_info_set_by_name(systemInfo, "NETDATA_HOST_OS_NAME", "Microsoft Windows"); DWORD build = netdata_windows_get_current_build(); netdata_windows_discover_os_version(osVersion, 4095, build); - (void)rrdhost_set_system_info_variable(systemInfo, "NETDATA_HOST_OS_ID", osVersion); + (void)rrdhost_system_info_set_by_name(systemInfo, "NETDATA_HOST_OS_ID", osVersion); - (void)rrdhost_set_system_info_variable( + (void)rrdhost_system_info_set_by_name( systemInfo, "NETDATA_HOST_OS_ID_LIKE", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_UNKNOWN); - (void)rrdhost_set_system_info_variable(systemInfo, "NETDATA_HOST_OS_VERSION", osVersion); - (void)rrdhost_set_system_info_variable(systemInfo, "NETDATA_HOST_OS_VERSION_ID", osVersion); + (void)rrdhost_system_info_set_by_name(systemInfo, "NETDATA_HOST_OS_VERSION", osVersion); + (void)rrdhost_system_info_set_by_name(systemInfo, "NETDATA_HOST_OS_VERSION_ID", osVersion); - (void)rrdhost_set_system_info_variable(systemInfo, "NETDATA_HOST_OS_DETECTION", NETDATA_WIN_DETECTION_METHOD); + (void)rrdhost_system_info_set_by_name(systemInfo, "NETDATA_HOST_OS_DETECTION", NETDATA_WIN_DETECTION_METHOD); - (void)rrdhost_set_system_info_variable(systemInfo, "NETDATA_SYSTEM_KERNEL_NAME", "Windows"); + (void)rrdhost_system_info_set_by_name(systemInfo, "NETDATA_SYSTEM_KERNEL_NAME", "Windows"); netdata_windows_os_kernel_version(osVersion, 4095, build); - (void)rrdhost_set_system_info_variable(systemInfo, "NETDATA_SYSTEM_KERNEL_VERSION", osVersion); + (void)rrdhost_system_info_set_by_name(systemInfo, "NETDATA_SYSTEM_KERNEL_VERSION", osVersion); - (void)rrdhost_set_system_info_variable( + (void)rrdhost_system_info_set_by_name( systemInfo, "NETDATA_HOST_IS_K8S_NODE", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_FALSE); } // Cloud static void netdata_windows_cloud(struct rrdhost_system_info *systemInfo) { - (void)rrdhost_set_system_info_variable( + (void)rrdhost_system_info_set_by_name( systemInfo, "NETDATA_INSTANCE_CLOUD_TYPE", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_UNKNOWN); - (void)rrdhost_set_system_info_variable( + (void)rrdhost_system_info_set_by_name( systemInfo, "NETDATA_INSTANCE_CLOUD_INSTANCE_TYPE", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_UNKNOWN); - (void)rrdhost_set_system_info_variable( + (void)rrdhost_system_info_set_by_name( systemInfo, "NETDATA_INSTANCE_CLOUD_INSTANCE_REGION", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_UNKNOWN); } // Container static void netdata_windows_container(struct rrdhost_system_info *systemInfo) { - (void)rrdhost_set_system_info_variable( + (void)rrdhost_system_info_set_by_name( systemInfo, "NETDATA_CONTAINER_OS_NAME", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_NONE); - (void)rrdhost_set_system_info_variable( + (void)rrdhost_system_info_set_by_name( systemInfo, "NETDATA_CONTAINER_OS_ID", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_NONE); - (void)rrdhost_set_system_info_variable( + (void)rrdhost_system_info_set_by_name( systemInfo, "NETDATA_CONTAINER_OS_ID_LIKE", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_NONE); - (void)rrdhost_set_system_info_variable( + (void)rrdhost_system_info_set_by_name( systemInfo, "NETDATA_CONTAINER_OS_VERSION", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_NONE); - (void)rrdhost_set_system_info_variable( + (void)rrdhost_system_info_set_by_name( systemInfo, "NETDATA_CONTAINER_OS_VERSION_ID", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_NONE); - (void)rrdhost_set_system_info_variable( + (void)rrdhost_system_info_set_by_name( systemInfo, "NETDATA_CONTAINER_OS_DETECTION", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_NONE); - (void)rrdhost_set_system_info_variable( + (void)rrdhost_system_info_set_by_name( systemInfo, "NETDATA_CONTAINER_IS_OFFICIAL_IMAGE", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_FALSE); } static void netdata_windows_install_type(struct rrdhost_system_info *systemInfo) { - (void)rrdhost_set_system_info_variable(systemInfo, "NETDATA_INSTALL_TYPE", "netdata-installer.exe"); + (void)rrdhost_system_info_set_by_name(systemInfo, "NETDATA_INSTALL_TYPE", "netdata-installer.exe"); } void netdata_windows_get_system_info(struct rrdhost_system_info *systemInfo)