@cryptotaxi247 / netdata-1 / commits / 9a90c5b9b

fix: restore _hw_product_name, _hw_sys_vendor, and _hw_product_type labels in netdata_info (#22134)

* Initial plan * fix: restore _hw_product_name and _hw_sys_vendor labels in netdata_info The DMI hardware labels (_hw_product_name and _hw_sys_vendor) were missing from the netdata_info Prometheus metric after v2.6.3. The daemon status file already collects DMI/hardware information (product name and system vendor) via os_dmi_info_get() and product_name_vendor_type(). However, this data was never being exposed as host labels in the rrdhost_system_info structure that feeds into the netdata_info metric. Changes: - Add hw_product_name and hw_sys_vendor fields to rrdhost_system_info struct - In rrdhost_system_info_detect(), populate these fields from the daemon status file (which already has the DMI data from all platforms) - Export them as _hw_product_name and _hw_sys_vendor labels in rrdhost_system_info_to_rrdlabels() - Read them back in rrdhost_system_info_from_host_labels() for child hosts - Free them properly in rrdhost_system_info_free() Agent-Logs-Url: https://github.com/netdata/netdata/sessions/8d522417-ab32-4566-bc91-aaf3592211d7 Co-authored-by: stelfrag <52996999+stelfrag@users.noreply.github.com> * fix: also restore _hw_product_type label in netdata_info Agent-Logs-Url: https://github.com/netdata/netdata/sessions/e26f16b1-8351-462b-90ec-2dd02d911262 Co-authored-by: stelfrag <52996999+stelfrag@users.noreply.github.com> * Update src/database/rrdhost-system-info.c Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: stelfrag <52996999+stelfrag@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Copilot committed Apr 6, 2026 at 13:51 UTC 9a90c5b9b5b512f050d0ddf1ddd771ba9bbb6aad
2 files changed +40 -1
src/database/rrdhost-system-info.c
+37 -1
@@ -194,6 +194,9 @@ struct rrdhost_system_info *rrdhost_system_info_from_host_labels(RRDLABELS *labe
194 rrdlabels_get_value_strdup_or_null(labels, &info->network_default_iface, "_net_default_iface");
195 rrdlabels_get_value_strdup_or_null(labels, &info->network_default_iface_ip, "_net_default_iface_ip");
196 rrdlabels_get_value_strdup_or_null(labels, &info->network_default_iface_detection, "_net_default_iface_detection");
197 + rrdlabels_get_value_strdup_or_null(labels, &info->hw_product_name, "_hw_product_name");
198 + rrdlabels_get_value_strdup_or_null(labels, &info->hw_sys_vendor, "_hw_sys_vendor");
199 + rrdlabels_get_value_strdup_or_null(labels, &info->hw_product_type, "_hw_product_type");
200 return info;
201 }
202
@@ -266,15 +269,45 @@ void rrdhost_system_info_to_rrdlabels(struct rrdhost_system_info *system_info, R
269
270 if (system_info->network_default_iface_detection)
271 rrdlabels_add(labels, "_net_default_iface_detection", system_info->network_default_iface_detection, RRDLABEL_SRC_AUTO);
272 +
273 + if (system_info->hw_product_name)
274 + rrdlabels_add(labels, "_hw_product_name", system_info->hw_product_name, RRDLABEL_SRC_AUTO);
275 +
276 + if (system_info->hw_sys_vendor)
277 + rrdlabels_add(labels, "_hw_sys_vendor", system_info->hw_sys_vendor, RRDLABEL_SRC_AUTO);
278 +
279 + if (system_info->hw_product_type)
280 + rrdlabels_add(labels, "_hw_product_type", system_info->hw_product_type, RRDLABEL_SRC_AUTO);
281 }
282
283 int rrdhost_system_info_detect(struct rrdhost_system_info *system_info) {
272 -#if !defined(OS_WINDOWS)
284 if (unlikely(!system_info)) {
285 netdata_log_error("SYSTEM INFO: System info structure is NULL.");
286 return 1;
287 }
288
289 + // Populate hardware product fields from the daemon status file when it is available/initialized.
290 + {
291 + const char *product_name = daemon_status_file_get_product_name();
292 + if (product_name && *product_name) {
293 + freez(system_info->hw_product_name);
294 + system_info->hw_product_name = strdupz(product_name);
295 + }
296 +
297 + const char *sys_vendor = daemon_status_file_get_sys_vendor();
298 + if (sys_vendor && *sys_vendor) {
299 + freez(system_info->hw_sys_vendor);
300 + system_info->hw_sys_vendor = strdupz(sys_vendor);
301 + }
302 +
303 + const char *product_type = daemon_status_file_get_product_type();
304 + if (product_type && *product_type) {
305 + freez(system_info->hw_product_type);
306 + system_info->hw_product_type = strdupz(product_type);
307 + }
308 + }
309 +
310 +#if !defined(OS_WINDOWS)
311 CLEAN_BUFFER *script = buffer_create(0, NULL);
312 buffer_sprintf(script, "%s/system-info.sh", netdata_configured_primary_plugins_dir);
313
@@ -405,6 +438,9 @@ void rrdhost_system_info_free(struct rrdhost_system_info *system_info) {
438 freez(system_info->network_default_iface);
439 freez(system_info->network_default_iface_ip);
440 freez(system_info->network_default_iface_detection);
441 + freez(system_info->hw_product_name);
442 + freez(system_info->hw_sys_vendor);
443 + freez(system_info->hw_product_type);
444 freez(system_info);
445 }
446 }
src/database/rrdhost-system-info.h
+3
@@ -48,6 +48,9 @@ struct rrdhost_system_info {
48 char *network_default_iface_ip;
49 char *network_default_iface_detection;
50 int mc_version;
51 + char *hw_product_name;
52 + char *hw_sys_vendor;
53 + char *hw_product_type;
54 };
55 #else
56 struct rrdhost_system_info;