summaryrefslogtreecommitdiffstats
path: root/src/daemon/win_system-info.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-25 17:33:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-25 17:34:10 +0000
commit83ba6762cc43d9db581b979bb5e3445669e46cc2 (patch)
tree2e69833b43f791ed253a7a20318b767ebe56cdb8 /src/daemon/win_system-info.c
parentReleasing debian version 1.47.5-1. (diff)
downloadnetdata-83ba6762cc43d9db581b979bb5e3445669e46cc2.tar.xz
netdata-83ba6762cc43d9db581b979bb5e3445669e46cc2.zip
Merging upstream version 2.0.3+dfsg (Closes: #923993, #1042533, #1045145).
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/daemon/win_system-info.c')
-rw-r--r--src/daemon/win_system-info.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/daemon/win_system-info.c b/src/daemon/win_system-info.c
index 2d67862fb..517692dff 100644
--- a/src/daemon/win_system-info.c
+++ b/src/daemon/win_system-info.c
@@ -108,10 +108,11 @@ static void netdata_windows_get_mem(struct rrdhost_system_info *systemInfo)
{
ULONGLONG size;
char memSize[256];
+ // The amount of physically installed RAM, in kilobytes.
if (!GetPhysicallyInstalledSystemMemory(&size))
size = 0;
else
- (void)snprintf(memSize, 255, "%llu", size);
+ (void)snprintf(memSize, 255, "%llu", size * 1024); // to bytes
(void)rrdhost_set_system_info_variable(systemInfo,
"NETDATA_SYSTEM_TOTAL_RAM",
@@ -220,32 +221,25 @@ static void netdata_windows_discover_os_version(char *os, size_t length, DWORD b
}
// We are not testing older, because it is not supported anymore by Microsoft
- (void)snprintf(os, length, "Microsoft Windows Version %s, Build %d (Name: Windows %s)", versionName, build, version);
+ (void)snprintf(os, length, "Microsoft Windows Version %s, Build %d", version, build);
}
-static void netdata_windows_os_version(char *out, DWORD length)
+static void netdata_windows_os_kernel_version(char *out, DWORD length, DWORD build)
{
- if (netdata_registry_get_string(out,
- length,
+ DWORD major, minor;
+ if (!netdata_registry_get_dword(&major,
HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
- "ProductName"))
- return;
+ "CurrentMajorVersionNumber"))
+ major = 0;
- (void)snprintf(out, length, "%s", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_UNKNOWN);
-}
-
-static void netdata_windows_os_kernel_version(char *out, DWORD length, DWORD build)
-{
- char version[8];
- if (!netdata_registry_get_string(version,
- 7,
+ if (!netdata_registry_get_dword(&minor,
HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
- "CurrentVersion"))
- version[0] = '\0';
+ "CurrentMinorVersionNumber"))
+ minor = 0;
- (void)snprintf(out, length, "%s (build: %u)", version, build);
+ (void)snprintf(out, length, "Windows %u.%u.%u Build: %u", major, minor, build, build);
}
static void netdata_windows_host(struct rrdhost_system_info *systemInfo)
@@ -261,7 +255,6 @@ static void netdata_windows_host(struct rrdhost_system_info *systemInfo)
(void)rrdhost_set_system_info_variable(
systemInfo, "NETDATA_HOST_OS_ID_LIKE", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_UNKNOWN);
- netdata_windows_os_version(osVersion, 4095);
(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);
@@ -306,6 +299,11 @@ static void netdata_windows_container(struct rrdhost_system_info *systemInfo)
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 netdata_windows_get_system_info(struct rrdhost_system_info *systemInfo)
{
netdata_windows_cloud(systemInfo);
@@ -314,5 +312,6 @@ void netdata_windows_get_system_info(struct rrdhost_system_info *systemInfo)
netdata_windows_get_cpu(systemInfo);
netdata_windows_get_mem(systemInfo);
netdata_windows_get_total_disk_size(systemInfo);
+ netdata_windows_install_type(systemInfo);
}
#endif