@cryptotaxi247 / netdata-1 / commits / 97420bef4

proc.plugin: log as info if a dir not exists (#18909)

log as info if ENOENT

Ilya Mashchenko committed Oct 31, 2024 at 14:45 UTC 97420bef49ce80bce680f1dda514526f241a1c6c
2 files changed +8 -7
src/collectors/proc.plugin/sys_devices_system_node.c
+2 -1
@@ -31,7 +31,8 @@ static int find_all_nodes() {
31
32 DIR *dir = opendir(dirname);
33 if(!dir) {
34 - collector_error("Cannot read NUMA node directory '%s'", dirname);
34 + nd_log(
35 + NDLS_COLLECTORS, errno == ENOENT ? NDLP_INFO : NDLP_ERR, "Cannot read NUMA node directory '%s'", dirname);
36 return 0;
37 }
38
src/collectors/proc.plugin/sys_fs_btrfs.c
+6 -6
@@ -270,8 +270,8 @@ static inline int find_btrfs_disks(BTRFS_NODE *node, const char *path) {
270
271 DIR *dir = opendir(path);
272 if (!dir) {
273 - if(!node->logged_error) {
274 - collector_error("BTRFS: Cannot open directory '%s'.", path);
273 + if (!node->logged_error) {
274 + nd_log(NDLS_COLLECTORS, errno == ENOENT ? NDLP_INFO : NDLP_ERR, "BTRFS: Cannot open directory '%s'.", path);
275 node->logged_error = 1;
276 }
277 return 1;
@@ -374,8 +374,8 @@ static inline int find_btrfs_devices(BTRFS_NODE *node, const char *path) {
374
375 DIR *dir = opendir(path);
376 if (!dir) {
377 - if(!node->logged_error) {
378 - collector_error("BTRFS: Cannot open directory '%s'.", path);
377 + if (!node->logged_error) {
378 + nd_log(NDLS_COLLECTORS, errno == ENOENT ? NDLP_INFO : NDLP_ERR, "BTRFS: Cannot open directory '%s'.", path);
379 node->logged_error = 1;
380 }
381 return 1;
@@ -474,8 +474,8 @@ static inline int find_all_btrfs_pools(const char *path, int update_every) {
474
475 DIR *dir = opendir(path);
476 if (!dir) {
477 - if(!logged_error) {
478 - collector_error("BTRFS: Cannot open directory '%s'.", path);
477 + if (!logged_error) {
478 + nd_log(NDLS_COLLECTORS, errno == ENOENT ? NDLP_INFO : NDLP_ERR, "BTRFS: Cannot open directory '%s'.", path);
479 logged_error = 1;
480 }
481 return 1;