From 048b9e1b98b0353e53062f13befcedd5a5ea8e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E9=BE=99=E5=A5=87?= Date: Thu, 19 Sep 2024 09:53:57 +0800 Subject: [PATCH] hostobject CPU cores --- internal/plugins/inputs/hostobject/input.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/plugins/inputs/hostobject/input.go b/internal/plugins/inputs/hostobject/input.go index c9109746a0..c90c035293 100644 --- a/internal/plugins/inputs/hostobject/input.go +++ b/internal/plugins/inputs/hostobject/input.go @@ -11,6 +11,7 @@ import ( "fmt" "net" "net/http" + "runtime" "strconv" "strings" "time" @@ -183,7 +184,7 @@ func (ipt *Input) collect() error { Add("logging_level", message.Host.loggingLevel, false, true). AddTag("name", message.Host.HostMeta.HostName). AddTag("os", message.Host.HostMeta.OS). - Add("num_cpu", len(message.Host.CPU), false, false). + Add("num_cpu", runtime.NumCPU(), false, false). AddTag("unicast_ip", message.Config.IP). Add("disk_total", message.Host.getDiskTotal(), false, true). AddTag("arch", message.Host.HostMeta.Arch)