diff --git a/internal/config/defaults.go b/internal/config/defaults.go index da22ec0333..22491e99d5 100644 --- a/internal/config/defaults.go +++ b/internal/config/defaults.go @@ -25,8 +25,8 @@ const ( DefCollectorTLSCAPath = "/var/lib/nginx-agent/ca.pem" DefCollectorTLSSANNames = "127.0.0.1,::1,localhost" - DefCommandServerHostKey = "127.0.0.1" - DefCommandServerPortKey = 8080 + DefCommandServerHostKey = "" + DefCommandServerPortKey = 0 DefCommandServerTypeKey = "grpc" DefCommandAuthTokenKey = "" DefCommandTLSCertKey = "" diff --git a/internal/datasource/host/info.go b/internal/datasource/host/info.go index d6f7998872..ef7a9e1ee9 100644 --- a/internal/datasource/host/info.go +++ b/internal/datasource/host/info.go @@ -160,7 +160,7 @@ func (i *Info) HostInfo(ctx context.Context) *v1.Resource_HostInfo { func containsContainerReference(cgroupFile string) bool { data, err := os.ReadFile(cgroupFile) if err != nil { - slog.Error("Unable to check if cgroup file contains a container reference", "error", err) + slog.Warn("Unable to check if cgroup file contains a container reference", "error", err) return false } diff --git a/internal/plugin/plugin_manager.go b/internal/plugin/plugin_manager.go index fd33c03f8d..5288bf53f9 100644 --- a/internal/plugin/plugin_manager.go +++ b/internal/plugin/plugin_manager.go @@ -49,6 +49,9 @@ func addCommandAndFilePlugins(ctx context.Context, plugins []bus.Plugin, agentCo filePlugin := file.NewFilePlugin(agentConfig, grpcConnection) plugins = append(plugins, filePlugin) } + } else { + slog.InfoContext(ctx, "Agent is not connected to a management plane. "+ + "Configure a command server to establish a connection with a management plane.") } return plugins @@ -77,5 +80,7 @@ func addWatcherPlugin(plugins []bus.Plugin, agentConfig *config.Config) []bus.Pl func isGrpcClientConfigured(agentConfig *config.Config) bool { return agentConfig.Command != nil && agentConfig.Command.Server != nil && + agentConfig.Command.Server.Host != "" && + agentConfig.Command.Server.Port != 0 && agentConfig.Command.Server.Type == config.Grpc }