chore(go.d): don’t log "no such file or directory" for user SNMP profiles (#21014)
Ilya Mashchenko committed
Sep 20, 2025 at 17:59 UTC
e9df56eb31c8584163a5a278d5a0907f9422cc05
2 files changed
+7
-1
src/go/plugin/go.d/collector/snmp/ddsnmp/load.go
+3
-1
@@ -41,7 +41,9 @@ func loadProfiles() {
41
for _, dir := range profilesPaths {
42
profiles, err := loadProfilesFromDir(dir, profilesPaths)
43
if err != nil {
44
- log.Errorf("failed to load dd snmp profiles from '%s': %v", dir, err)
44
+ if pluginconfig.IsStock(dir) || !errors.Is(err, os.ErrNotExist) {
45
+ log.Errorf("failed to load dd snmp profiles from '%s': %v", dir, err)
46
+ }
47
continue
48
}
49
src/go/plugin/go.d/pkg/pluginconfig/pluginconfig.go
+4
@@ -54,6 +54,10 @@ type directories struct {
54
varLibDir string
55
}
56
57
+func IsStock(path string) bool {
58
+ return strings.HasPrefix(path, StockConfigDir())
59
+}
60
+
61
// MustInit parses env, applies CLI overrides, discovers directories, and stores them.
62
// Safe to call multiple times; only the first call has effect.
63
func MustInit(opts *cli.Option) {