Skip to content

Commit

Permalink
fix the renamed function under windows (netdata#19240)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktsaou authored Dec 17, 2024
1 parent 9f6ab18 commit 7b01224
Showing 1 changed file with 34 additions and 33 deletions.
67 changes: 34 additions & 33 deletions src/daemon/win_system-info.c
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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);

}
Expand All @@ -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);
}
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7b01224

Please sign in to comment.