mirror of
https://github.com/netdata/netdata.git
synced 2025-04-13 09:11:50 +00:00
Adjust content api/v1/info (Windows) (#18656)
* address_collection: Fix os version * address_collection: Cleanup code * address_collection: Add install type * address_collection: Address kernel version * address_collection: Adjust variables for Microsoft
This commit is contained in:
parent
ff46cda38f
commit
f6125f31b4
3 changed files with 36 additions and 21 deletions
|
@ -5,7 +5,20 @@
|
||||||
name="netdata"
|
name="netdata"
|
||||||
type="win32"/>
|
type="win32"/>
|
||||||
<description>Netdata is a high-performance, cloud-native, and on-premises observability platform designed to monitor metrics and logs with unparalleled efficiency.</description>
|
<description>Netdata is a high-performance, cloud-native, and on-premises observability platform designed to monitor metrics and logs with unparalleled efficiency.</description>
|
||||||
<!-- Identify the application security requirements. -->
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
|
<application>
|
||||||
|
<!-- Windows 10 and Windows 11 -->
|
||||||
|
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||||
|
<!-- Windows 8.1 -->
|
||||||
|
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||||
|
<!-- Windows 8 -->
|
||||||
|
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||||
|
<!-- Windows 7 -->
|
||||||
|
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||||
|
<!-- Windows Vista -->
|
||||||
|
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||||
|
</application>
|
||||||
|
</compatibility>
|
||||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||||
<security>
|
<security>
|
||||||
<requestedPrivileges>
|
<requestedPrivileges>
|
||||||
|
|
|
@ -1332,6 +1332,7 @@ char *get_value_from_key(char *buffer, char *key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_install_type(char **install_type, char **prebuilt_arch, char **prebuilt_dist) {
|
void get_install_type(char **install_type, char **prebuilt_arch, char **prebuilt_dist) {
|
||||||
|
#ifndef OS_WINDOWS
|
||||||
char *install_type_filename;
|
char *install_type_filename;
|
||||||
|
|
||||||
int install_type_filename_len = (strlen(netdata_configured_user_config_dir) + strlen(".install-type") + 3);
|
int install_type_filename_len = (strlen(netdata_configured_user_config_dir) + strlen(".install-type") + 3);
|
||||||
|
@ -1354,6 +1355,9 @@ void get_install_type(char **install_type, char **prebuilt_arch, char **prebuilt
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
freez(install_type_filename);
|
freez(install_type_filename);
|
||||||
|
#else
|
||||||
|
*install_type = strdupz("netdata_installer.exe");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
|
|
|
@ -221,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
|
// 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)
|
|
||||||
{
|
|
||||||
if (netdata_registry_get_string(out,
|
|
||||||
length,
|
|
||||||
HKEY_LOCAL_MACHINE,
|
|
||||||
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
|
|
||||||
"ProductName"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
(void)snprintf(out, length, "%s", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_UNKNOWN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void netdata_windows_os_kernel_version(char *out, DWORD length, DWORD build)
|
static void netdata_windows_os_kernel_version(char *out, DWORD length, DWORD build)
|
||||||
{
|
{
|
||||||
char version[8];
|
DWORD major, minor;
|
||||||
if (!netdata_registry_get_string(version,
|
if (!netdata_registry_get_dword(&major,
|
||||||
7,
|
|
||||||
HKEY_LOCAL_MACHINE,
|
HKEY_LOCAL_MACHINE,
|
||||||
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
|
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
|
||||||
"CurrentVersion"))
|
"CurrentMajorVersionNumber"))
|
||||||
version[0] = '\0';
|
major = 0;
|
||||||
|
|
||||||
(void)snprintf(out, length, "%s (build: %u)", version, build);
|
if (!netdata_registry_get_dword(&minor,
|
||||||
|
HKEY_LOCAL_MACHINE,
|
||||||
|
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
|
||||||
|
"CurrentMinorVersionNumber"))
|
||||||
|
minor = 0;
|
||||||
|
|
||||||
|
(void)snprintf(out, length, "Windows %u.%u.%u Build: %u", major, minor, build, build);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void netdata_windows_host(struct rrdhost_system_info *systemInfo)
|
static void netdata_windows_host(struct rrdhost_system_info *systemInfo)
|
||||||
|
@ -262,7 +255,6 @@ static void netdata_windows_host(struct rrdhost_system_info *systemInfo)
|
||||||
(void)rrdhost_set_system_info_variable(
|
(void)rrdhost_set_system_info_variable(
|
||||||
systemInfo, "NETDATA_HOST_OS_ID_LIKE", NETDATA_DEFAULT_SYSTEM_INFO_VALUE_UNKNOWN);
|
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", osVersion);
|
||||||
(void)rrdhost_set_system_info_variable(systemInfo, "NETDATA_HOST_OS_VERSION_ID", osVersion);
|
(void)rrdhost_set_system_info_variable(systemInfo, "NETDATA_HOST_OS_VERSION_ID", osVersion);
|
||||||
|
|
||||||
|
@ -307,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);
|
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)
|
void netdata_windows_get_system_info(struct rrdhost_system_info *systemInfo)
|
||||||
{
|
{
|
||||||
netdata_windows_cloud(systemInfo);
|
netdata_windows_cloud(systemInfo);
|
||||||
|
@ -315,5 +312,6 @@ void netdata_windows_get_system_info(struct rrdhost_system_info *systemInfo)
|
||||||
netdata_windows_get_cpu(systemInfo);
|
netdata_windows_get_cpu(systemInfo);
|
||||||
netdata_windows_get_mem(systemInfo);
|
netdata_windows_get_mem(systemInfo);
|
||||||
netdata_windows_get_total_disk_size(systemInfo);
|
netdata_windows_get_total_disk_size(systemInfo);
|
||||||
|
netdata_windows_install_type(systemInfo);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue