Add Collector log (#14309)
thiagoftsm committed
Jan 25, 2023 at 19:04 UTC
3e3ff4bee83363dca7cfb838baf1cf316960ed1b
61 files changed
+790
-735
collectors/apps.plugin/apps_plugin.c
+1
@@ -4850,6 +4850,7 @@ void *reader_main(void *arg __maybe_unused) {
4850
4851
int main(int argc, char **argv) {
4852
// debug_flags = D_PROCFILE;
4853
+ stderror = stderr;
4854
4855
clocks_init();
4856
collectors/cgroups.plugin/cgroup-network.c
+41
-40
@@ -43,7 +43,7 @@ unsigned int read_iface_iflink(const char *prefix, const char *iface) {
43
44
unsigned long long iflink = 0;
45
int ret = read_single_number_file(filename, &iflink);
46
- if(ret) error("Cannot read '%s'.", filename);
46
+ if(ret) collector_error("Cannot read '%s'.", filename);
47
48
return (unsigned int)iflink;
49
}
@@ -56,7 +56,7 @@ unsigned int read_iface_ifindex(const char *prefix, const char *iface) {
56
57
unsigned long long ifindex = 0;
58
int ret = read_single_number_file(filename, &ifindex);
59
- if(ret) error("Cannot read '%s'.", filename);
59
+ if(ret) collector_error("Cannot read '%s'.", filename);
60
61
return (unsigned int)ifindex;
62
}
@@ -70,18 +70,18 @@ struct iface *read_proc_net_dev(const char *scope __maybe_unused, const char *pr
70
snprintfz(filename, FILENAME_MAX, "%s%s", prefix, (*prefix)?"/proc/1/net/dev":"/proc/net/dev");
71
72
#ifdef NETDATA_INTERNAL_CHECKS
73
- info("parsing '%s'", filename);
73
+ collector_info("parsing '%s'", filename);
74
#endif
75
76
ff = procfile_open(filename, " \t,:|", PROCFILE_FLAG_DEFAULT);
77
if(unlikely(!ff)) {
78
- error("Cannot open file '%s'", filename);
78
+ collector_error("Cannot open file '%s'", filename);
79
return NULL;
80
}
81
82
ff = procfile_readall(ff);
83
if(unlikely(!ff)) {
84
- error("Cannot read file '%s'", filename);
84
+ collector_error("Cannot read file '%s'", filename);
85
return NULL;
86
}
87
@@ -99,7 +99,7 @@ struct iface *read_proc_net_dev(const char *scope __maybe_unused, const char *pr
99
root = t;
100
101
#ifdef NETDATA_INTERNAL_CHECKS
102
- info("added %s interface '%s', ifindex %u, iflink %u", scope, t->device, t->ifindex, t->iflink);
102
+ collector_info("added %s interface '%s', ifindex %u, iflink %u", scope, t->device, t->ifindex, t->iflink);
103
#endif
104
}
105
@@ -145,7 +145,7 @@ static void continue_as_child(void) {
145
pid_t ret;
146
147
if (child < 0)
148
- error("fork() failed");
148
+ collector_error("fork() failed");
149
150
/* Only the child returns */
151
if (child == 0)
@@ -180,7 +180,7 @@ int proc_pid_fd(const char *prefix, const char *ns, pid_t pid) {
180
int fd = open(filename, O_RDONLY);
181
182
if(fd == -1)
183
- error("Cannot open proc_pid_fd() file '%s'", filename);
183
+ collector_error("Cannot open proc_pid_fd() file '%s'", filename);
184
185
return fd;
186
}
@@ -230,7 +230,7 @@ int switch_namespace(const char *prefix, pid_t pid) {
230
if(setns(all_ns[i].fd, all_ns[i].nstype) == -1) {
231
if(pass == 1) {
232
all_ns[i].status = 0;
233
- error("Cannot switch to %s namespace of pid %d", all_ns[i].name, (int) pid);
233
+ collector_error("Cannot switch to %s namespace of pid %d", all_ns[i].name, (int) pid);
234
}
235
}
236
else
@@ -243,17 +243,17 @@ int switch_namespace(const char *prefix, pid_t pid) {
243
244
if(root_fd != -1) {
245
if(fchdir(root_fd) < 0)
246
- error("Cannot fchdir() to pid %d root directory", (int)pid);
246
+ collector_error("Cannot fchdir() to pid %d root directory", (int)pid);
247
248
if(chroot(".") < 0)
249
- error("Cannot chroot() to pid %d root directory", (int)pid);
249
+ collector_error("Cannot chroot() to pid %d root directory", (int)pid);
250
251
close(root_fd);
252
}
253
254
if(cwd_fd != -1) {
255
if(fchdir(cwd_fd) < 0)
256
- error("Cannot fchdir() to pid %d current working directory", (int)pid);
256
+ collector_error("Cannot fchdir() to pid %d current working directory", (int)pid);
257
258
close(cwd_fd);
259
}
@@ -277,7 +277,7 @@ int switch_namespace(const char *prefix, pid_t pid) {
277
#else
278
279
errno = ENOSYS;
280
- error("setns() is missing on this system.");
280
+ collector_error("setns() is missing on this system.");
281
return 1;
282
283
#endif
@@ -286,13 +286,13 @@ int switch_namespace(const char *prefix, pid_t pid) {
286
pid_t read_pid_from_cgroup_file(const char *filename) {
287
int fd = open(filename, procfile_open_flags);
288
if(fd == -1) {
289
- error("Cannot open pid_from_cgroup() file '%s'.", filename);
289
+ collector_error("Cannot open pid_from_cgroup() file '%s'.", filename);
290
return 0;
291
}
292
293
FILE *fp = fdopen(fd, "r");
294
if(!fp) {
295
- error("Cannot upgrade fd to fp for file '%s'.", filename);
295
+ collector_error("Cannot upgrade fd to fp for file '%s'.", filename);
296
return 0;
297
}
298
@@ -308,7 +308,7 @@ pid_t read_pid_from_cgroup_file(const char *filename) {
308
fclose(fp);
309
310
#ifdef NETDATA_INTERNAL_CHECKS
311
- if(pid > 0) info("found pid %d on file '%s'", pid, filename);
311
+ if(pid > 0) collector_info("found pid %d on file '%s'", pid, filename);
312
#endif
313
314
return pid;
@@ -331,7 +331,7 @@ pid_t read_pid_from_cgroup(const char *path) {
331
332
DIR *dir = opendir(path);
333
if (!dir) {
334
- error("cannot read directory '%s'", path);
334
+ collector_error("cannot read directory '%s'", path);
335
return 0;
336
}
337
@@ -369,7 +369,7 @@ struct found_device {
369
370
void add_device(const char *host, const char *guest) {
371
#ifdef NETDATA_INTERNAL_CHECKS
372
- info("adding device with host '%s', guest '%s'", host, guest);
372
+ collector_info("adding device with host '%s', guest '%s'", host, guest);
373
#endif
374
375
uint32_t hash = simple_hash(host);
@@ -422,36 +422,36 @@ void detect_veth_interfaces(pid_t pid) {
422
host = read_proc_net_dev("host", netdata_configured_host_prefix);
423
if(!host) {
424
errno = 0;
425
- error("cannot read host interface list.");
425
+ collector_error("cannot read host interface list.");
426
goto cleanup;
427
}
428
429
if(!eligible_ifaces(host)) {
430
errno = 0;
431
- info("there are no double-linked host interfaces available.");
431
+ collector_info("there are no double-linked host interfaces available.");
432
goto cleanup;
433
}
434
435
if(switch_namespace(netdata_configured_host_prefix, pid)) {
436
errno = 0;
437
- error("cannot switch to the namespace of pid %u", (unsigned int) pid);
437
+ collector_error("cannot switch to the namespace of pid %u", (unsigned int) pid);
438
goto cleanup;
439
}
440
441
#ifdef NETDATA_INTERNAL_CHECKS
442
- info("switched to namespaces of pid %d", pid);
442
+ collector_info("switched to namespaces of pid %d", pid);
443
#endif
444
445
cgroup = read_proc_net_dev("cgroup", NULL);
446
if(!cgroup) {
447
errno = 0;
448
- error("cannot read cgroup interface list.");
448
+ collector_error("cannot read cgroup interface list.");
449
goto cleanup;
450
}
451
452
if(!eligible_ifaces(cgroup)) {
453
errno = 0;
454
- error("there are not double-linked cgroup interfaces available.");
454
+ collector_error("there are not double-linked cgroup interfaces available.");
455
goto cleanup;
456
}
457
@@ -495,7 +495,7 @@ cleanup:
495
#define CGROUP_NETWORK_INTERFACE_MAX_LINE 2048
496
void call_the_helper(pid_t pid, const char *cgroup) {
497
if(setresuid(0, 0, 0) == -1)
498
- error("setresuid(0, 0, 0) failed.");
498
+ collector_error("setresuid(0, 0, 0) failed.");
499
500
char command[CGROUP_NETWORK_INTERFACE_MAX_LINE + 1];
501
if(cgroup)
@@ -503,7 +503,7 @@ void call_the_helper(pid_t pid, const char *cgroup) {
503
else
504
snprintfz(command, CGROUP_NETWORK_INTERFACE_MAX_LINE, "exec " PLUGINS_DIR "/cgroup-network-helper.sh --pid %d", pid);
505
506
- info("running: %s", command);
506
+ collector_info("running: %s", command);
507
508
pid_t cgroup_pid;
509
FILE *fp_child_input, *fp_child_output;
@@ -539,7 +539,7 @@ void call_the_helper(pid_t pid, const char *cgroup) {
539
netdata_pclose(fp_child_input, fp_child_output, cgroup_pid);
540
}
541
else
542
- error("cannot execute cgroup-network helper script: %s", command);
542
+ collector_error("cannot execute cgroup-network helper script: %s", command);
543
}
544
545
int is_valid_path_symbol(char c) {
@@ -570,33 +570,33 @@ int verify_path(const char *path) {
570
const char *s = path;
571
while((c = *s++)) {
572
if(!( isalnum(c) || is_valid_path_symbol(c) )) {
573
- error("invalid character in path '%s'", path);
573
+ collector_error("invalid character in path '%s'", path);
574
return -1;
575
}
576
}
577
578
if(strstr(path, "\\") && !strstr(path, "\\x")) {
579
- error("invalid escape sequence in path '%s'", path);
579
+ collector_error("invalid escape sequence in path '%s'", path);
580
return 1;
581
}
582
583
if(strstr(path, "/../")) {
584
- error("invalid parent path sequence detected in '%s'", path);
584
+ collector_error("invalid parent path sequence detected in '%s'", path);
585
return 1;
586
}
587
588
if(path[0] != '/') {
589
- error("only absolute path names are supported - invalid path '%s'", path);
589
+ collector_error("only absolute path names are supported - invalid path '%s'", path);
590
return -1;
591
}
592
593
if (stat(path, &sb) == -1) {
594
- error("cannot stat() path '%s'", path);
594
+ collector_error("cannot stat() path '%s'", path);
595
return -1;
596
}
597
598
if((sb.st_mode & S_IFMT) != S_IFDIR) {
599
- error("path '%s' is not a directory", path);
599
+ collector_error("path '%s' is not a directory", path);
600
return -1;
601
}
602
@@ -618,10 +618,10 @@ char *fix_path_variable(void) {
618
char *s = strsep(&ptr, ":");
619
if(s && *s) {
620
if(verify_path(s) == -1) {
621
- error("the PATH variable includes an invalid path '%s' - removed it.", s);
621
+ collector_error("the PATH variable includes an invalid path '%s' - removed it.", s);
622
}
623
else {
624
- info("the PATH variable includes a valid path '%s'.", s);
624
+ collector_info("the PATH variable includes a valid path '%s'.", s);
625
if(added) strcat(safe_path, ":");
626
strcat(safe_path, s);
627
added++;
@@ -629,8 +629,8 @@ char *fix_path_variable(void) {
629
}
630
}
631
632
- info("unsafe PATH: '%s'.", path);
633
- info(" safe PATH: '%s'.", safe_path);
632
+ collector_info("unsafe PATH: '%s'.", path);
633
+ collector_info(" safe PATH: '%s'.", safe_path);
634
635
freez(p);
636
return safe_path;
@@ -646,6 +646,7 @@ void usage(void) {
646
}
647
648
int main(int argc, char **argv) {
649
+ stderror = stderr;
650
pid_t pid = 0;
651
652
program_name = argv[0];
@@ -690,7 +691,7 @@ int main(int argc, char **argv) {
691
692
if(pid <= 0) {
693
errno = 0;
693
- error("Invalid pid %d given", (int) pid);
694
+ collector_error("Invalid pid %d given", (int) pid);
695
return 2;
696
}
697
@@ -699,7 +700,7 @@ int main(int argc, char **argv) {
700
else if(!strcmp(argv[arg], "--cgroup")) {
701
char *cgroup = argv[arg+1];
702
if(verify_path(cgroup) == -1) {
702
- error("cgroup '%s' does not exist or is not valid.", cgroup);
703
+ collector_error("cgroup '%s' does not exist or is not valid.", cgroup);
704
return 1;
705
}
706
@@ -708,7 +709,7 @@ int main(int argc, char **argv) {
709
710
if(pid <= 0 && !detected_devices) {
711
errno = 0;
711
- error("Cannot find a cgroup PID from cgroup '%s'", cgroup);
712
+ collector_error("Cannot find a cgroup PID from cgroup '%s'", cgroup);
713
}
714
}
715
else
collectors/cgroups.plugin/sys_fs_cgroup.c
+55
-55
@@ -174,9 +174,9 @@ static enum cgroups_systemd_setting cgroups_detect_systemd(const char *exec)
174
}
175
176
if (ret == -1) {
177
- error("Failed to get the output of \"%s\"", exec);
177
+ collector_error("Failed to get the output of \"%s\"", exec);
178
} else if (ret == 0) {
179
- info("Cannot get the output of \"%s\" within %"PRId64" seconds", exec, (int64_t)timeout.tv_sec);
179
+ collector_info("Cannot get the output of \"%s\" within %"PRId64" seconds", exec, (int64_t)timeout.tv_sec);
180
} else {
181
while (fgets(buf, MAXSIZE_PROC_CMDLINE, fp_child_output) != NULL) {
182
if ((begin = strstr(buf, SYSTEMD_HIERARCHY_STRING))) {
@@ -214,7 +214,7 @@ static enum cgroups_type cgroups_try_detect_version()
214
FILE *fp_child_input;
215
FILE *fp_child_output = netdata_popen("grep cgroup /proc/filesystems", &command_pid, &fp_child_input);
216
if (!fp_child_output) {
217
- error("popen failed");
217
+ collector_error("popen failed");
218
return CGROUPS_AUTODETECT_FAIL;
219
}
220
while (fgets(buf, MAXSIZE_PROC_CMDLINE, fp_child_output) != NULL) {
@@ -258,12 +258,12 @@ static enum cgroups_type cgroups_try_detect_version()
258
// check kernel command line flag that can override that setting
259
FILE *fp = fopen("/proc/cmdline", "r");
260
if (!fp) {
261
- error("Error reading kernel boot commandline parameters");
261
+ collector_error("Error reading kernel boot commandline parameters");
262
return CGROUPS_AUTODETECT_FAIL;
263
}
264
265
if (!fgets(buf, MAXSIZE_PROC_CMDLINE, fp)) {
266
- error("couldn't read all cmdline params into buffer");
266
+ collector_error("couldn't read all cmdline params into buffer");
267
fclose(fp);
268
return CGROUPS_AUTODETECT_FAIL;
269
}
@@ -271,7 +271,7 @@ static enum cgroups_type cgroups_try_detect_version()
271
fclose(fp);
272
273
if (strstr(buf, "systemd.unified_cgroup_hierarchy=0")) {
274
- info("cgroups v2 (unified cgroups) is available but are disabled on this system.");
274
+ collector_info("cgroups v2 (unified cgroups) is available but are disabled on this system.");
275
return CGROUPS_V1;
276
}
277
return CGROUPS_V2;
@@ -311,7 +311,7 @@ void read_cgroup_plugin_configuration() {
311
if(cgroup_use_unified_cgroups == CONFIG_BOOLEAN_AUTO)
312
cgroup_use_unified_cgroups = (cgroups_try_detect_version() == CGROUPS_V2);
313
314
- info("use unified cgroups %s", cgroup_use_unified_cgroups ? "true" : "false");
314
+ collector_info("use unified cgroups %s", cgroup_use_unified_cgroups ? "true" : "false");
315
316
cgroup_containers_chart_priority = (int)config_get_number("plugin:cgroups", "containers priority", cgroup_containers_chart_priority);
317
if(cgroup_containers_chart_priority < 1)
@@ -361,7 +361,7 @@ void read_cgroup_plugin_configuration() {
361
mi = mountinfo_find_by_filesystem_super_option(root, "cgroup", "cpuacct");
362
if(!mi) mi = mountinfo_find_by_filesystem_mount_source(root, "cgroup", "cpuacct");
363
if(!mi) {
364
- error("CGROUP: cannot find cpuacct mountinfo. Assuming default: /sys/fs/cgroup/cpuacct");
364
+ collector_error("CGROUP: cannot find cpuacct mountinfo. Assuming default: /sys/fs/cgroup/cpuacct");
365
s = "/sys/fs/cgroup/cpuacct";
366
}
367
else s = mi->mount_point;
@@ -371,7 +371,7 @@ void read_cgroup_plugin_configuration() {
371
mi = mountinfo_find_by_filesystem_super_option(root, "cgroup", "cpuset");
372
if(!mi) mi = mountinfo_find_by_filesystem_mount_source(root, "cgroup", "cpuset");
373
if(!mi) {
374
- error("CGROUP: cannot find cpuset mountinfo. Assuming default: /sys/fs/cgroup/cpuset");
374
+ collector_error("CGROUP: cannot find cpuset mountinfo. Assuming default: /sys/fs/cgroup/cpuset");
375
s = "/sys/fs/cgroup/cpuset";
376
}
377
else s = mi->mount_point;
@@ -381,7 +381,7 @@ void read_cgroup_plugin_configuration() {
381
mi = mountinfo_find_by_filesystem_super_option(root, "cgroup", "blkio");
382
if(!mi) mi = mountinfo_find_by_filesystem_mount_source(root, "cgroup", "blkio");
383
if(!mi) {
384
- error("CGROUP: cannot find blkio mountinfo. Assuming default: /sys/fs/cgroup/blkio");
384
+ collector_error("CGROUP: cannot find blkio mountinfo. Assuming default: /sys/fs/cgroup/blkio");
385
s = "/sys/fs/cgroup/blkio";
386
}
387
else s = mi->mount_point;
@@ -391,7 +391,7 @@ void read_cgroup_plugin_configuration() {
391
mi = mountinfo_find_by_filesystem_super_option(root, "cgroup", "memory");
392
if(!mi) mi = mountinfo_find_by_filesystem_mount_source(root, "cgroup", "memory");
393
if(!mi) {
394
- error("CGROUP: cannot find memory mountinfo. Assuming default: /sys/fs/cgroup/memory");
394
+ collector_error("CGROUP: cannot find memory mountinfo. Assuming default: /sys/fs/cgroup/memory");
395
s = "/sys/fs/cgroup/memory";
396
}
397
else s = mi->mount_point;
@@ -401,7 +401,7 @@ void read_cgroup_plugin_configuration() {
401
mi = mountinfo_find_by_filesystem_super_option(root, "cgroup", "devices");
402
if(!mi) mi = mountinfo_find_by_filesystem_mount_source(root, "cgroup", "devices");
403
if(!mi) {
404
- error("CGROUP: cannot find devices mountinfo. Assuming default: /sys/fs/cgroup/devices");
404
+ collector_error("CGROUP: cannot find devices mountinfo. Assuming default: /sys/fs/cgroup/devices");
405
s = "/sys/fs/cgroup/devices";
406
}
407
else s = mi->mount_point;
@@ -433,7 +433,7 @@ void read_cgroup_plugin_configuration() {
433
if(mi) debug(D_CGROUP, "found unified cgroup root using mountsource info, with path: '%s'", mi->mount_point);
434
}
435
if(!mi) {
436
- error("CGROUP: cannot find cgroup2 mountinfo. Assuming default: /sys/fs/cgroup");
436
+ collector_error("CGROUP: cannot find cgroup2 mountinfo. Assuming default: /sys/fs/cgroup");
437
s = "/sys/fs/cgroup";
438
}
439
else s = mi->mount_point;
@@ -575,13 +575,13 @@ void netdata_cgroup_ebpf_initialize_shm()
575
{
576
shm_fd_cgroup_ebpf = shm_open(NETDATA_SHARED_MEMORY_EBPF_CGROUP_NAME, O_CREAT | O_RDWR, 0660);
577
if (shm_fd_cgroup_ebpf < 0) {
578
- error("Cannot initialize shared memory used by cgroup and eBPF, integration won't happen.");
578
+ collector_error("Cannot initialize shared memory used by cgroup and eBPF, integration won't happen.");
579
return;
580
}
581
582
size_t length = sizeof(netdata_ebpf_cgroup_shm_header_t) + cgroup_root_max * sizeof(netdata_ebpf_cgroup_shm_body_t);
583
if (ftruncate(shm_fd_cgroup_ebpf, length)) {
584
- error("Cannot set size for shared memory.");
584
+ collector_error("Cannot set size for shared memory.");
585
goto end_init_shm;
586
}
587
@@ -590,7 +590,7 @@ void netdata_cgroup_ebpf_initialize_shm()
590
shm_fd_cgroup_ebpf, 0);
591
592
if (!shm_cgroup_ebpf.header) {
593
- error("Cannot map shared memory used between cgroup and eBPF, integration won't happen");
593
+ collector_error("Cannot map shared memory used between cgroup and eBPF, integration won't happen");
594
goto end_init_shm;
595
}
596
shm_cgroup_ebpf.body = (netdata_ebpf_cgroup_shm_body_t *) ((char *)shm_cgroup_ebpf.header +
@@ -604,7 +604,7 @@ void netdata_cgroup_ebpf_initialize_shm()
604
return;
605
}
606
607
- error("Cannot create semaphore, integration between eBPF and cgroup won't happen");
607
+ collector_error("Cannot create semaphore, integration between eBPF and cgroup won't happen");
608
munmap(shm_cgroup_ebpf.header, length);
609
610
end_init_shm:
@@ -1077,7 +1077,7 @@ static inline void cgroup_read_cpuacct_stat(struct cpuacct_stat *cp) {
1077
unsigned long i, lines = procfile_lines(ff);
1078
1079
if(unlikely(lines < 1)) {
1080
- error("CGROUP: file '%s' should have 1+ lines.", cp->filename);
1080
+ collector_error("CGROUP: file '%s' should have 1+ lines.", cp->filename);
1081
cp->updated = 0;
1082
return;
1083
}
@@ -1123,7 +1123,7 @@ static inline void cgroup_read_cpuacct_cpu_stat(struct cpuacct_cpu_throttling *c
1123
1124
unsigned long lines = procfile_lines(ff);
1125
if (unlikely(lines < 3)) {
1126
- error("CGROUP: file '%s' should have 3 lines.", cp->filename);
1126
+ collector_error("CGROUP: file '%s' should have 3 lines.", cp->filename);
1127
cp->updated = 0;
1128
return;
1129
}
@@ -1180,7 +1180,7 @@ static inline void cgroup2_read_cpuacct_cpu_stat(struct cpuacct_stat *cp, struct
1180
unsigned long lines = procfile_lines(ff);
1181
1182
if (unlikely(lines < 3)) {
1183
- error("CGROUP: file '%s' should have at least 3 lines.", cp->filename);
1183
+ collector_error("CGROUP: file '%s' should have at least 3 lines.", cp->filename);
1184
cp->updated = 0;
1185
return;
1186
}
@@ -1261,7 +1261,7 @@ static inline void cgroup_read_cpuacct_usage(struct cpuacct_usage *ca) {
1261
}
1262
1263
if(unlikely(procfile_lines(ff) < 1)) {
1264
- error("CGROUP: file '%s' should have 1+ lines but has %zu.", ca->filename, procfile_lines(ff));
1264
+ collector_error("CGROUP: file '%s' should have 1+ lines but has %zu.", ca->filename, procfile_lines(ff));
1265
ca->updated = 0;
1266
return;
1267
}
@@ -1326,7 +1326,7 @@ static inline void cgroup_read_blkio(struct blkio *io) {
1326
unsigned long i, lines = procfile_lines(ff);
1327
1328
if(unlikely(lines < 1)) {
1329
- error("CGROUP: file '%s' should have 1+ lines.", io->filename);
1329
+ collector_error("CGROUP: file '%s' should have 1+ lines.", io->filename);
1330
io->updated = 0;
1331
return;
1332
}
@@ -1398,7 +1398,7 @@ static inline void cgroup2_read_blkio(struct blkio *io, unsigned int word_offset
1398
unsigned long i, lines = procfile_lines(ff);
1399
1400
if (unlikely(lines < 1)) {
1401
- error("CGROUP: file '%s' should have 1+ lines.", io->filename);
1401
+ collector_error("CGROUP: file '%s' should have 1+ lines.", io->filename);
1402
io->updated = 0;
1403
return;
1404
}
@@ -1442,7 +1442,7 @@ static inline void cgroup2_read_pressure(struct pressure *res) {
1442
1443
size_t lines = procfile_lines(ff);
1444
if (lines < 1) {
1445
- error("CGROUP: file '%s' should have 1+ lines.", res->filename);
1445
+ collector_error("CGROUP: file '%s' should have 1+ lines.", res->filename);
1446
res->updated = 0;
1447
return;
1448
}
@@ -1499,7 +1499,7 @@ static inline void cgroup_read_memory(struct memory *mem, char parent_cg_is_unif
1499
unsigned long i, lines = procfile_lines(ff);
1500
1501
if(unlikely(lines < 1)) {
1502
- error("CGROUP: file '%s' should have 1+ lines.", mem->filename_detailed);
1502
+ collector_error("CGROUP: file '%s' should have 1+ lines.", mem->filename_detailed);
1503
mem->updated_detailed = 0;
1504
goto memory_next;
1505
}
@@ -1669,7 +1669,7 @@ static inline void read_cgroup_network_interfaces(struct cgroup *cg) {
1669
FILE *fp_child_input, *fp_child_output;
1670
(void)netdata_popen_raw_default_flags_and_environment(&cgroup_pid, &fp_child_input, &fp_child_output, cgroups_network_interface_script, "--cgroup", cgroup_identifier);
1671
if(!fp_child_output) {
1672
- error("CGROUP: cannot popen(%s --cgroup \"%s\", \"r\").", cgroups_network_interface_script, cgroup_identifier);
1672
+ collector_error("CGROUP: cannot popen(%s --cgroup \"%s\", \"r\").", cgroups_network_interface_script, cgroup_identifier);
1673
return;
1674
}
1675
@@ -1687,12 +1687,12 @@ static inline void read_cgroup_network_interfaces(struct cgroup *cg) {
1687
}
1688
1689
if(!*s) {
1690
- error("CGROUP: empty host interface returned by script");
1690
+ collector_error("CGROUP: empty host interface returned by script");
1691
continue;
1692
}
1693
1694
if(!*t) {
1695
- error("CGROUP: empty guest interface returned by script");
1695
+ collector_error("CGROUP: empty guest interface returned by script");
1696
continue;
1697
}
1698
@@ -1702,7 +1702,7 @@ static inline void read_cgroup_network_interfaces(struct cgroup *cg) {
1702
i->next = cg->interfaces;
1703
cg->interfaces = i;
1704
1705
- info("CGROUP: cgroup '%s' has network interface '%s' as '%s'", cg->id, i->host_device, i->container_device);
1705
+ collector_info("CGROUP: cgroup '%s' has network interface '%s' as '%s'", cg->id, i->host_device, i->container_device);
1706
1707
// register a device rename to proc_net_dev.c
1708
netdev_rename_device_add(
@@ -1875,7 +1875,7 @@ static inline void discovery_rename_cgroup(struct cgroup *cg) {
1875
FILE *fp_child_input, *fp_child_output;
1876
(void)netdata_popen_raw_default_flags_and_environment(&cgroup_pid, &fp_child_input, &fp_child_output, cgroups_rename_script, cg->id, cg->intermediate_id);
1877
if (!fp_child_output) {
1878
- error("CGROUP: cannot popen(%s \"%s\", \"r\").", cgroups_rename_script, cg->intermediate_id);
1878
+ collector_error("CGROUP: cannot popen(%s \"%s\", \"r\").", cgroups_rename_script, cg->intermediate_id);
1879
cg->pending_renames = 0;
1880
cg->processed = 1;
1881
return;
@@ -2034,14 +2034,14 @@ static inline void discovery_find_cgroup_in_dir_callback(const char *dir) {
2034
}
2035
2036
if (cgroup_root_count >= cgroup_root_max) {
2037
- info("CGROUP: maximum number of cgroups reached (%d). Not adding cgroup '%s'", cgroup_root_count, dir);
2037
+ collector_info("CGROUP: maximum number of cgroups reached (%d). Not adding cgroup '%s'", cgroup_root_count, dir);
2038
return;
2039
}
2040
2041
if (cgroup_max_depth > 0) {
2042
int depth = calc_cgroup_depth(dir);
2043
if (depth > cgroup_max_depth) {
2044
- info("CGROUP: '%s' is too deep (%d, while max is %d)", dir, depth, cgroup_max_depth);
2044
+ collector_info("CGROUP: '%s' is too deep (%d, while max is %d)", dir, depth, cgroup_max_depth);
2045
return;
2046
}
2047
}
@@ -2066,7 +2066,7 @@ static inline int discovery_find_dir_in_subdirs(const char *base, const char *th
2066
2067
DIR *dir = opendir(this);
2068
if(!dir) {
2069
- error("CGROUP: cannot read directory '%s'", base);
2069
+ collector_error("CGROUP: cannot read directory '%s'", base);
2070
return ret;
2071
}
2072
ret = 1;
@@ -2550,7 +2550,7 @@ static inline void discovery_find_all_cgroups_v1() {
2550
if (cgroup_enable_cpuacct_stat || cgroup_enable_cpuacct_usage) {
2551
if (discovery_find_dir_in_subdirs(cgroup_cpuacct_base, NULL, discovery_find_cgroup_in_dir_callback) == -1) {
2552
cgroup_enable_cpuacct_stat = cgroup_enable_cpuacct_usage = CONFIG_BOOLEAN_NO;
2553
- error("CGROUP: disabled cpu statistics.");
2553
+ collector_error("CGROUP: disabled cpu statistics.");
2554
}
2555
}
2556
@@ -2560,7 +2560,7 @@ static inline void discovery_find_all_cgroups_v1() {
2560
cgroup_enable_blkio_io = cgroup_enable_blkio_ops = cgroup_enable_blkio_throttle_io =
2561
cgroup_enable_blkio_throttle_ops = cgroup_enable_blkio_merged_ops = cgroup_enable_blkio_queued_ops =
2562
CONFIG_BOOLEAN_NO;
2563
- error("CGROUP: disabled blkio statistics.");
2563
+ collector_error("CGROUP: disabled blkio statistics.");
2564
}
2565
}
2566
@@ -2568,14 +2568,14 @@ static inline void discovery_find_all_cgroups_v1() {
2568
if (discovery_find_dir_in_subdirs(cgroup_memory_base, NULL, discovery_find_cgroup_in_dir_callback) == -1) {
2569
cgroup_enable_memory = cgroup_enable_detailed_memory = cgroup_enable_swap = cgroup_enable_memory_failcnt =
2570
CONFIG_BOOLEAN_NO;
2571
- error("CGROUP: disabled memory statistics.");
2571
+ collector_error("CGROUP: disabled memory statistics.");
2572
}
2573
}
2574
2575
if (cgroup_search_in_devices) {
2576
if (discovery_find_dir_in_subdirs(cgroup_devices_base, NULL, discovery_find_cgroup_in_dir_callback) == -1) {
2577
cgroup_search_in_devices = 0;
2578
- error("CGROUP: disabled devices statistics.");
2578
+ collector_error("CGROUP: disabled devices statistics.");
2579
}
2580
}
2581
}
@@ -2583,7 +2583,7 @@ static inline void discovery_find_all_cgroups_v1() {
2583
static inline void discovery_find_all_cgroups_v2() {
2584
if (discovery_find_dir_in_subdirs(cgroup_unified_base, NULL, discovery_find_cgroup_in_dir_callback) == -1) {
2585
cgroup_unified_exist = CONFIG_BOOLEAN_NO;
2586
- error("CGROUP: disabled unified cgroups statistics.");
2586
+ collector_error("CGROUP: disabled unified cgroups statistics.");
2587
}
2588
}
2589
@@ -2651,7 +2651,7 @@ static int discovery_is_cgroup_duplicate(struct cgroup *cg) {
2651
struct cgroup *c;
2652
for (c = discovered_cgroup_root; c; c = c->discovered_next) {
2653
if (c != cg && c->enabled && c->hash_chart == cg->hash_chart && !strcmp(c->chart_id, cg->chart_id)) {
2654
- error("CGROUP: chart id '%s' already exists with id '%s' and is enabled and available. Disabling cgroup with id '%s'.", cg->chart_id, c->id, cg->id);
2654
+ collector_error("CGROUP: chart id '%s' already exists with id '%s' and is enabled and available. Disabling cgroup with id '%s'.", cg->chart_id, c->id, cg->id);
2655
return 1;
2656
}
2657
}
@@ -2686,7 +2686,7 @@ static inline void discovery_process_cgroup(struct cgroup *cg) {
2686
cg->processed = 1;
2687
2688
if ((strlen(cg->chart_id) + strlen(cgroup_chart_id_prefix)) >= RRD_ID_LENGTH_MAX) {
2689
- info("cgroup '%s' (chart id '%s') disabled because chart_id exceeds the limit (RRD_ID_LENGTH_MAX)", cg->id, cg->chart_id);
2689
+ collector_info("cgroup '%s' (chart id '%s') disabled because chart_id exceeds the limit (RRD_ID_LENGTH_MAX)", cg->id, cg->chart_id);
2690
return;
2691
}
2692
@@ -3573,7 +3573,7 @@ static inline void update_cpu_limits(char **filename, unsigned long long *value,
3573
else ret = -1;
3574
3575
if(ret) {
3576
- error("Cannot refresh cgroup %s cpu limit by reading '%s'. Will not update its limit anymore.", cg->id, *filename);
3576
+ collector_error("Cannot refresh cgroup %s cpu limit by reading '%s'. Will not update its limit anymore.", cg->id, *filename);
3577
freez(*filename);
3578
*filename = NULL;
3579
}
@@ -3597,7 +3597,7 @@ static inline void update_cpu_limits2(struct cgroup *cg) {
3597
unsigned long lines = procfile_lines(ff);
3598
3599
if (unlikely(lines < 1)) {
3600
- error("CGROUP: file '%s' should have 1 lines.", cg->filename_cpu_cfs_quota);
3600
+ collector_error("CGROUP: file '%s' should have 1 lines.", cg->filename_cpu_cfs_quota);
3601
return;
3602
}
3603
@@ -3614,7 +3614,7 @@ static inline void update_cpu_limits2(struct cgroup *cg) {
3614
return;
3615
3616
cpu_limits2_err:
3617
- error("Cannot refresh cgroup %s cpu limit by reading '%s'. Will not update its limit anymore.", cg->id, cg->filename_cpu_cfs_quota);
3617
+ collector_error("Cannot refresh cgroup %s cpu limit by reading '%s'. Will not update its limit anymore.", cg->id, cg->filename_cpu_cfs_quota);
3618
freez(cg->filename_cpu_cfs_quota);
3619
cg->filename_cpu_cfs_quota = NULL;
3620
@@ -3626,7 +3626,7 @@ static inline int update_memory_limits(char **filename, const RRDSETVAR_ACQUIRED
3626
if(unlikely(!*chart_var)) {
3627
*chart_var = rrdsetvar_custom_chart_variable_add_and_acquire(cg->st_mem_usage, chart_var_name);
3628
if(!*chart_var) {
3629
- error("Cannot create cgroup %s chart variable '%s'. Will not update its limit anymore.", cg->id, chart_var_name);
3629
+ collector_error("Cannot create cgroup %s chart variable '%s'. Will not update its limit anymore.", cg->id, chart_var_name);
3630
freez(*filename);
3631
*filename = NULL;
3632
}
@@ -3635,7 +3635,7 @@ static inline int update_memory_limits(char **filename, const RRDSETVAR_ACQUIRED
3635
if(*filename && *chart_var) {
3636
if(!(cg->options & CGROUP_OPTIONS_IS_UNIFIED)) {
3637
if(read_single_number_file(*filename, value)) {
3638
- error("Cannot refresh cgroup %s memory limit by reading '%s'. Will not update its limit anymore.", cg->id, *filename);
3638
+ collector_error("Cannot refresh cgroup %s memory limit by reading '%s'. Will not update its limit anymore.", cg->id, *filename);
3639
freez(*filename);
3640
*filename = NULL;
3641
}
@@ -3647,7 +3647,7 @@ static inline int update_memory_limits(char **filename, const RRDSETVAR_ACQUIRED
3647
char buffer[30 + 1];
3648
int ret = read_file(*filename, buffer, 30);
3649
if(ret) {
3650
- error("Cannot refresh cgroup %s memory limit by reading '%s'. Will not update its limit anymore.", cg->id, *filename);
3650
+ collector_error("Cannot refresh cgroup %s memory limit by reading '%s'. Will not update its limit anymore.", cg->id, *filename);
3651
freez(*filename);
3652
*filename = NULL;
3653
return 0;
@@ -3756,7 +3756,7 @@ void update_cgroup_charts(int update_every) {
3756
if(unlikely(!cg->chart_var_cpu_limit)) {
3757
cg->chart_var_cpu_limit = rrdsetvar_custom_chart_variable_add_and_acquire(cg->st_cpu, "cpu_limit");
3758
if(!cg->chart_var_cpu_limit) {
3759
- error("Cannot create cgroup %s chart variable 'cpu_limit'. Will not update its limit anymore.", cg->id);
3759
+ collector_error("Cannot create cgroup %s chart variable 'cpu_limit'. Will not update its limit anymore.", cg->id);
3760
if(cg->filename_cpuset_cpus) freez(cg->filename_cpuset_cpus);
3761
cg->filename_cpuset_cpus = NULL;
3762
if(cg->filename_cpu_cfs_period) freez(cg->filename_cpu_cfs_period);
@@ -4148,7 +4148,7 @@ void update_cgroup_charts(int update_every) {
4148
if(likely(ff && procfile_lines(ff) && !strncmp(procfile_word(ff, 0), "MemTotal", 8)))
4149
ram_total = str2ull(procfile_word(ff, 1)) * 1024;
4150
else {
4151
- error("Cannot read file %s. Will not update cgroup %s RAM limit anymore.", filename, cg->id);
4151
+ collector_error("Cannot read file %s. Will not update cgroup %s RAM limit anymore.", filename, cg->id);
4152
freez(cg->filename_memory_limit);
4153
cg->filename_memory_limit = NULL;
4154
}
@@ -4782,19 +4782,19 @@ static void cgroup_main_cleanup(void *ptr) {
4782
struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
4783
static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
4784
4785
- info("cleaning up...");
4785
+ collector_info("cleaning up...");
4786
4787
usec_t max = 2 * USEC_PER_SEC, step = 50000;
4788
4789
if (!discovery_thread.exited) {
4790
- info("stopping discovery thread worker");
4790
+ collector_info("stopping discovery thread worker");
4791
uv_mutex_lock(&discovery_thread.mutex);
4792
discovery_thread.start_discovery = 1;
4793
uv_cond_signal(&discovery_thread.cond_var);
4794
uv_mutex_unlock(&discovery_thread.mutex);
4795
}
4796
4797
- info("waiting for discovery thread to finish...");
4797
+ collector_info("waiting for discovery thread to finish...");
4798
4799
while (!discovery_thread.exited && max > 0) {
4800
max -= step;
@@ -4833,7 +4833,7 @@ void *cgroups_main(void *ptr) {
4833
netdata_cgroup_ebpf_initialize_shm();
4834
4835
if (uv_mutex_init(&cgroup_root_mutex)) {
4836
- error("CGROUP: cannot initialize mutex for the main cgroup list");
4836
+ collector_error("CGROUP: cannot initialize mutex for the main cgroup list");
4837
goto exit;
4838
}
4839
@@ -4842,17 +4842,17 @@ void *cgroups_main(void *ptr) {
4842
discovery_thread.exited = 0;
4843
4844
if (uv_mutex_init(&discovery_thread.mutex)) {
4845
- error("CGROUP: cannot initialize mutex for discovery thread");
4845
+ collector_error("CGROUP: cannot initialize mutex for discovery thread");
4846
goto exit;
4847
}
4848
if (uv_cond_init(&discovery_thread.cond_var)) {
4849
- error("CGROUP: cannot initialize conditional variable for discovery thread");
4849
+ collector_error("CGROUP: cannot initialize conditional variable for discovery thread");
4850
goto exit;
4851
}
4852
4853
int error = uv_thread_create(&discovery_thread.thread, cgroup_discovery_worker, NULL);
4854
if (error) {
4855
- error("CGROUP: cannot create thread worker. uv_thread_create(): %s", uv_strerror(error));
4855
+ collector_error("CGROUP: cannot create thread worker. uv_thread_create(): %s", uv_strerror(error));
4856
goto exit;
4857
}
4858
uv_thread_set_name_np(discovery_thread.thread, "PLUGIN[cgroups]");
collectors/cups.plugin/cups_plugin.c
+1
@@ -222,6 +222,7 @@ void reset_metrics() {
222
}
223
224
int main(int argc, char **argv) {
225
+ stderror = stderr;
226
clocks_init();
227
228
// ------------------------------------------------------------------------
collectors/diskspace.plugin/plugin_diskspace.c
+28
-28
@@ -181,7 +181,7 @@ static void calculate_values_and_show_charts(
181
182
#ifdef NETDATA_INTERNAL_CHECKS
183
if(unlikely(btotal != bavail + breserved_root + bused))
184
- error("DISKSPACE: disk block statistics for '%s' (disk '%s') do not sum up: total = %llu, available = %llu, reserved = %llu, used = %llu", mi->mount_point, disk, (unsigned long long)btotal, (unsigned long long)bavail, (unsigned long long)breserved_root, (unsigned long long)bused);
184
+ collector_error("DISKSPACE: disk block statistics for '%s' (disk '%s') do not sum up: total = %llu, available = %llu, reserved = %llu, used = %llu", mi->mount_point, disk, (unsigned long long)btotal, (unsigned long long)bavail, (unsigned long long)breserved_root, (unsigned long long)bused);
185
#endif
186
187
// --------------------------------------------------------------------------
@@ -200,7 +200,7 @@ static void calculate_values_and_show_charts(
200
201
#ifdef NETDATA_INTERNAL_CHECKS
202
if(unlikely(btotal != bavail + breserved_root + bused))
203
- error("DISKSPACE: disk inode statistics for '%s' (disk '%s') do not sum up: total = %llu, available = %llu, reserved = %llu, used = %llu", mi->mount_point, disk, (unsigned long long)ftotal, (unsigned long long)favail, (unsigned long long)freserved_root, (unsigned long long)fused);
203
+ collector_error("DISKSPACE: disk inode statistics for '%s' (disk '%s') do not sum up: total = %llu, available = %llu, reserved = %llu, used = %llu", mi->mount_point, disk, (unsigned long long)ftotal, (unsigned long long)favail, (unsigned long long)freserved_root, (unsigned long long)fused);
204
#endif
205
206
int rendered = 0;
@@ -348,23 +348,23 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) {
348
struct stat bs;
349
350
if(stat(mi->mount_point, &bs) == -1) {
351
- error("DISKSPACE: Cannot stat() mount point '%s' (disk '%s', filesystem '%s', root '%s')."
352
- , mi->mount_point
353
- , disk
354
- , mi->filesystem?mi->filesystem:""
355
- , mi->root?mi->root:""
356
- );
351
+ collector_error("DISKSPACE: Cannot stat() mount point '%s' (disk '%s', filesystem '%s', root '%s')."
352
+ , mi->mount_point
353
+ , disk
354
+ , mi->filesystem?mi->filesystem:""
355
+ , mi->root?mi->root:""
356
+ );
357
def_space = CONFIG_BOOLEAN_NO;
358
def_inodes = CONFIG_BOOLEAN_NO;
359
}
360
else {
361
if((bs.st_mode & S_IFMT) != S_IFDIR) {
362
- error("DISKSPACE: Mount point '%s' (disk '%s', filesystem '%s', root '%s') is not a directory."
363
- , mi->mount_point
364
- , disk
365
- , mi->filesystem?mi->filesystem:""
366
- , mi->root?mi->root:""
367
- );
362
+ collector_error("DISKSPACE: Mount point '%s' (disk '%s', filesystem '%s', root '%s') is not a directory."
363
+ , mi->mount_point
364
+ , disk
365
+ , mi->filesystem?mi->filesystem:""
366
+ , mi->root?mi->root:""
367
+ );
368
def_space = CONFIG_BOOLEAN_NO;
369
def_inodes = CONFIG_BOOLEAN_NO;
370
}
@@ -430,12 +430,12 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) {
430
431
if (statvfs(mi->mount_point, &buff_statvfs) < 0) {
432
if(!m->shown_error) {
433
- error("DISKSPACE: failed to statvfs() mount point '%s' (disk '%s', filesystem '%s', root '%s')"
434
- , mi->mount_point
435
- , disk
436
- , mi->filesystem?mi->filesystem:""
437
- , mi->root?mi->root:""
438
- );
433
+ collector_error("DISKSPACE: failed to statvfs() mount point '%s' (disk '%s', filesystem '%s', root '%s')"
434
+ , mi->mount_point
435
+ , disk
436
+ , mi->filesystem?mi->filesystem:""
437
+ , mi->root?mi->root:""
438
+ );
439
m->shown_error = 1;
440
}
441
return;
@@ -463,12 +463,12 @@ static inline void do_slow_disk_space_stats(struct basic_mountinfo *mi, int upda
463
struct statvfs buff_statvfs;
464
if (statvfs(mi->mount_point, &buff_statvfs) < 0) {
465
if(!m->shown_error) {
466
- error("DISKSPACE: failed to statvfs() mount point '%s' (disk '%s', filesystem '%s', root '%s')"
467
- , mi->mount_point
468
- , mi->persistent_id
469
- , mi->filesystem?mi->filesystem:""
470
- , mi->root?mi->root:""
471
- );
466
+ collector_error("DISKSPACE: failed to statvfs() mount point '%s' (disk '%s', filesystem '%s', root '%s')"
467
+ , mi->mount_point
468
+ , mi->persistent_id
469
+ , mi->filesystem?mi->filesystem:""
470
+ , mi->root?mi->root:""
471
+ );
472
m->shown_error = 1;
473
}
474
return;
@@ -482,7 +482,7 @@ static void diskspace_slow_worker_cleanup(void *ptr)
482
{
483
UNUSED(ptr);
484
485
- info("cleaning up...");
485
+ collector_info("cleaning up...");
486
487
worker_unregister();
488
}
@@ -583,7 +583,7 @@ static void diskspace_main_cleanup(void *ptr) {
583
struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
584
static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
585
586
- info("cleaning up...");
586
+ collector_info("cleaning up...");
587
588
if (diskspace_slow_thread) {
589
netdata_thread_join(*diskspace_slow_thread, NULL);
collectors/ebpf.plugin/ebpf.c
+1
@@ -2165,6 +2165,7 @@ static void ebpf_manage_pid(pid_t pid)
2165
*/
2166
int main(int argc, char **argv)
2167
{
2168
+ stderror = stderr;
2169
clocks_init();
2170
main_thread_id = gettid();
2171
collectors/freebsd.plugin/freebsd_devstat.c
+12
-12
@@ -116,7 +116,7 @@ static void disks_cleanup() {
116
struct disk *dm = disks_root, *last = NULL;
117
while(dm) {
118
if (unlikely(!dm->updated)) {
119
- // info("Removing disk '%s', linked after '%s'", dm->name, last?last->name:"ROOT");
119
+ // collector_info("Removing disk '%s', linked after '%s'", dm->name, last?last->name:"ROOT");
120
121
if (disks_last_used == dm)
122
disks_last_used = last;
@@ -728,28 +728,28 @@ int do_kern_devstat(int update_every, usec_t dt) {
728
729
if (unlikely(common_error)) {
730
do_system_io = 0;
731
- error("DISABLED: system.io chart");
731
+ collector_error("DISABLED: system.io chart");
732
do_io = 0;
733
- error("DISABLED: disk.* charts");
733
+ collector_error("DISABLED: disk.* charts");
734
do_ops = 0;
735
- error("DISABLED: disk_ops.* charts");
735
+ collector_error("DISABLED: disk_ops.* charts");
736
do_qops = 0;
737
- error("DISABLED: disk_qops.* charts");
737
+ collector_error("DISABLED: disk_qops.* charts");
738
do_util = 0;
739
- error("DISABLED: disk_util.* charts");
739
+ collector_error("DISABLED: disk_util.* charts");
740
do_iotime = 0;
741
- error("DISABLED: disk_iotime.* charts");
741
+ collector_error("DISABLED: disk_iotime.* charts");
742
do_await = 0;
743
- error("DISABLED: disk_await.* charts");
743
+ collector_error("DISABLED: disk_await.* charts");
744
do_avagsz = 0;
745
- error("DISABLED: disk_avgsz.* charts");
745
+ collector_error("DISABLED: disk_avgsz.* charts");
746
do_svctm = 0;
747
- error("DISABLED: disk_svctm.* charts");
748
- error("DISABLED: kern.devstat module");
747
+ collector_error("DISABLED: disk_svctm.* charts");
748
+ collector_error("DISABLED: kern.devstat module");
749
return 1;
750
}
751
} else {
752
- error("DISABLED: kern.devstat module");
752
+ collector_error("DISABLED: kern.devstat module");
753
return 1;
754
}
755
collectors/freebsd.plugin/freebsd_getifaddrs.c
+13
-13
@@ -73,7 +73,7 @@ static void network_interfaces_cleanup() {
73
struct cgroup_network_interface *ifm = network_interfaces_root, *last = NULL;
74
while(ifm) {
75
if (unlikely(!ifm->updated)) {
76
- // info("Removing network interface '%s', linked after '%s'", ifm->name, last?last->name:"ROOT");
76
+ // collector_info("Removing network interface '%s', linked after '%s'", ifm->name, last?last->name:"ROOT");
77
78
if (network_interfaces_last_used == ifm)
79
network_interfaces_last_used = last;
@@ -193,26 +193,26 @@ int do_getifaddrs(int update_every, usec_t dt) {
193
struct ifaddrs *ifap;
194
195
if (unlikely(getifaddrs(&ifap))) {
196
- error("FREEBSD: getifaddrs() failed");
196
+ collector_error("FREEBSD: getifaddrs() failed");
197
do_bandwidth_net = 0;
198
- error("DISABLED: system.net chart");
198
+ collector_error("DISABLED: system.net chart");
199
do_packets_net = 0;
200
- error("DISABLED: system.packets chart");
200
+ collector_error("DISABLED: system.packets chart");
201
do_bandwidth_ipv4 = 0;
202
- error("DISABLED: system.ipv4 chart");
202
+ collector_error("DISABLED: system.ipv4 chart");
203
do_bandwidth_ipv6 = 0;
204
- error("DISABLED: system.ipv6 chart");
204
+ collector_error("DISABLED: system.ipv6 chart");
205
do_bandwidth = 0;
206
- error("DISABLED: net.* charts");
206
+ collector_error("DISABLED: net.* charts");
207
do_packets = 0;
208
- error("DISABLED: net_packets.* charts");
208
+ collector_error("DISABLED: net_packets.* charts");
209
do_errors = 0;
210
- error("DISABLED: net_errors.* charts");
210
+ collector_error("DISABLED: net_errors.* charts");
211
do_drops = 0;
212
- error("DISABLED: net_drops.* charts");
212
+ collector_error("DISABLED: net_drops.* charts");
213
do_events = 0;
214
- error("DISABLED: net_events.* charts");
215
- error("DISABLED: getifaddrs module");
214
+ collector_error("DISABLED: net_events.* charts");
215
+ collector_error("DISABLED: getifaddrs module");
216
return 1;
217
} else {
218
#define IFA_DATA(s) (((struct if_data *)ifa->ifa_data)->ifi_ ## s)
@@ -589,7 +589,7 @@ int do_getifaddrs(int update_every, usec_t dt) {
589
freeifaddrs(ifap);
590
}
591
} else {
592
- error("DISABLED: getifaddrs module");
592
+ collector_error("DISABLED: getifaddrs module");
593
return 1;
594
}
595
collectors/freebsd.plugin/freebsd_getmntinfo.c
+6
-6
@@ -54,7 +54,7 @@ static void mount_points_cleanup() {
54
struct mount_point *m = mount_points_root, *last = NULL;
55
while(m) {
56
if (unlikely(!m->updated)) {
57
- // info("Removing mount point '%s', linked after '%s'", m->name, last?last->name:"ROOT");
57
+ // collector_info("Removing mount point '%s', linked after '%s'", m->name, last?last->name:"ROOT");
58
59
if (mount_points_last_used == m)
60
mount_points_last_used = last;
@@ -163,12 +163,12 @@ int do_getmntinfo(int update_every, usec_t dt) {
163
164
// there is no mount info in sysctl MIBs
165
if (unlikely(!(mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)))) {
166
- error("FREEBSD: getmntinfo() failed");
166
+ collector_error("FREEBSD: getmntinfo() failed");
167
do_space = 0;
168
- error("DISABLED: disk_space.* charts");
168
+ collector_error("DISABLED: disk_space.* charts");
169
do_inodes = 0;
170
- error("DISABLED: disk_inodes.* charts");
171
- error("DISABLED: getmntinfo module");
170
+ collector_error("DISABLED: disk_inodes.* charts");
171
+ collector_error("DISABLED: getmntinfo module");
172
return 1;
173
} else {
174
int i;
@@ -289,7 +289,7 @@ int do_getmntinfo(int update_every, usec_t dt) {
289
}
290
}
291
} else {
292
- error("DISABLED: getmntinfo module");
292
+ collector_error("DISABLED: getmntinfo module");
293
return 1;
294
}
295
collectors/freebsd.plugin/freebsd_ipfw.c
+10
-10
@@ -6,11 +6,11 @@
6
7
#define FREE_MEM_THRESHOLD 10000 // number of unused chunks that trigger memory freeing
8
9
-#define COMMON_IPFW_ERROR() error("DISABLED: ipfw.packets chart"); \
10
- error("DISABLED: ipfw.bytes chart"); \
11
- error("DISABLED: ipfw.dyn_active chart"); \
12
- error("DISABLED: ipfw.dyn_expired chart"); \
13
- error("DISABLED: ipfw.mem chart");
9
+#define COMMON_IPFW_ERROR() collector_error("DISABLED: ipfw.packets chart"); \
10
+ collector_error("DISABLED: ipfw.bytes chart"); \
11
+ collector_error("DISABLED: ipfw.dyn_active chart"); \
12
+ collector_error("DISABLED: ipfw.dyn_expired chart"); \
13
+ collector_error("DISABLED: ipfw.mem chart");
14
15
// --------------------------------------------------------------------------------------------------------------------
16
// ipfw
@@ -83,8 +83,8 @@ int do_ipfw(int update_every, usec_t dt) {
83
if (unlikely(ipfw_socket == -1))
84
ipfw_socket = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
85
if (unlikely(ipfw_socket == -1)) {
86
- error("FREEBSD: can't get socket for ipfw configuration");
87
- error("FREEBSD: run netdata as root to get access to ipfw data");
86
+ collector_error("FREEBSD: can't get socket for ipfw configuration");
87
+ collector_error("FREEBSD: run netdata as root to get access to ipfw data");
88
COMMON_IPFW_ERROR();
89
return 1;
90
}
@@ -100,7 +100,7 @@ int do_ipfw(int update_every, usec_t dt) {
100
error = getsockopt(ipfw_socket, IPPROTO_IP, IP_FW3, op3, optlen);
101
if (error)
102
if (errno != ENOMEM) {
103
- error("FREEBSD: ipfw socket reading error");
103
+ collector_error("FREEBSD: ipfw socket reading error");
104
COMMON_IPFW_ERROR();
105
return 1;
106
}
@@ -113,7 +113,7 @@ int do_ipfw(int update_every, usec_t dt) {
113
op3->opcode = IP_FW_XGET;
114
error = getsockopt(ipfw_socket, IPPROTO_IP, IP_FW3, op3, optlen);
115
if (error) {
116
- error("FREEBSD: ipfw socket reading error");
116
+ collector_error("FREEBSD: ipfw socket reading error");
117
COMMON_IPFW_ERROR();
118
return 1;
119
}
@@ -352,7 +352,7 @@ int do_ipfw(int update_every, usec_t dt) {
352
353
return 0;
354
#else
355
- error("FREEBSD: ipfw charts supported for FreeBSD 11.0 and newer releases only");
355
+ collector_error("FREEBSD: ipfw charts supported for FreeBSD 11.0 and newer releases only");
356
COMMON_IPFW_ERROR();
357
return 1;
358
#endif
collectors/freebsd.plugin/freebsd_kstat_zfs.c
+3
-3
@@ -238,9 +238,9 @@ int do_kstat_zfs_misc_zio_trim(int update_every, usec_t dt) {
238
GETSYSCTL_SIMPLE("kstat.zfs.misc.zio_trim.success", mib_success, success) ||
239
GETSYSCTL_SIMPLE("kstat.zfs.misc.zio_trim.failed", mib_failed, failed) ||
240
GETSYSCTL_SIMPLE("kstat.zfs.misc.zio_trim.unsupported", mib_unsupported, unsupported))) {
241
- error("DISABLED: zfs.trim_bytes chart");
242
- error("DISABLED: zfs.trim_success chart");
243
- error("DISABLED: kstat.zfs.misc.zio_trim module");
241
+ collector_error("DISABLED: zfs.trim_bytes chart");
242
+ collector_error("DISABLED: zfs.trim_success chart");
243
+ collector_error("DISABLED: kstat.zfs.misc.zio_trim module");
244
return 1;
245
} else {
246
collectors/freebsd.plugin/freebsd_sysctl.c
+124
-124
@@ -96,17 +96,17 @@ int freebsd_plugin_init()
96
{
97
system_pagesize = getpagesize();
98
if (system_pagesize <= 0) {
99
- error("FREEBSD: can't get system page size");
99
+ collector_error("FREEBSD: can't get system page size");
100
return 1;
101
}
102
103
if (unlikely(GETSYSCTL_BY_NAME("kern.smp.cpus", number_of_cpus))) {
104
- error("FREEBSD: can't get number of cpus");
104
+ collector_error("FREEBSD: can't get number of cpus");
105
return 1;
106
}
107
108
if (unlikely(!number_of_cpus)) {
109
- error("FREEBSD: wrong number of cpus");
109
+ collector_error("FREEBSD: wrong number of cpus");
110
return 1;
111
}
112
@@ -126,8 +126,8 @@ int do_vm_loadavg(int update_every, usec_t dt){
126
struct loadavg sysload;
127
128
if (unlikely(GETSYSCTL_SIMPLE("vm.loadavg", mib, sysload))) {
129
- error("DISABLED: system.load chart");
130
- error("DISABLED: vm.loadavg module");
129
+ collector_error("DISABLED: system.load chart");
130
+ collector_error("DISABLED: vm.loadavg module");
131
return 1;
132
} else {
133
static RRDSET *st = NULL;
@@ -185,12 +185,12 @@ int do_vm_vmtotal(int update_every, usec_t dt) {
185
186
if (unlikely(GETSYSCTL_SIMPLE("vm.vmtotal", mib, vmtotal_data))) {
187
do_all_processes = 0;
188
- error("DISABLED: system.active_processes chart");
188
+ collector_error("DISABLED: system.active_processes chart");
189
do_processes = 0;
190
- error("DISABLED: system.processes chart");
190
+ collector_error("DISABLED: system.processes chart");
191
do_mem_real = 0;
192
- error("DISABLED: mem.real chart");
193
- error("DISABLED: vm.vmtotal module");
192
+ collector_error("DISABLED: mem.real chart");
193
+ collector_error("DISABLED: vm.vmtotal module");
194
return 1;
195
} else {
196
if (likely(do_all_processes)) {
@@ -277,7 +277,7 @@ int do_vm_vmtotal(int update_every, usec_t dt) {
277
}
278
}
279
} else {
280
- error("DISABLED: vm.vmtotal module");
280
+ collector_error("DISABLED: vm.vmtotal module");
281
return 1;
282
}
283
@@ -290,17 +290,17 @@ int do_kern_cp_time(int update_every, usec_t dt) {
290
(void)dt;
291
292
if (unlikely(CPUSTATES != 5)) {
293
- error("FREEBSD: There are %d CPU states (5 was expected)", CPUSTATES);
294
- error("DISABLED: system.cpu chart");
295
- error("DISABLED: kern.cp_time module");
293
+ collector_error("FREEBSD: There are %d CPU states (5 was expected)", CPUSTATES);
294
+ collector_error("DISABLED: system.cpu chart");
295
+ collector_error("DISABLED: kern.cp_time module");
296
return 1;
297
} else {
298
static int mib[2] = {0, 0};
299
long cp_time[CPUSTATES];
300
301
if (unlikely(GETSYSCTL_SIMPLE("kern.cp_time", mib, cp_time))) {
302
- error("DISABLED: system.cpu chart");
303
- error("DISABLED: kern.cp_time module");
302
+ collector_error("DISABLED: system.cpu chart");
303
+ collector_error("DISABLED: kern.cp_time module");
304
return 1;
305
} else {
306
static RRDSET *st = NULL;
@@ -348,9 +348,9 @@ int do_kern_cp_times(int update_every, usec_t dt) {
348
(void)dt;
349
350
if (unlikely(CPUSTATES != 5)) {
351
- error("FREEBSD: There are %d CPU states (5 was expected)", CPUSTATES);
352
- error("DISABLED: cpu.cpuXX charts");
353
- error("DISABLED: kern.cp_times module");
351
+ collector_error("FREEBSD: There are %d CPU states (5 was expected)", CPUSTATES);
352
+ collector_error("DISABLED: cpu.cpuXX charts");
353
+ collector_error("DISABLED: kern.cp_times module");
354
return 1;
355
} else {
356
static int mib[2] = {0, 0};
@@ -361,8 +361,8 @@ int do_kern_cp_times(int update_every, usec_t dt) {
361
if(unlikely(number_of_cpus != old_number_of_cpus))
362
pcpu_cp_time = reallocz(pcpu_cp_time, sizeof(cp_time) * number_of_cpus);
363
if (unlikely(GETSYSCTL_WSIZE("kern.cp_times", mib, pcpu_cp_time, sizeof(cp_time) * number_of_cpus))) {
364
- error("DISABLED: cpu.cpuXX charts");
365
- error("DISABLED: kern.cp_times module");
364
+ collector_error("DISABLED: cpu.cpuXX charts");
365
+ collector_error("DISABLED: kern.cp_times module");
366
return 1;
367
} else {
368
int i;
@@ -449,8 +449,8 @@ int do_dev_cpu_temperature(int update_every, usec_t dt) {
449
if (unlikely(!(mib[i * 4])))
450
sprintf(char_mib, "dev.cpu.%d.temperature", i);
451
if (unlikely(getsysctl_simple(char_mib, &mib[i * 4], 4, &pcpu_temperature[i], sizeof(int)))) {
452
- error("DISABLED: cpu.temperature chart");
453
- error("DISABLED: dev.cpu.temperature module");
452
+ collector_error("DISABLED: cpu.temperature chart");
453
+ collector_error("DISABLED: dev.cpu.temperature module");
454
return 1;
455
}
456
}
@@ -505,8 +505,8 @@ int do_dev_cpu_0_freq(int update_every, usec_t dt) {
505
int cpufreq;
506
507
if (unlikely(GETSYSCTL_SIMPLE("dev.cpu.0.freq", mib, cpufreq))) {
508
- error("DISABLED: cpu.scaling_cur_freq chart");
509
- error("DISABLED: dev.cpu.0.freq module");
508
+ collector_error("DISABLED: cpu.scaling_cur_freq chart");
509
+ collector_error("DISABLED: dev.cpu.0.freq module");
510
return 1;
511
} else {
512
static RRDSET *st = NULL;
@@ -547,9 +547,9 @@ int do_hw_intcnt(int update_every, usec_t dt) {
547
size_t intrcnt_size = 0;
548
549
if (unlikely(GETSYSCTL_SIZE("hw.intrcnt", mib_hw_intrcnt, intrcnt_size))) {
550
- error("DISABLED: system.intr chart");
551
- error("DISABLED: system.interrupts chart");
552
- error("DISABLED: hw.intrcnt module");
550
+ collector_error("DISABLED: system.intr chart");
551
+ collector_error("DISABLED: system.interrupts chart");
552
+ collector_error("DISABLED: hw.intrcnt module");
553
return 1;
554
} else {
555
unsigned long nintr = 0;
@@ -560,9 +560,9 @@ int do_hw_intcnt(int update_every, usec_t dt) {
560
if (unlikely(nintr != old_nintr))
561
intrcnt = reallocz(intrcnt, nintr * sizeof(u_long));
562
if (unlikely(GETSYSCTL_WSIZE("hw.intrcnt", mib_hw_intrcnt, intrcnt, nintr * sizeof(u_long)))) {
563
- error("DISABLED: system.intr chart");
564
- error("DISABLED: system.interrupts chart");
565
- error("DISABLED: hw.intrcnt module");
563
+ collector_error("DISABLED: system.intr chart");
564
+ collector_error("DISABLED: system.interrupts chart");
565
+ collector_error("DISABLED: hw.intrcnt module");
566
return 1;
567
} else {
568
unsigned long long totalintr = 0;
@@ -602,17 +602,17 @@ int do_hw_intcnt(int update_every, usec_t dt) {
602
static char *intrnames = NULL;
603
604
if (unlikely(GETSYSCTL_SIZE("hw.intrnames", mib_hw_intrnames, size))) {
605
- error("DISABLED: system.intr chart");
606
- error("DISABLED: system.interrupts chart");
607
- error("DISABLED: hw.intrcnt module");
605
+ collector_error("DISABLED: system.intr chart");
606
+ collector_error("DISABLED: system.interrupts chart");
607
+ collector_error("DISABLED: hw.intrcnt module");
608
return 1;
609
} else {
610
if (unlikely(nintr != old_nintr))
611
intrnames = reallocz(intrnames, size);
612
if (unlikely(GETSYSCTL_WSIZE("hw.intrnames", mib_hw_intrnames, intrnames, size))) {
613
- error("DISABLED: system.intr chart");
614
- error("DISABLED: system.interrupts chart");
615
- error("DISABLED: hw.intrcnt module");
613
+ collector_error("DISABLED: system.intr chart");
614
+ collector_error("DISABLED: system.interrupts chart");
615
+ collector_error("DISABLED: hw.intrcnt module");
616
return 1;
617
} else {
618
static RRDSET *st_interrupts = NULL;
@@ -666,8 +666,8 @@ int do_vm_stats_sys_v_intr(int update_every, usec_t dt) {
666
u_int int_number;
667
668
if (unlikely(GETSYSCTL_SIMPLE("vm.stats.sys.v_intr", mib, int_number))) {
669
- error("DISABLED: system.dev_intr chart");
670
- error("DISABLED: vm.stats.sys.v_intr module");
669
+ collector_error("DISABLED: system.dev_intr chart");
670
+ collector_error("DISABLED: vm.stats.sys.v_intr module");
671
return 1;
672
} else {
673
static RRDSET *st = NULL;
@@ -707,8 +707,8 @@ int do_vm_stats_sys_v_soft(int update_every, usec_t dt) {
707
u_int soft_intr_number;
708
709
if (unlikely(GETSYSCTL_SIMPLE("vm.stats.sys.v_soft", mib, soft_intr_number))) {
710
- error("DISABLED: system.dev_intr chart");
711
- error("DISABLED: vm.stats.sys.v_soft module");
710
+ collector_error("DISABLED: system.dev_intr chart");
711
+ collector_error("DISABLED: vm.stats.sys.v_soft module");
712
return 1;
713
} else {
714
static RRDSET *st = NULL;
@@ -748,8 +748,8 @@ int do_vm_stats_sys_v_swtch(int update_every, usec_t dt) {
748
u_int ctxt_number;
749
750
if (unlikely(GETSYSCTL_SIMPLE("vm.stats.sys.v_swtch", mib, ctxt_number))) {
751
- error("DISABLED: system.ctxt chart");
752
- error("DISABLED: vm.stats.sys.v_swtch module");
751
+ collector_error("DISABLED: system.ctxt chart");
752
+ collector_error("DISABLED: vm.stats.sys.v_swtch module");
753
return 1;
754
} else {
755
static RRDSET *st = NULL;
@@ -789,8 +789,8 @@ int do_vm_stats_sys_v_forks(int update_every, usec_t dt) {
789
u_int forks_number;
790
791
if (unlikely(GETSYSCTL_SIMPLE("vm.stats.vm.v_forks", mib, forks_number))) {
792
- error("DISABLED: system.forks chart");
793
- error("DISABLED: vm.stats.sys.v_swtch module");
792
+ collector_error("DISABLED: system.forks chart");
793
+ collector_error("DISABLED: vm.stats.sys.v_swtch module");
794
return 1;
795
} else {
796
@@ -834,8 +834,8 @@ int do_vm_swap_info(int update_every, usec_t dt) {
834
static int mib[3] = {0, 0, 0};
835
836
if (unlikely(getsysctl_mib("vm.swap_info", mib, 2))) {
837
- error("DISABLED: system.swap chart");
838
- error("DISABLED: vm.swap_info module");
837
+ collector_error("DISABLED: system.swap chart");
838
+ collector_error("DISABLED: vm.swap_info module");
839
return 1;
840
} else {
841
int i;
@@ -852,15 +852,15 @@ int do_vm_swap_info(int update_every, usec_t dt) {
852
size = sizeof(xsw);
853
if (unlikely(sysctl(mib, 3, &xsw, &size, NULL, 0) == -1 )) {
854
if (unlikely(errno != ENOENT)) {
855
- error("FREEBSD: sysctl(%s...) failed: %s", "vm.swap_info", strerror(errno));
856
- error("DISABLED: system.swap chart");
857
- error("DISABLED: vm.swap_info module");
855
+ collector_error("FREEBSD: sysctl(%s...) failed: %s", "vm.swap_info", strerror(errno));
856
+ collector_error("DISABLED: system.swap chart");
857
+ collector_error("DISABLED: vm.swap_info module");
858
return 1;
859
} else {
860
if (unlikely(size != sizeof(xsw))) {
861
- error("FREEBSD: sysctl(%s...) expected %lu, got %lu", "vm.swap_info", (unsigned long)sizeof(xsw), (unsigned long)size);
862
- error("DISABLED: system.swap chart");
863
- error("DISABLED: vm.swap_info module");
861
+ collector_error("FREEBSD: sysctl(%s...) expected %lu, got %lu", "vm.swap_info", (unsigned long)sizeof(xsw), (unsigned long)size);
862
+ collector_error("DISABLED: system.swap chart");
863
+ collector_error("DISABLED: vm.swap_info module");
864
return 1;
865
} else break;
866
}
@@ -932,8 +932,8 @@ int do_system_ram(int update_every, usec_t dt) {
932
#endif
933
GETSYSCTL_SIMPLE("vfs.bufspace", mib_vfs_bufspace, vfs_bufspace_count) ||
934
GETSYSCTL_SIMPLE("vm.stats.vm.v_free_count", mib_free_count, vmmeter_data.v_free_count))) {
935
- error("DISABLED: system.ram chart");
936
- error("DISABLED: system.ram module");
935
+ collector_error("DISABLED: system.ram chart");
936
+ collector_error("DISABLED: system.ram module");
937
return 1;
938
} else {
939
static RRDSET *st = NULL, *st_mem_available = NULL;
@@ -1026,8 +1026,8 @@ int do_vm_stats_sys_v_swappgs(int update_every, usec_t dt) {
1026
1027
if (unlikely(GETSYSCTL_SIMPLE("vm.stats.vm.v_swappgsin", mib_swappgsin, vmmeter_data.v_swappgsin) ||
1028
GETSYSCTL_SIMPLE("vm.stats.vm.v_swappgsout", mib_swappgsout, vmmeter_data.v_swappgsout))) {
1029
- error("DISABLED: system.swapio chart");
1030
- error("DISABLED: vm.stats.vm.v_swappgs module");
1029
+ collector_error("DISABLED: system.swapio chart");
1030
+ collector_error("DISABLED: vm.stats.vm.v_swappgs module");
1031
return 1;
1032
} else {
1033
static RRDSET *st = NULL;
@@ -1074,8 +1074,8 @@ int do_vm_stats_sys_v_pgfaults(int update_every, usec_t dt) {
1074
GETSYSCTL_SIMPLE("vm.stats.vm.v_cow_faults", mib_cow_faults, vmmeter_data.v_cow_faults) ||
1075
GETSYSCTL_SIMPLE("vm.stats.vm.v_cow_optim", mib_cow_optim, vmmeter_data.v_cow_optim) ||
1076
GETSYSCTL_SIMPLE("vm.stats.vm.v_intrans", mib_intrans, vmmeter_data.v_intrans))) {
1077
- error("DISABLED: mem.pgfaults chart");
1078
- error("DISABLED: vm.stats.vm.v_pgfaults module");
1077
+ collector_error("DISABLED: mem.pgfaults chart");
1078
+ collector_error("DISABLED: vm.stats.vm.v_pgfaults module");
1079
return 1;
1080
} else {
1081
static RRDSET *st = NULL;
@@ -1131,9 +1131,9 @@ int do_kern_ipc_sem(int update_every, usec_t dt) {
1131
} ipc_sem = {0, 0, 0};
1132
1133
if (unlikely(GETSYSCTL_SIMPLE("kern.ipc.semmni", mib_semmni, ipc_sem.semmni))) {
1134
- error("DISABLED: system.ipc_semaphores chart");
1135
- error("DISABLED: system.ipc_semaphore_arrays chart");
1136
- error("DISABLED: kern.ipc.sem module");
1134
+ collector_error("DISABLED: system.ipc_semaphores chart");
1135
+ collector_error("DISABLED: system.ipc_semaphore_arrays chart");
1136
+ collector_error("DISABLED: kern.ipc.sem module");
1137
return 1;
1138
} else {
1139
static struct semid_kernel *ipc_sem_data = NULL;
@@ -1145,9 +1145,9 @@ int do_kern_ipc_sem(int update_every, usec_t dt) {
1145
old_semmni = ipc_sem.semmni;
1146
}
1147
if (unlikely(GETSYSCTL_WSIZE("kern.ipc.sema", mib_sema, ipc_sem_data, sizeof(struct semid_kernel) * ipc_sem.semmni))) {
1148
- error("DISABLED: system.ipc_semaphores chart");
1149
- error("DISABLED: system.ipc_semaphore_arrays chart");
1150
- error("DISABLED: kern.ipc.sem module");
1148
+ collector_error("DISABLED: system.ipc_semaphores chart");
1149
+ collector_error("DISABLED: system.ipc_semaphore_arrays chart");
1150
+ collector_error("DISABLED: kern.ipc.sem module");
1151
return 1;
1152
} else {
1153
int i;
@@ -1223,9 +1223,9 @@ int do_kern_ipc_shm(int update_every, usec_t dt) {
1223
} ipc_shm = {0, 0, 0};
1224
1225
if (unlikely(GETSYSCTL_SIMPLE("kern.ipc.shmmni", mib_shmmni, ipc_shm.shmmni))) {
1226
- error("DISABLED: system.ipc_shared_mem_segs chart");
1227
- error("DISABLED: system.ipc_shared_mem_size chart");
1228
- error("DISABLED: kern.ipc.shmmodule");
1226
+ collector_error("DISABLED: system.ipc_shared_mem_segs chart");
1227
+ collector_error("DISABLED: system.ipc_shared_mem_size chart");
1228
+ collector_error("DISABLED: kern.ipc.shmmodule");
1229
return 1;
1230
} else {
1231
static struct shmid_kernel *ipc_shm_data = NULL;
@@ -1238,9 +1238,9 @@ int do_kern_ipc_shm(int update_every, usec_t dt) {
1238
}
1239
if (unlikely(
1240
GETSYSCTL_WSIZE("kern.ipc.shmsegs", mib_shmsegs, ipc_shm_data, sizeof(struct shmid_kernel) * ipc_shm.shmmni))) {
1241
- error("DISABLED: system.ipc_shared_mem_segs chart");
1242
- error("DISABLED: system.ipc_shared_mem_size chart");
1243
- error("DISABLED: kern.ipc.shmmodule");
1241
+ collector_error("DISABLED: system.ipc_shared_mem_segs chart");
1242
+ collector_error("DISABLED: system.ipc_shared_mem_size chart");
1243
+ collector_error("DISABLED: kern.ipc.shmmodule");
1244
return 1;
1245
} else {
1246
unsigned long i;
@@ -1318,10 +1318,10 @@ int do_kern_ipc_msq(int update_every, usec_t dt) {
1318
} ipc_msq = {0, 0, 0, 0, 0};
1319
1320
if (unlikely(GETSYSCTL_SIMPLE("kern.ipc.msgmni", mib_msgmni, ipc_msq.msgmni))) {
1321
- error("DISABLED: system.ipc_msq_queues chart");
1322
- error("DISABLED: system.ipc_msq_messages chart");
1323
- error("DISABLED: system.ipc_msq_size chart");
1324
- error("DISABLED: kern.ipc.msg module");
1321
+ collector_error("DISABLED: system.ipc_msq_queues chart");
1322
+ collector_error("DISABLED: system.ipc_msq_messages chart");
1323
+ collector_error("DISABLED: system.ipc_msq_size chart");
1324
+ collector_error("DISABLED: kern.ipc.msg module");
1325
return 1;
1326
} else {
1327
static struct msqid_kernel *ipc_msq_data = NULL;
@@ -1334,10 +1334,10 @@ int do_kern_ipc_msq(int update_every, usec_t dt) {
1334
}
1335
if (unlikely(
1336
GETSYSCTL_WSIZE("kern.ipc.msqids", mib_msqids, ipc_msq_data, sizeof(struct msqid_kernel) * ipc_msq.msgmni))) {
1337
- error("DISABLED: system.ipc_msq_queues chart");
1338
- error("DISABLED: system.ipc_msq_messages chart");
1339
- error("DISABLED: system.ipc_msq_size chart");
1340
- error("DISABLED: kern.ipc.msg module");
1337
+ collector_error("DISABLED: system.ipc_msq_queues chart");
1338
+ collector_error("DISABLED: system.ipc_msq_messages chart");
1339
+ collector_error("DISABLED: system.ipc_msq_size chart");
1340
+ collector_error("DISABLED: kern.ipc.msg module");
1341
return 1;
1342
} else {
1343
int i;
@@ -1520,11 +1520,11 @@ int do_net_isr(int update_every, usec_t dt) {
1520
}
1521
if (unlikely(common_error)) {
1522
do_netisr = 0;
1523
- error("DISABLED: system.softnet_stat chart");
1523
+ collector_error("DISABLED: system.softnet_stat chart");
1524
do_netisr_per_core = 0;
1525
- error("DISABLED: system.cpuX_softnet_stat chart");
1525
+ collector_error("DISABLED: system.cpuX_softnet_stat chart");
1526
common_error = 0;
1527
- error("DISABLED: net.isr module");
1527
+ collector_error("DISABLED: net.isr module");
1528
return 1;
1529
} else {
1530
unsigned long i, n;
@@ -1554,7 +1554,7 @@ int do_net_isr(int update_every, usec_t dt) {
1554
}
1555
}
1556
} else {
1557
- error("DISABLED: net.isr module");
1557
+ collector_error("DISABLED: net.isr module");
1558
return 1;
1559
}
1560
@@ -1662,8 +1662,8 @@ int do_net_inet_tcp_states(int update_every, usec_t dt) {
1662
1663
// see http://net-snmp.sourceforge.net/docs/mibs/tcp.html
1664
if (unlikely(GETSYSCTL_SIMPLE("net.inet.tcp.states", mib, tcps_states))) {
1665
- error("DISABLED: ipv4.tcpsock chart");
1666
- error("DISABLED: net.inet.tcp.states module");
1665
+ collector_error("DISABLED: ipv4.tcpsock chart");
1666
+ collector_error("DISABLED: net.inet.tcp.states module");
1667
return 1;
1668
} else {
1669
static RRDSET *st = NULL;
@@ -1726,22 +1726,22 @@ int do_net_inet_tcp_stats(int update_every, usec_t dt) {
1726
1727
if (unlikely(GETSYSCTL_SIMPLE("net.inet.tcp.stats", mib, tcpstat))) {
1728
do_tcp_packets = 0;
1729
- error("DISABLED: ipv4.tcppackets chart");
1729
+ collector_error("DISABLED: ipv4.tcppackets chart");
1730
do_tcp_errors = 0;
1731
- error("DISABLED: ipv4.tcperrors chart");
1731
+ collector_error("DISABLED: ipv4.tcperrors chart");
1732
do_tcp_handshake = 0;
1733
- error("DISABLED: ipv4.tcphandshake chart");
1733
+ collector_error("DISABLED: ipv4.tcphandshake chart");
1734
do_tcpext_connaborts = 0;
1735
- error("DISABLED: ipv4.tcpconnaborts chart");
1735
+ collector_error("DISABLED: ipv4.tcpconnaborts chart");
1736
do_tcpext_ofo = 0;
1737
- error("DISABLED: ipv4.tcpofo chart");
1737
+ collector_error("DISABLED: ipv4.tcpofo chart");
1738
do_tcpext_syncookies = 0;
1739
- error("DISABLED: ipv4.tcpsyncookies chart");
1739
+ collector_error("DISABLED: ipv4.tcpsyncookies chart");
1740
do_tcpext_listen = 0;
1741
- error("DISABLED: ipv4.tcplistenissues chart");
1741
+ collector_error("DISABLED: ipv4.tcplistenissues chart");
1742
do_ecn = 0;
1743
- error("DISABLED: ipv4.ecnpkts chart");
1744
- error("DISABLED: net.inet.tcp.stats module");
1743
+ collector_error("DISABLED: ipv4.ecnpkts chart");
1744
+ collector_error("DISABLED: net.inet.tcp.stats module");
1745
return 1;
1746
} else {
1747
if (likely(do_tcp_packets)) {
@@ -2035,7 +2035,7 @@ int do_net_inet_tcp_stats(int update_every, usec_t dt) {
2035
2036
}
2037
} else {
2038
- error("DISABLED: net.inet.tcp.stats module");
2038
+ collector_error("DISABLED: net.inet.tcp.stats module");
2039
return 1;
2040
}
2041
@@ -2060,10 +2060,10 @@ int do_net_inet_udp_stats(int update_every, usec_t dt) {
2060
2061
if (unlikely(GETSYSCTL_SIMPLE("net.inet.udp.stats", mib, udpstat))) {
2062
do_udp_packets = 0;
2063
- error("DISABLED: ipv4.udppackets chart");
2063
+ collector_error("DISABLED: ipv4.udppackets chart");
2064
do_udp_errors = 0;
2065
- error("DISABLED: ipv4.udperrors chart");
2066
- error("DISABLED: net.inet.udp.stats module");
2065
+ collector_error("DISABLED: ipv4.udperrors chart");
2066
+ collector_error("DISABLED: net.inet.udp.stats module");
2067
return 1;
2068
} else {
2069
if (likely(do_udp_packets)) {
@@ -2134,7 +2134,7 @@ int do_net_inet_udp_stats(int update_every, usec_t dt) {
2134
}
2135
}
2136
} else {
2137
- error("DISABLED: net.inet.udp.stats module");
2137
+ collector_error("DISABLED: net.inet.udp.stats module");
2138
return 1;
2139
}
2140
@@ -2163,12 +2163,12 @@ int do_net_inet_icmp_stats(int update_every, usec_t dt) {
2163
2164
if (unlikely(GETSYSCTL_SIMPLE("net.inet.icmp.stats", mib, icmpstat))) {
2165
do_icmp_packets = 0;
2166
- error("DISABLED: ipv4.icmp chart");
2166
+ collector_error("DISABLED: ipv4.icmp chart");
2167
do_icmp_errors = 0;
2168
- error("DISABLED: ipv4.icmp_errors chart");
2168
+ collector_error("DISABLED: ipv4.icmp_errors chart");
2169
do_icmpmsg = 0;
2170
- error("DISABLED: ipv4.icmpmsg chart");
2171
- error("DISABLED: net.inet.icmp.stats module");
2170
+ collector_error("DISABLED: ipv4.icmpmsg chart");
2171
+ collector_error("DISABLED: net.inet.icmp.stats module");
2172
return 1;
2173
} else {
2174
int i;
@@ -2275,7 +2275,7 @@ int do_net_inet_icmp_stats(int update_every, usec_t dt) {
2275
}
2276
}
2277
} else {
2278
- error("DISABLED: net.inet.icmp.stats module");
2278
+ collector_error("DISABLED: net.inet.icmp.stats module");
2279
return 1;
2280
}
2281
@@ -2302,14 +2302,14 @@ int do_net_inet_ip_stats(int update_every, usec_t dt) {
2302
2303
if (unlikely(GETSYSCTL_SIMPLE("net.inet.ip.stats", mib, ipstat))) {
2304
do_ip_packets = 0;
2305
- error("DISABLED: ipv4.packets chart");
2305
+ collector_error("DISABLED: ipv4.packets chart");
2306
do_ip_fragsout = 0;
2307
- error("DISABLED: ipv4.fragsout chart");
2307
+ collector_error("DISABLED: ipv4.fragsout chart");
2308
do_ip_fragsin = 0;
2309
- error("DISABLED: ipv4.fragsin chart");
2309
+ collector_error("DISABLED: ipv4.fragsin chart");
2310
do_ip_errors = 0;
2311
- error("DISABLED: ipv4.errors chart");
2312
- error("DISABLED: net.inet.ip.stats module");
2311
+ collector_error("DISABLED: ipv4.errors chart");
2312
+ collector_error("DISABLED: net.inet.ip.stats module");
2313
return 1;
2314
} else {
2315
if (likely(do_ip_packets)) {
@@ -2456,7 +2456,7 @@ int do_net_inet_ip_stats(int update_every, usec_t dt) {
2456
}
2457
}
2458
} else {
2459
- error("DISABLED: net.inet.ip.stats module");
2459
+ collector_error("DISABLED: net.inet.ip.stats module");
2460
return 1;
2461
}
2462
@@ -2486,14 +2486,14 @@ int do_net_inet6_ip6_stats(int update_every, usec_t dt) {
2486
2487
if (unlikely(GETSYSCTL_SIMPLE("net.inet6.ip6.stats", mib, ip6stat))) {
2488
do_ip6_packets = 0;
2489
- error("DISABLED: ipv6.packets chart");
2489
+ collector_error("DISABLED: ipv6.packets chart");
2490
do_ip6_fragsout = 0;
2491
- error("DISABLED: ipv6.fragsout chart");
2491
+ collector_error("DISABLED: ipv6.fragsout chart");
2492
do_ip6_fragsin = 0;
2493
- error("DISABLED: ipv6.fragsin chart");
2493
+ collector_error("DISABLED: ipv6.fragsin chart");
2494
do_ip6_errors = 0;
2495
- error("DISABLED: ipv6.errors chart");
2496
- error("DISABLED: net.inet6.ip6.stats module");
2495
+ collector_error("DISABLED: ipv6.errors chart");
2496
+ collector_error("DISABLED: net.inet6.ip6.stats module");
2497
return 1;
2498
} else {
2499
if (do_ip6_packets == CONFIG_BOOLEAN_YES || (do_ip6_packets == CONFIG_BOOLEAN_AUTO &&
@@ -2674,7 +2674,7 @@ int do_net_inet6_ip6_stats(int update_every, usec_t dt) {
2674
}
2675
}
2676
} else {
2677
- error("DISABLED: net.inet6.ip6.stats module");
2677
+ collector_error("DISABLED: net.inet6.ip6.stats module");
2678
return 1;
2679
}
2680
@@ -2711,20 +2711,20 @@ int do_net_inet6_icmp6_stats(int update_every, usec_t dt) {
2711
2712
if (unlikely(GETSYSCTL_SIMPLE("net.inet6.icmp6.stats", mib, icmp6stat))) {
2713
do_icmp6 = 0;
2714
- error("DISABLED: ipv6.icmp chart");
2714
+ collector_error("DISABLED: ipv6.icmp chart");
2715
do_icmp6_redir = 0;
2716
- error("DISABLED: ipv6.icmpredir chart");
2716
+ collector_error("DISABLED: ipv6.icmpredir chart");
2717
do_icmp6_errors = 0;
2718
- error("DISABLED: ipv6.icmperrors chart");
2718
+ collector_error("DISABLED: ipv6.icmperrors chart");
2719
do_icmp6_echos = 0;
2720
- error("DISABLED: ipv6.icmpechos chart");
2720
+ collector_error("DISABLED: ipv6.icmpechos chart");
2721
do_icmp6_router = 0;
2722
- error("DISABLED: ipv6.icmprouter chart");
2722
+ collector_error("DISABLED: ipv6.icmprouter chart");
2723
do_icmp6_neighbor = 0;
2724
- error("DISABLED: ipv6.icmpneighbor chart");
2724
+ collector_error("DISABLED: ipv6.icmpneighbor chart");
2725
do_icmp6_types = 0;
2726
- error("DISABLED: ipv6.icmptypes chart");
2727
- error("DISABLED: net.inet6.icmp6.stats module");
2726
+ collector_error("DISABLED: ipv6.icmptypes chart");
2727
+ collector_error("DISABLED: net.inet6.icmp6.stats module");
2728
return 1;
2729
} else {
2730
int i;
@@ -3054,7 +3054,7 @@ int do_net_inet6_icmp6_stats(int update_every, usec_t dt) {
3054
}
3055
}
3056
} else {
3057
- error("DISABLED: net.inet6.icmp6.stats module");
3057
+ collector_error("DISABLED: net.inet6.icmp6.stats module");
3058
return 1;
3059
}
3060
collectors/freebsd.plugin/plugin_freebsd.c
+1
-1
@@ -78,7 +78,7 @@ static void freebsd_main_cleanup(void *ptr)
78
struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
79
static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
80
81
- info("cleaning up...");
81
+ collector_info("cleaning up...");
82
83
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
84
}
collectors/freeipmi.plugin/freeipmi_plugin.c
+84
-84
@@ -775,7 +775,7 @@ _ipmimonitoring_sensors (struct ipmi_monitoring_ipmi_config *ipmi_config)
775
int rv = -1;
776
777
if (!(ctx = ipmi_monitoring_ctx_create ())) {
778
- error("ipmi_monitoring_ctx_create()");
778
+ collector_error("ipmi_monitoring_ctx_create()");
779
goto cleanup;
780
}
781
@@ -784,8 +784,8 @@ _ipmimonitoring_sensors (struct ipmi_monitoring_ipmi_config *ipmi_config)
784
if (ipmi_monitoring_ctx_sdr_cache_directory (ctx,
785
sdr_cache_directory) < 0)
786
{
787
- error("ipmi_monitoring_ctx_sdr_cache_directory(): %s\n",
788
- ipmi_monitoring_ctx_errormsg (ctx));
787
+ collector_error("ipmi_monitoring_ctx_sdr_cache_directory(): %s\n",
788
+ ipmi_monitoring_ctx_errormsg (ctx));
789
goto cleanup;
790
}
791
}
@@ -796,8 +796,8 @@ _ipmimonitoring_sensors (struct ipmi_monitoring_ipmi_config *ipmi_config)
796
if (ipmi_monitoring_ctx_sensor_config_file (ctx,
797
sensor_config_file) < 0)
798
{
799
- error( "ipmi_monitoring_ctx_sensor_config_file(): %s\n",
800
- ipmi_monitoring_ctx_errormsg (ctx));
799
+ collector_error( "ipmi_monitoring_ctx_sensor_config_file(): %s\n",
800
+ ipmi_monitoring_ctx_errormsg (ctx));
801
goto cleanup;
802
}
803
}
@@ -805,8 +805,8 @@ _ipmimonitoring_sensors (struct ipmi_monitoring_ipmi_config *ipmi_config)
805
{
806
if (ipmi_monitoring_ctx_sensor_config_file (ctx, NULL) < 0)
807
{
808
- error( "ipmi_monitoring_ctx_sensor_config_file(): %s\n",
809
- ipmi_monitoring_ctx_errormsg (ctx));
808
+ collector_error( "ipmi_monitoring_ctx_sensor_config_file(): %s\n",
809
+ ipmi_monitoring_ctx_errormsg (ctx));
810
goto cleanup;
811
}
812
}
@@ -851,8 +851,8 @@ _ipmimonitoring_sensors (struct ipmi_monitoring_ipmi_config *ipmi_config)
851
NULL,
852
NULL)) < 0)
853
{
854
- error( "ipmi_monitoring_sensor_readings_by_record_id(): %s",
855
- ipmi_monitoring_ctx_errormsg (ctx));
854
+ collector_error( "ipmi_monitoring_sensor_readings_by_record_id(): %s",
855
+ ipmi_monitoring_ctx_errormsg (ctx));
856
goto cleanup;
857
}
858
}
@@ -867,8 +867,8 @@ _ipmimonitoring_sensors (struct ipmi_monitoring_ipmi_config *ipmi_config)
867
NULL,
868
NULL)) < 0)
869
{
870
- error( "ipmi_monitoring_sensor_readings_by_record_id(): %s",
871
- ipmi_monitoring_ctx_errormsg (ctx));
870
+ collector_error( "ipmi_monitoring_sensor_readings_by_record_id(): %s",
871
+ ipmi_monitoring_ctx_errormsg (ctx));
872
goto cleanup;
873
}
874
}
@@ -883,8 +883,8 @@ _ipmimonitoring_sensors (struct ipmi_monitoring_ipmi_config *ipmi_config)
883
NULL,
884
NULL)) < 0)
885
{
886
- error( "ipmi_monitoring_sensor_readings_by_sensor_type(): %s",
887
- ipmi_monitoring_ctx_errormsg (ctx));
886
+ collector_error( "ipmi_monitoring_sensor_readings_by_sensor_type(): %s",
887
+ ipmi_monitoring_ctx_errormsg (ctx));
888
goto cleanup;
889
}
890
}
@@ -920,58 +920,57 @@ _ipmimonitoring_sensors (struct ipmi_monitoring_ipmi_config *ipmi_config)
920
921
if ((record_id = ipmi_monitoring_sensor_read_record_id (ctx)) < 0)
922
{
923
- error( "ipmi_monitoring_sensor_read_record_id(): %s",
924
- ipmi_monitoring_ctx_errormsg (ctx));
923
+ collector_error( "ipmi_monitoring_sensor_read_record_id(): %s",
924
+ ipmi_monitoring_ctx_errormsg (ctx));
925
goto cleanup;
926
}
927
928
if ((sensor_number = ipmi_monitoring_sensor_read_sensor_number (ctx)) < 0)
929
{
930
- error( "ipmi_monitoring_sensor_read_sensor_number(): %s",
931
- ipmi_monitoring_ctx_errormsg (ctx));
930
+ collector_error( "ipmi_monitoring_sensor_read_sensor_number(): %s",
931
+ ipmi_monitoring_ctx_errormsg (ctx));
932
goto cleanup;
933
}
934
935
if ((sensor_type = ipmi_monitoring_sensor_read_sensor_type (ctx)) < 0)
936
{
937
- error( "ipmi_monitoring_sensor_read_sensor_type(): %s",
938
- ipmi_monitoring_ctx_errormsg (ctx));
937
+ collector_error( "ipmi_monitoring_sensor_read_sensor_type(): %s",
938
+ ipmi_monitoring_ctx_errormsg (ctx));
939
goto cleanup;
940
}
941
942
if (!(sensor_name = ipmi_monitoring_sensor_read_sensor_name (ctx)))
943
{
944
- error( "ipmi_monitoring_sensor_read_sensor_name(): %s",
945
- ipmi_monitoring_ctx_errormsg (ctx));
944
+ collector_error( "ipmi_monitoring_sensor_read_sensor_name(): %s",
945
+ ipmi_monitoring_ctx_errormsg (ctx));
946
goto cleanup;
947
}
948
949
if ((sensor_state = ipmi_monitoring_sensor_read_sensor_state (ctx)) < 0)
950
{
951
- error( "ipmi_monitoring_sensor_read_sensor_state(): %s",
952
- ipmi_monitoring_ctx_errormsg (ctx));
951
+ collector_error( "ipmi_monitoring_sensor_read_sensor_state(): %s",
952
+ ipmi_monitoring_ctx_errormsg (ctx));
953
goto cleanup;
954
}
955
956
if ((sensor_units = ipmi_monitoring_sensor_read_sensor_units (ctx)) < 0)
957
{
958
- error( "ipmi_monitoring_sensor_read_sensor_units(): %s",
959
- ipmi_monitoring_ctx_errormsg (ctx));
958
+ collector_error( "ipmi_monitoring_sensor_read_sensor_units(): %s",
959
+ ipmi_monitoring_ctx_errormsg (ctx));
960
goto cleanup;
961
}
962
963
#ifdef NETDATA_COMMENTED
964
if ((sensor_bitmask_type = ipmi_monitoring_sensor_read_sensor_bitmask_type (ctx)) < 0)
965
{
966
- error( "ipmi_monitoring_sensor_read_sensor_bitmask_type(): %s",
967
- ipmi_monitoring_ctx_errormsg (ctx));
966
+ collector_error( "ipmi_monitoring_sensor_read_sensor_bitmask_type(): %s",
967
+ ipmi_monitoring_ctx_errormsg (ctx));
968
goto cleanup;
969
}
970
if ((sensor_bitmask = ipmi_monitoring_sensor_read_sensor_bitmask (ctx)) < 0)
971
{
972
- error(
973
- "ipmi_monitoring_sensor_read_sensor_bitmask(): %s",
974
- ipmi_monitoring_ctx_errormsg (ctx));
972
+ collector_error("ipmi_monitoring_sensor_read_sensor_bitmask(): %s",
973
+ ipmi_monitoring_ctx_errormsg (ctx));
974
goto cleanup;
975
}
976
@@ -986,8 +985,8 @@ _ipmimonitoring_sensors (struct ipmi_monitoring_ipmi_config *ipmi_config)
985
986
if ((sensor_reading_type = ipmi_monitoring_sensor_read_sensor_reading_type (ctx)) < 0)
987
{
989
- error( "ipmi_monitoring_sensor_read_sensor_reading_type(): %s",
990
- ipmi_monitoring_ctx_errormsg (ctx));
988
+ collector_error( "ipmi_monitoring_sensor_read_sensor_reading_type(): %s",
989
+ ipmi_monitoring_ctx_errormsg (ctx));
990
goto cleanup;
991
}
992
@@ -996,8 +995,8 @@ _ipmimonitoring_sensors (struct ipmi_monitoring_ipmi_config *ipmi_config)
995
#ifdef NETDATA_COMMENTED
996
if ((event_reading_type_code = ipmi_monitoring_sensor_read_event_reading_type_code (ctx)) < 0)
997
{
999
- error( "ipmi_monitoring_sensor_read_event_reading_type_code(): %s",
1000
- ipmi_monitoring_ctx_errormsg (ctx));
998
+ collector_error( "ipmi_monitoring_sensor_read_event_reading_type_code(): %s",
999
+ ipmi_monitoring_ctx_errormsg (ctx));
1000
goto cleanup;
1001
}
1002
#endif // NETDATA_COMMENTED
@@ -1131,7 +1130,7 @@ _ipmimonitoring_sel (struct ipmi_monitoring_ipmi_config *ipmi_config)
1130
1131
if (!(ctx = ipmi_monitoring_ctx_create ()))
1132
{
1134
- error("ipmi_monitoring_ctx_create()");
1133
+ collector_error("ipmi_monitoring_ctx_create()");
1134
goto cleanup;
1135
}
1136
@@ -1140,8 +1139,8 @@ _ipmimonitoring_sel (struct ipmi_monitoring_ipmi_config *ipmi_config)
1139
if (ipmi_monitoring_ctx_sdr_cache_directory (ctx,
1140
sdr_cache_directory) < 0)
1141
{
1143
- error( "ipmi_monitoring_ctx_sdr_cache_directory(): %s",
1144
- ipmi_monitoring_ctx_errormsg (ctx));
1142
+ collector_error( "ipmi_monitoring_ctx_sdr_cache_directory(): %s",
1143
+ ipmi_monitoring_ctx_errormsg (ctx));
1144
goto cleanup;
1145
}
1146
}
@@ -1152,8 +1151,8 @@ _ipmimonitoring_sel (struct ipmi_monitoring_ipmi_config *ipmi_config)
1151
if (ipmi_monitoring_ctx_sel_config_file (ctx,
1152
sel_config_file) < 0)
1153
{
1155
- error( "ipmi_monitoring_ctx_sel_config_file(): %s",
1156
- ipmi_monitoring_ctx_errormsg (ctx));
1154
+ collector_error( "ipmi_monitoring_ctx_sel_config_file(): %s",
1155
+ ipmi_monitoring_ctx_errormsg (ctx));
1156
goto cleanup;
1157
}
1158
}
@@ -1161,8 +1160,8 @@ _ipmimonitoring_sel (struct ipmi_monitoring_ipmi_config *ipmi_config)
1160
{
1161
if (ipmi_monitoring_ctx_sel_config_file (ctx, NULL) < 0)
1162
{
1164
- error( "ipmi_monitoring_ctx_sel_config_file(): %s",
1165
- ipmi_monitoring_ctx_errormsg (ctx));
1163
+ collector_error( "ipmi_monitoring_ctx_sel_config_file(): %s",
1164
+ ipmi_monitoring_ctx_errormsg (ctx));
1165
goto cleanup;
1166
}
1167
}
@@ -1192,8 +1191,8 @@ _ipmimonitoring_sel (struct ipmi_monitoring_ipmi_config *ipmi_config)
1191
NULL,
1192
NULL)) < 0)
1193
{
1195
- error( "ipmi_monitoring_sel_by_record_id(): %s",
1196
- ipmi_monitoring_ctx_errormsg (ctx));
1194
+ collector_error( "ipmi_monitoring_sel_by_record_id(): %s",
1195
+ ipmi_monitoring_ctx_errormsg (ctx));
1196
goto cleanup;
1197
}
1198
}
@@ -1208,8 +1207,8 @@ _ipmimonitoring_sel (struct ipmi_monitoring_ipmi_config *ipmi_config)
1207
NULL,
1208
NULL)) < 0)
1209
{
1211
- error( "ipmi_monitoring_sel_by_sensor_type(): %s",
1212
- ipmi_monitoring_ctx_errormsg (ctx));
1210
+ collector_error( "ipmi_monitoring_sel_by_sensor_type(): %s",
1211
+ ipmi_monitoring_ctx_errormsg (ctx));
1212
goto cleanup;
1213
}
1214
}
@@ -1225,8 +1224,8 @@ _ipmimonitoring_sel (struct ipmi_monitoring_ipmi_config *ipmi_config)
1224
NULL,
1225
NULL)) < 0)
1226
{
1228
- error( "ipmi_monitoring_sel_by_sensor_type(): %s",
1229
- ipmi_monitoring_ctx_errormsg (ctx));
1227
+ collector_error( "ipmi_monitoring_sel_by_sensor_type(): %s",
1228
+ ipmi_monitoring_ctx_errormsg (ctx));
1229
goto cleanup;
1230
}
1231
}
@@ -1241,8 +1240,8 @@ _ipmimonitoring_sel (struct ipmi_monitoring_ipmi_config *ipmi_config)
1240
NULL,
1241
NULL)) < 0)
1242
{
1244
- error( "ipmi_monitoring_sel_by_record_id(): %s",
1245
- ipmi_monitoring_ctx_errormsg (ctx));
1243
+ collector_error( "ipmi_monitoring_sel_by_record_id(): %s",
1244
+ ipmi_monitoring_ctx_errormsg (ctx));
1245
goto cleanup;
1246
}
1247
}
@@ -1281,29 +1280,29 @@ _ipmimonitoring_sel (struct ipmi_monitoring_ipmi_config *ipmi_config)
1280
1281
if ((record_id = ipmi_monitoring_sel_read_record_id (ctx)) < 0)
1282
{
1284
- error( "ipmi_monitoring_sel_read_record_id(): %s",
1285
- ipmi_monitoring_ctx_errormsg (ctx));
1283
+ collector_error( "ipmi_monitoring_sel_read_record_id(): %s",
1284
+ ipmi_monitoring_ctx_errormsg (ctx));
1285
goto cleanup;
1286
}
1287
1288
if ((record_type = ipmi_monitoring_sel_read_record_type (ctx)) < 0)
1289
{
1291
- error( "ipmi_monitoring_sel_read_record_type(): %s",
1292
- ipmi_monitoring_ctx_errormsg (ctx));
1290
+ collector_error( "ipmi_monitoring_sel_read_record_type(): %s",
1291
+ ipmi_monitoring_ctx_errormsg (ctx));
1292
goto cleanup;
1293
}
1294
1295
if ((record_type_class = ipmi_monitoring_sel_read_record_type_class (ctx)) < 0)
1296
{
1298
- error( "ipmi_monitoring_sel_read_record_type_class(): %s",
1299
- ipmi_monitoring_ctx_errormsg (ctx));
1297
+ collector_error( "ipmi_monitoring_sel_read_record_type_class(): %s",
1298
+ ipmi_monitoring_ctx_errormsg (ctx));
1299
goto cleanup;
1300
}
1301
1302
if ((sel_state = ipmi_monitoring_sel_read_sel_state (ctx)) < 0)
1303
{
1305
- error( "ipmi_monitoring_sel_read_sel_state(): %s",
1306
- ipmi_monitoring_ctx_errormsg (ctx));
1304
+ collector_error( "ipmi_monitoring_sel_read_sel_state(): %s",
1305
+ ipmi_monitoring_ctx_errormsg (ctx));
1306
goto cleanup;
1307
}
1308
@@ -1334,8 +1333,8 @@ _ipmimonitoring_sel (struct ipmi_monitoring_ipmi_config *ipmi_config)
1333
1334
if (ipmi_monitoring_sel_read_timestamp (ctx, ×tamp) < 0)
1335
{
1337
- error( "ipmi_monitoring_sel_read_timestamp(): %s",
1338
- ipmi_monitoring_ctx_errormsg (ctx));
1336
+ collector_error( "ipmi_monitoring_sel_read_timestamp(): %s",
1337
+ ipmi_monitoring_ctx_errormsg (ctx));
1338
goto cleanup;
1339
}
1340
@@ -1363,36 +1362,36 @@ _ipmimonitoring_sel (struct ipmi_monitoring_ipmi_config *ipmi_config)
1362
1363
if (!(sensor_name = ipmi_monitoring_sel_read_sensor_name (ctx)))
1364
{
1366
- error( "ipmi_monitoring_sel_read_sensor_name(): %s",
1367
- ipmi_monitoring_ctx_errormsg (ctx));
1365
+ collector_error( "ipmi_monitoring_sel_read_sensor_name(): %s",
1366
+ ipmi_monitoring_ctx_errormsg (ctx));
1367
goto cleanup;
1368
}
1369
1370
if ((sensor_type = ipmi_monitoring_sel_read_sensor_type (ctx)) < 0)
1371
{
1373
- error( "ipmi_monitoring_sel_read_sensor_type(): %s",
1374
- ipmi_monitoring_ctx_errormsg (ctx));
1372
+ collector_error( "ipmi_monitoring_sel_read_sensor_type(): %s",
1373
+ ipmi_monitoring_ctx_errormsg (ctx));
1374
goto cleanup;
1375
}
1376
1377
if ((sensor_number = ipmi_monitoring_sel_read_sensor_number (ctx)) < 0)
1378
{
1380
- error( "ipmi_monitoring_sel_read_sensor_number(): %s",
1381
- ipmi_monitoring_ctx_errormsg (ctx));
1379
+ collector_error( "ipmi_monitoring_sel_read_sensor_number(): %s",
1380
+ ipmi_monitoring_ctx_errormsg (ctx));
1381
goto cleanup;
1382
}
1383
1384
if ((event_direction = ipmi_monitoring_sel_read_event_direction (ctx)) < 0)
1385
{
1387
- error( "ipmi_monitoring_sel_read_event_direction(): %s",
1388
- ipmi_monitoring_ctx_errormsg (ctx));
1386
+ collector_error( "ipmi_monitoring_sel_read_event_direction(): %s",
1387
+ ipmi_monitoring_ctx_errormsg (ctx));
1388
goto cleanup;
1389
}
1390
1391
if ((event_type_code = ipmi_monitoring_sel_read_event_type_code (ctx)) < 0)
1392
{
1394
- error( "ipmi_monitoring_sel_read_event_type_code(): %s",
1395
- ipmi_monitoring_ctx_errormsg (ctx));
1393
+ collector_error( "ipmi_monitoring_sel_read_event_type_code(): %s",
1394
+ ipmi_monitoring_ctx_errormsg (ctx));
1395
goto cleanup;
1396
}
1397
@@ -1401,29 +1400,29 @@ _ipmimonitoring_sel (struct ipmi_monitoring_ipmi_config *ipmi_config)
1400
&event_data2,
1401
&event_data3) < 0)
1402
{
1404
- error( "ipmi_monitoring_sel_read_event_data(): %s",
1405
- ipmi_monitoring_ctx_errormsg (ctx));
1403
+ collector_error( "ipmi_monitoring_sel_read_event_data(): %s",
1404
+ ipmi_monitoring_ctx_errormsg (ctx));
1405
goto cleanup;
1406
}
1407
1408
if ((event_offset_type = ipmi_monitoring_sel_read_event_offset_type (ctx)) < 0)
1409
{
1411
- error( "ipmi_monitoring_sel_read_event_offset_type(): %s",
1412
- ipmi_monitoring_ctx_errormsg (ctx));
1410
+ collector_error( "ipmi_monitoring_sel_read_event_offset_type(): %s",
1411
+ ipmi_monitoring_ctx_errormsg (ctx));
1412
goto cleanup;
1413
}
1414
1415
if ((event_offset = ipmi_monitoring_sel_read_event_offset (ctx)) < 0)
1416
{
1418
- error( "ipmi_monitoring_sel_read_event_offset(): %s",
1419
- ipmi_monitoring_ctx_errormsg (ctx));
1417
+ collector_error( "ipmi_monitoring_sel_read_event_offset(): %s",
1418
+ ipmi_monitoring_ctx_errormsg (ctx));
1419
goto cleanup;
1420
}
1421
1422
if (!(event_offset_string = ipmi_monitoring_sel_read_event_offset_string (ctx)))
1423
{
1425
- error( "ipmi_monitoring_sel_read_event_offset_string(): %s",
1426
- ipmi_monitoring_ctx_errormsg (ctx));
1424
+ collector_error( "ipmi_monitoring_sel_read_event_offset_string(): %s",
1425
+ ipmi_monitoring_ctx_errormsg (ctx));
1426
goto cleanup;
1427
}
1428
@@ -1464,8 +1463,8 @@ _ipmimonitoring_sel (struct ipmi_monitoring_ipmi_config *ipmi_config)
1463
{
1464
if ((manufacturer_id = ipmi_monitoring_sel_read_manufacturer_id (ctx)) < 0)
1465
{
1467
- error( "ipmi_monitoring_sel_read_manufacturer_id(): %s",
1468
- ipmi_monitoring_ctx_errormsg (ctx));
1466
+ collector_error( "ipmi_monitoring_sel_read_manufacturer_id(): %s",
1467
+ ipmi_monitoring_ctx_errormsg (ctx));
1468
goto cleanup;
1469
}
1470
@@ -1474,8 +1473,8 @@ _ipmimonitoring_sel (struct ipmi_monitoring_ipmi_config *ipmi_config)
1473
1474
if ((oem_data_len = ipmi_monitoring_sel_read_oem_data (ctx, oem_data, 1024)) < 0)
1475
{
1477
- error( "ipmi_monitoring_sel_read_oem_data(): %s",
1478
- ipmi_monitoring_ctx_errormsg (ctx));
1476
+ collector_error( "ipmi_monitoring_sel_read_oem_data(): %s",
1477
+ ipmi_monitoring_ctx_errormsg (ctx));
1478
goto cleanup;
1479
}
1480
@@ -1596,6 +1595,7 @@ int host_is_local(const char *host)
1595
}
1596
1597
int main (int argc, char **argv) {
1598
+ stderror = stderr;
1599
clocks_init();
1600
1601
// ------------------------------------------------------------------------
@@ -1779,7 +1779,7 @@ int main (int argc, char **argv) {
1779
continue;
1780
}
1781
1782
- error("freeipmi.plugin: ignoring parameter '%s'", argv[i]);
1782
+ collector_error("freeipmi.plugin: ignoring parameter '%s'", argv[i]);
1783
}
1784
1785
errno = 0;
@@ -1788,7 +1788,7 @@ int main (int argc, char **argv) {
1788
netdata_update_every = freq;
1789
1790
else if(freq)
1791
- error("update frequency %d seconds is too small for IPMI. Using %d.", freq, netdata_update_every);
1791
+ collector_error("update frequency %d seconds is too small for IPMI. Using %d.", freq, netdata_update_every);
1792
1793
1794
// ------------------------------------------------------------------------
@@ -1813,7 +1813,7 @@ int main (int argc, char **argv) {
1813
if(debug) fprintf(stderr, "freeipmi.plugin: IPMI minimum update frequency was calculated to %d seconds.\n", freq);
1814
1815
if(freq > netdata_update_every) {
1816
- info("enforcing minimum data collection frequency, calculated to %d seconds.", freq);
1816
+ collector_info("enforcing minimum data collection frequency, calculated to %d seconds.", freq);
1817
netdata_update_every = freq;
1818
}
1819
collectors/idlejitter.plugin/plugin_idlejitter.c
+1
-1
@@ -10,7 +10,7 @@ static void cpuidlejitter_main_cleanup(void *ptr) {
10
struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
11
static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
12
13
- info("cleaning up...");
13
+ collector_info("cleaning up...");
14
15
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
16
}
collectors/macos.plugin/macos_fw.c
+11
-11
@@ -84,14 +84,14 @@ int do_macos_iokit(int update_every, usec_t dt) {
84
85
/* Get ports and services for drive statistics. */
86
if (unlikely(IOMainPort(bootstrap_port, &main_port))) {
87
- error("MACOS: IOMasterPort() failed");
87
+ collector_error("MACOS: IOMasterPort() failed");
88
do_io = 0;
89
- error("DISABLED: system.io");
89
+ collector_error("DISABLED: system.io");
90
/* Get the list of all drive objects. */
91
} else if (unlikely(IOServiceGetMatchingServices(main_port, IOServiceMatching("IOBlockStorageDriver"), &drive_list))) {
92
- error("MACOS: IOServiceGetMatchingServices() failed");
92
+ collector_error("MACOS: IOServiceGetMatchingServices() failed");
93
do_io = 0;
94
- error("DISABLED: system.io");
94
+ collector_error("DISABLED: system.io");
95
} else {
96
while ((drive = IOIteratorNext(drive_list)) != 0) {
97
properties = 0;
@@ -126,9 +126,9 @@ int do_macos_iokit(int update_every, usec_t dt) {
126
/* Obtain the properties for this drive object. */
127
if (unlikely(IORegistryEntryCreateCFProperties(drive, (CFMutableDictionaryRef *)&properties, kCFAllocatorDefault, 0))) {
128
IOObjectRelease(drive);
129
- error("MACOS: IORegistryEntryCreateCFProperties() failed");
129
+ collector_error("MACOS: IORegistryEntryCreateCFProperties() failed");
130
do_io = 0;
131
- error("DISABLED: system.io");
131
+ collector_error("DISABLED: system.io");
132
break;
133
} else if (likely(properties)) {
134
/* Obtain the statistics from the drive properties. */
@@ -413,11 +413,11 @@ int do_macos_iokit(int update_every, usec_t dt) {
413
if (likely(do_space || do_inodes)) {
414
// there is no mount info in sysctl MIBs
415
if (unlikely(!(mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)))) {
416
- error("MACOS: getmntinfo() failed");
416
+ collector_error("MACOS: getmntinfo() failed");
417
do_space = 0;
418
- error("DISABLED: disk_space.X");
418
+ collector_error("DISABLED: disk_space.X");
419
do_inodes = 0;
420
- error("DISABLED: disk_inodes.X");
420
+ collector_error("DISABLED: disk_inodes.X");
421
} else {
422
for (i = 0; i < mntsize; i++) {
423
if (mntbuf[i].f_flags == MNT_RDONLY ||
@@ -500,9 +500,9 @@ int do_macos_iokit(int update_every, usec_t dt) {
500
501
if (likely(do_bandwidth)) {
502
if (unlikely(getifaddrs(&ifap))) {
503
- error("MACOS: getifaddrs()");
503
+ collector_error("MACOS: getifaddrs()");
504
do_bandwidth = 0;
505
- error("DISABLED: system.ipv4");
505
+ collector_error("DISABLED: system.ipv4");
506
} else {
507
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
508
if (ifa->ifa_addr->sa_family != AF_LINK)
collectors/macos.plugin/macos_mach_smi.c
+8
-8
@@ -41,16 +41,16 @@ int do_macos_mach_smi(int update_every, usec_t dt) {
41
42
if (likely(do_cpu)) {
43
if (unlikely(HOST_CPU_LOAD_INFO_COUNT != 4)) {
44
- error("MACOS: There are %d CPU states (4 was expected)", HOST_CPU_LOAD_INFO_COUNT);
44
+ collector_error("MACOS: There are %d CPU states (4 was expected)", HOST_CPU_LOAD_INFO_COUNT);
45
do_cpu = 0;
46
- error("DISABLED: system.cpu");
46
+ collector_error("DISABLED: system.cpu");
47
} else {
48
count = HOST_CPU_LOAD_INFO_COUNT;
49
kr = host_statistics(host, HOST_CPU_LOAD_INFO, (host_info_t)cp_time, &count);
50
if (unlikely(kr != KERN_SUCCESS)) {
51
- error("MACOS: host_statistics() failed: %s", mach_error_string(kr));
51
+ collector_error("MACOS: host_statistics() failed: %s", mach_error_string(kr));
52
do_cpu = 0;
53
- error("DISABLED: system.cpu");
53
+ collector_error("DISABLED: system.cpu");
54
} else {
55
56
st = rrdset_find_active_bytype_localhost("system", "cpu");
@@ -95,13 +95,13 @@ int do_macos_mach_smi(int update_every, usec_t dt) {
95
kr = host_statistics(host, HOST_VM_INFO, (host_info_t)&vm_statistics, &count);
96
#endif
97
if (unlikely(kr != KERN_SUCCESS)) {
98
- error("MACOS: host_statistics64() failed: %s", mach_error_string(kr));
98
+ collector_error("MACOS: host_statistics64() failed: %s", mach_error_string(kr));
99
do_ram = 0;
100
- error("DISABLED: system.ram");
100
+ collector_error("DISABLED: system.ram");
101
do_swapio = 0;
102
- error("DISABLED: system.swapio");
102
+ collector_error("DISABLED: system.swapio");
103
do_pgfaults = 0;
104
- error("DISABLED: mem.pgfaults");
104
+ collector_error("DISABLED: mem.pgfaults");
105
} else {
106
if (likely(do_ram)) {
107
st = rrdset_find_active_localhost("system.ram");
collectors/macos.plugin/macos_sysctl.c
+28
-28
@@ -222,7 +222,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
222
if (likely(do_loadavg)) {
223
if (unlikely(GETSYSCTL_BY_NAME("vm.loadavg", sysload))) {
224
do_loadavg = 0;
225
- error("DISABLED: system.load");
225
+ collector_error("DISABLED: system.load");
226
} else {
227
228
st = rrdset_find_active_bytype_localhost("system", "load");
@@ -260,7 +260,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
260
if (likely(do_swap)) {
261
if (unlikely(GETSYSCTL_BY_NAME("vm.swapusage", swap_usage))) {
262
do_swap = 0;
263
- error("DISABLED: system.swap");
263
+ collector_error("DISABLED: system.swap");
264
} else {
265
st = rrdset_find_active_localhost("system.swap");
266
if (unlikely(!st)) {
@@ -298,15 +298,15 @@ int do_macos_sysctl(int update_every, usec_t dt) {
298
mib[4] = NET_RT_IFLIST2;
299
mib[5] = 0;
300
if (unlikely(sysctl(mib, 6, NULL, &size, NULL, 0))) {
301
- error("MACOS: sysctl(%s...) failed: %s", "net interfaces", strerror(errno));
301
+ collector_error("MACOS: sysctl(%s...) failed: %s", "net interfaces", strerror(errno));
302
do_bandwidth = 0;
303
- error("DISABLED: system.ipv4");
303
+ collector_error("DISABLED: system.ipv4");
304
} else {
305
ifstatdata = reallocz(ifstatdata, size);
306
if (unlikely(sysctl(mib, 6, ifstatdata, &size, NULL, 0) < 0)) {
307
- error("MACOS: sysctl(%s...) failed: %s", "net interfaces", strerror(errno));
307
+ collector_error("MACOS: sysctl(%s...) failed: %s", "net interfaces", strerror(errno));
308
do_bandwidth = 0;
309
- error("DISABLED: system.ipv4");
309
+ collector_error("DISABLED: system.ipv4");
310
} else {
311
lim = ifstatdata + size;
312
iftot.ift_ibytes = iftot.ift_obytes = 0;
@@ -353,19 +353,19 @@ int do_macos_sysctl(int update_every, usec_t dt) {
353
if (likely(do_tcp_packets || do_tcp_errors || do_tcp_handshake || do_tcpext_connaborts || do_tcpext_ofo || do_tcpext_syscookies || do_ecn)) {
354
if (unlikely(GETSYSCTL_BY_NAME("net.inet.tcp.stats", tcpstat))){
355
do_tcp_packets = 0;
356
- error("DISABLED: ipv4.tcppackets");
356
+ collector_error("DISABLED: ipv4.tcppackets");
357
do_tcp_errors = 0;
358
- error("DISABLED: ipv4.tcperrors");
358
+ collector_error("DISABLED: ipv4.tcperrors");
359
do_tcp_handshake = 0;
360
- error("DISABLED: ipv4.tcphandshake");
360
+ collector_error("DISABLED: ipv4.tcphandshake");
361
do_tcpext_connaborts = 0;
362
- error("DISABLED: ipv4.tcpconnaborts");
362
+ collector_error("DISABLED: ipv4.tcpconnaborts");
363
do_tcpext_ofo = 0;
364
- error("DISABLED: ipv4.tcpofo");
364
+ collector_error("DISABLED: ipv4.tcpofo");
365
do_tcpext_syscookies = 0;
366
- error("DISABLED: ipv4.tcpsyncookies");
366
+ collector_error("DISABLED: ipv4.tcpsyncookies");
367
do_ecn = 0;
368
- error("DISABLED: ipv4.ecnpkts");
368
+ collector_error("DISABLED: ipv4.ecnpkts");
369
} else {
370
if (likely(do_tcp_packets)) {
371
st = rrdset_find_active_localhost("ipv4.tcppackets");
@@ -597,9 +597,9 @@ int do_macos_sysctl(int update_every, usec_t dt) {
597
if (likely(do_udp_packets || do_udp_errors)) {
598
if (unlikely(GETSYSCTL_BY_NAME("net.inet.udp.stats", udpstat))) {
599
do_udp_packets = 0;
600
- error("DISABLED: ipv4.udppackets");
600
+ collector_error("DISABLED: ipv4.udppackets");
601
do_udp_errors = 0;
602
- error("DISABLED: ipv4.udperrors");
602
+ collector_error("DISABLED: ipv4.udperrors");
603
} else {
604
if (likely(do_udp_packets)) {
605
st = rrdset_find_active_localhost("ipv4.udppackets");
@@ -673,10 +673,10 @@ int do_macos_sysctl(int update_every, usec_t dt) {
673
if (likely(do_icmp_packets || do_icmpmsg)) {
674
if (unlikely(GETSYSCTL_BY_NAME("net.inet.icmp.stats", icmpstat))) {
675
do_icmp_packets = 0;
676
- error("DISABLED: ipv4.icmp");
677
- error("DISABLED: ipv4.icmp_errors");
676
+ collector_error("DISABLED: ipv4.icmp");
677
+ collector_error("DISABLED: ipv4.icmp_errors");
678
do_icmpmsg = 0;
679
- error("DISABLED: ipv4.icmpmsg");
679
+ collector_error("DISABLED: ipv4.icmpmsg");
680
} else {
681
for (i = 0; i <= ICMP_MAXTYPE; i++) {
682
icmp_total.msgs_in += icmpstat.icps_inhist[i];
@@ -777,13 +777,13 @@ int do_macos_sysctl(int update_every, usec_t dt) {
777
if (likely(do_ip_packets || do_ip_fragsout || do_ip_fragsin || do_ip_errors)) {
778
if (unlikely(GETSYSCTL_BY_NAME("net.inet.ip.stats", ipstat))) {
779
do_ip_packets = 0;
780
- error("DISABLED: ipv4.packets");
780
+ collector_error("DISABLED: ipv4.packets");
781
do_ip_fragsout = 0;
782
- error("DISABLED: ipv4.fragsout");
782
+ collector_error("DISABLED: ipv4.fragsout");
783
do_ip_fragsin = 0;
784
- error("DISABLED: ipv4.fragsin");
784
+ collector_error("DISABLED: ipv4.fragsin");
785
do_ip_errors = 0;
786
- error("DISABLED: ipv4.errors");
786
+ collector_error("DISABLED: ipv4.errors");
787
} else {
788
if (likely(do_ip_packets)) {
789
st = rrdset_find_active_localhost("ipv4.packets");
@@ -919,13 +919,13 @@ int do_macos_sysctl(int update_every, usec_t dt) {
919
if (likely(do_ip6_packets || do_ip6_fragsout || do_ip6_fragsin || do_ip6_errors)) {
920
if (unlikely(GETSYSCTL_BY_NAME("net.inet6.ip6.stats", ip6stat))) {
921
do_ip6_packets = 0;
922
- error("DISABLED: ipv6.packets");
922
+ collector_error("DISABLED: ipv6.packets");
923
do_ip6_fragsout = 0;
924
- error("DISABLED: ipv6.fragsout");
924
+ collector_error("DISABLED: ipv6.fragsout");
925
do_ip6_fragsin = 0;
926
- error("DISABLED: ipv6.fragsin");
926
+ collector_error("DISABLED: ipv6.fragsin");
927
do_ip6_errors = 0;
928
- error("DISABLED: ipv6.errors");
928
+ collector_error("DISABLED: ipv6.errors");
929
} else {
930
if (do_ip6_packets == CONFIG_BOOLEAN_YES || (do_ip6_packets == CONFIG_BOOLEAN_AUTO &&
931
(ip6stat.ip6s_localout ||
@@ -1096,7 +1096,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1096
if (likely(do_icmp6 || do_icmp6_redir || do_icmp6_errors || do_icmp6_echos || do_icmp6_router || do_icmp6_neighbor || do_icmp6_types)) {
1097
if (unlikely(GETSYSCTL_BY_NAME("net.inet6.icmp6.stats", icmp6stat))) {
1098
do_icmp6 = 0;
1099
- error("DISABLED: ipv6.icmp");
1099
+ collector_error("DISABLED: ipv6.icmp");
1100
} else {
1101
for (i = 0; i <= ICMP6_MAXTYPE; i++) {
1102
icmp6_total.msgs_in += icmp6stat.icp6s_inhist[i];
@@ -1392,7 +1392,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1392
if (likely(do_uptime)) {
1393
if (unlikely(GETSYSCTL_BY_NAME("kern.boottime", boot_time))) {
1394
do_uptime = 0;
1395
- error("DISABLED: system.uptime");
1395
+ collector_error("DISABLED: system.uptime");
1396
} else {
1397
clock_gettime(CLOCK_REALTIME, &cur_time);
1398
st = rrdset_find_active_localhost("system.uptime");
collectors/macos.plugin/plugin_macos.c
+1
-1
@@ -32,7 +32,7 @@ static void macos_main_cleanup(void *ptr)
32
struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
33
static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
34
35
- info("cleaning up...");
35
+ collector_info("cleaning up...");
36
37
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
38
}
collectors/nfacct.plugin/plugin_nfacct.c
+20
-19
@@ -92,14 +92,14 @@ static int nfstat_init(int update_every) {
92
93
nfstat_root.mnl = mnl_socket_open(NETLINK_NETFILTER);
94
if(!nfstat_root.mnl) {
95
- error("NFSTAT: mnl_socket_open() failed");
95
+ collector_error("NFSTAT: mnl_socket_open() failed");
96
return 1;
97
}
98
99
nfstat_root.seq = (unsigned int)now_realtime_sec() - 1;
100
101
if(mnl_socket_bind(nfstat_root.mnl, 0, MNL_SOCKET_AUTOPID) < 0) {
102
- error("NFSTAT: mnl_socket_bind() failed");
102
+ collector_error("NFSTAT: mnl_socket_bind() failed");
103
return 1;
104
}
105
nfstat_root.portid = mnl_socket_get_portid(nfstat_root.mnl);
@@ -132,7 +132,7 @@ static int nfct_stats_attr_cb(const struct nlattr *attr, void *data) {
132
return MNL_CB_OK;
133
134
if (mnl_attr_validate(attr, MNL_TYPE_U32) < 0) {
135
- error("NFSTAT: mnl_attr_validate() failed");
135
+ collector_error("NFSTAT: mnl_attr_validate() failed");
136
return MNL_CB_ERROR;
137
}
138
@@ -173,7 +173,7 @@ static int nfstat_collect_conntrack() {
173
174
// send the request
175
if(mnl_socket_sendto(nfstat_root.mnl, nfstat_root.nlh, nfstat_root.nlh->nlmsg_len) < 0) {
176
- error("NFSTAT: mnl_socket_sendto() failed");
176
+ collector_error("NFSTAT: mnl_socket_sendto() failed");
177
return 1;
178
}
179
@@ -193,7 +193,7 @@ static int nfstat_collect_conntrack() {
193
194
// verify we run without issues
195
if (ret == -1) {
196
- error("NFSTAT: error communicating with kernel. This plugin can only work when netdata runs as root.");
196
+ collector_error("NFSTAT: error communicating with kernel. This plugin can only work when netdata runs as root.");
197
return 1;
198
}
199
@@ -209,7 +209,7 @@ static int nfexp_stats_attr_cb(const struct nlattr *attr, void *data)
209
return MNL_CB_OK;
210
211
if (mnl_attr_validate(attr, MNL_TYPE_U32) < 0) {
212
- error("NFSTAT EXP: mnl_attr_validate() failed");
212
+ collector_error("NFSTAT EXP: mnl_attr_validate() failed");
213
return MNL_CB_ERROR;
214
}
215
@@ -245,7 +245,7 @@ static int nfstat_collect_conntrack_expectations() {
245
246
// send the request
247
if(mnl_socket_sendto(nfstat_root.mnl, nfstat_root.nlh, nfstat_root.nlh->nlmsg_len) < 0) {
248
- error("NFSTAT: mnl_socket_sendto() failed");
248
+ collector_error("NFSTAT: mnl_socket_sendto() failed");
249
return 1;
250
}
251
@@ -265,7 +265,7 @@ static int nfstat_collect_conntrack_expectations() {
265
266
// verify we run without issues
267
if (ret == -1) {
268
- error("NFSTAT: error communicating with kernel. This plugin can only work when netdata runs as root.");
268
+ collector_error("NFSTAT: error communicating with kernel. This plugin can only work when netdata runs as root.");
269
return 1;
270
}
271
@@ -561,7 +561,7 @@ static int nfacct_init(int update_every) {
561
562
nfacct_root.nfacct_buffer = nfacct_alloc();
563
if(!nfacct_root.nfacct_buffer) {
564
- error("nfacct.plugin: nfacct_alloc() failed.");
564
+ collector_error("nfacct.plugin: nfacct_alloc() failed.");
565
return 0;
566
}
567
@@ -569,12 +569,12 @@ static int nfacct_init(int update_every) {
569
570
nfacct_root.mnl = mnl_socket_open(NETLINK_NETFILTER);
571
if(!nfacct_root.mnl) {
572
- error("nfacct.plugin: mnl_socket_open() failed");
572
+ collector_error("nfacct.plugin: mnl_socket_open() failed");
573
return 1;
574
}
575
576
if(mnl_socket_bind(nfacct_root.mnl, 0, MNL_SOCKET_AUTOPID) < 0) {
577
- error("nfacct.plugin: mnl_socket_bind() failed");
577
+ collector_error("nfacct.plugin: mnl_socket_bind() failed");
578
return 1;
579
}
580
nfacct_root.portid = mnl_socket_get_portid(nfacct_root.mnl);
@@ -586,7 +586,7 @@ static int nfacct_callback(const struct nlmsghdr *nlh, void *data) {
586
(void)data;
587
588
if(nfacct_nlmsg_parse_payload(nlh, nfacct_root.nfacct_buffer) < 0) {
589
- error("NFACCT: nfacct_nlmsg_parse_payload() failed.");
589
+ collector_error("NFACCT: nfacct_nlmsg_parse_payload() failed.");
590
return MNL_CB_OK;
591
}
592
@@ -612,13 +612,13 @@ static int nfacct_collect() {
612
nfacct_root.seq++;
613
nfacct_root.nlh = nfacct_nlmsg_build_hdr(nfacct_root.buf, NFNL_MSG_ACCT_GET, NLM_F_DUMP, (uint32_t)nfacct_root.seq);
614
if(!nfacct_root.nlh) {
615
- error("NFACCT: nfacct_nlmsg_build_hdr() failed");
615
+ collector_error("NFACCT: nfacct_nlmsg_build_hdr() failed");
616
return 1;
617
}
618
619
// send the request
620
if(mnl_socket_sendto(nfacct_root.mnl, nfacct_root.nlh, nfacct_root.nlh->nlmsg_len) < 0) {
621
- error("NFACCT: mnl_socket_sendto() failed");
621
+ collector_error("NFACCT: mnl_socket_sendto() failed");
622
return 1;
623
}
624
@@ -638,7 +638,7 @@ static int nfacct_collect() {
638
639
// verify we run without issues
640
if (ret == -1) {
641
- error("NFACCT: error communicating with kernel. This plugin can only work when netdata runs as root.");
641
+ collector_error("NFACCT: error communicating with kernel. This plugin can only work when netdata runs as root.");
642
return 1;
643
}
644
@@ -740,11 +740,12 @@ void nfacct_signals()
740
741
for (i = 0; signals[i]; i++) {
742
if(sigaction(signals[i], &sa, NULL) == -1)
743
- error("Cannot add the handler to signal %d", signals[i]);
743
+ collector_error("Cannot add the handler to signal %d", signals[i]);
744
}
745
}
746
747
int main(int argc, char **argv) {
748
+ stderror = stderr;
749
clocks_init();
750
751
// ------------------------------------------------------------------------
@@ -813,7 +814,7 @@ int main(int argc, char **argv) {
814
exit(1);
815
}
816
816
- error("nfacct.plugin: ignoring parameter '%s'", argv[i]);
817
+ collector_error("nfacct.plugin: ignoring parameter '%s'", argv[i]);
818
}
819
820
nfacct_signals();
@@ -823,7 +824,7 @@ int main(int argc, char **argv) {
824
if(freq >= netdata_update_every)
825
netdata_update_every = freq;
826
else if(freq)
826
- error("update frequency %d seconds is too small for NFACCT. Using %d.", freq, netdata_update_every);
827
+ collector_error("update frequency %d seconds is too small for NFACCT. Using %d.", freq, netdata_update_every);
828
829
if (debug)
830
fprintf(stderr, "nfacct.plugin: calling nfacct_init()\n");
@@ -882,5 +883,5 @@ int main(int argc, char **argv) {
883
if(now_monotonic_sec() - started_t > 14400) break;
884
}
885
885
- info("NFACCT process exiting");
886
+ collector_info("NFACCT process exiting");
887
}
collectors/perf.plugin/perf_plugin.c
+11
-10
@@ -294,15 +294,15 @@ static int perf_init() {
294
if(unlikely(fd < 0)) {
295
switch errno {
296
case EACCES:
297
- error("Cannot access to the PMU: Permission denied");
297
+ collector_error("Cannot access to the PMU: Permission denied");
298
break;
299
case EBUSY:
300
- error("Another event already has exclusive access to the PMU");
300
+ collector_error("Another event already has exclusive access to the PMU");
301
break;
302
default:
303
- error("Cannot open perf event");
303
+ collector_error("Cannot open perf event");
304
}
305
- error("Disabling event %u", current_event->id);
305
+ collector_error("Disabling event %u", current_event->id);
306
current_event->disabled = 1;
307
}
308
@@ -346,7 +346,7 @@ static void reenable_events() {
346
if(ioctl(current_fd, PERF_EVENT_IOC_DISABLE, PERF_IOC_FLAG_GROUP) == -1
347
|| ioctl(current_fd, PERF_EVENT_IOC_ENABLE, PERF_IOC_FLAG_GROUP) == -1)
348
{
349
- error("Cannot reenable event group");
349
+ collector_error("Cannot reenable event group");
350
}
351
}
352
}
@@ -388,7 +388,7 @@ static int perf_collect() {
388
current_event->updated = 1;
389
}
390
else {
391
- error("Cannot update value for event %u", current_event->id);
391
+ collector_error("Cannot update value for event %u", current_event->id);
392
return 1;
393
}
394
}
@@ -1272,17 +1272,18 @@ void parse_command_line(int argc, char **argv) {
1272
exit(1);
1273
}
1274
1275
- error("ignoring parameter '%s'", argv[i]);
1275
+ collector_error("ignoring parameter '%s'", argv[i]);
1276
}
1277
1278
if(!plugin_enabled){
1279
- info("no charts enabled - nothing to do.");
1279
+ collector_info("no charts enabled - nothing to do.");
1280
printf("DISABLE\n");
1281
exit(1);
1282
}
1283
}
1284
1285
int main(int argc, char **argv) {
1286
+ stderror = stderr;
1287
clocks_init();
1288
1289
// ------------------------------------------------------------------------
@@ -1304,7 +1305,7 @@ int main(int argc, char **argv) {
1305
if(freq >= update_every)
1306
update_every = freq;
1307
else if(freq)
1307
- error("update frequency %d seconds is too small for PERF. Using %d.", freq, update_every);
1308
+ collector_error("update frequency %d seconds is too small for PERF. Using %d.", freq, update_every);
1309
1310
if(unlikely(debug)) fprintf(stderr, "perf.plugin: calling perf_init()\n");
1311
int perf = !perf_init();
@@ -1348,6 +1349,6 @@ int main(int argc, char **argv) {
1349
if(now_monotonic_sec() - started_t > 14400) break;
1350
}
1351
1351
- info("process exiting");
1352
+ collector_info("process exiting");
1353
perf_free();
1354
}
collectors/proc.plugin/ipc.c
+18
-18
@@ -82,7 +82,7 @@ static inline int ipc_sem_get_limits(struct ipc_limits *lim) {
82
ff = procfile_open(filename, NULL, PROCFILE_FLAG_DEFAULT);
83
if(unlikely(!ff)) {
84
if(unlikely(!error_shown)) {
85
- error("IPC: Cannot open file '%s'.", filename);
85
+ collector_error("IPC: Cannot open file '%s'.", filename);
86
error_shown = 1;
87
}
88
goto ipc;
@@ -92,7 +92,7 @@ static inline int ipc_sem_get_limits(struct ipc_limits *lim) {
92
ff = procfile_readall(ff);
93
if(unlikely(!ff)) {
94
if(unlikely(!error_shown)) {
95
- error("IPC: Cannot read file '%s'.", filename);
95
+ collector_error("IPC: Cannot read file '%s'.", filename);
96
error_shown = 1;
97
}
98
goto ipc;
@@ -108,7 +108,7 @@ static inline int ipc_sem_get_limits(struct ipc_limits *lim) {
108
}
109
else {
110
if(unlikely(!error_shown)) {
111
- error("IPC: Invalid content in file '%s'.", filename);
111
+ collector_error("IPC: Invalid content in file '%s'.", filename);
112
error_shown = 1;
113
}
114
goto ipc;
@@ -122,7 +122,7 @@ ipc:
122
union semun arg = {.array = (ushort *) &seminfo};
123
124
if(unlikely(semctl(0, 0, IPC_INFO, arg) < 0)) {
125
- error("IPC: Failed to read '%s' and request IPC_INFO with semctl().", filename);
125
+ collector_error("IPC: Failed to read '%s' and request IPC_INFO with semctl().", filename);
126
goto error;
127
}
128
@@ -166,7 +166,7 @@ static inline int ipc_sem_get_status(struct ipc_status *st) {
166
/* kernel not configured for semaphores */
167
static int error_shown = 0;
168
if(unlikely(!error_shown)) {
169
- error("IPC: kernel is not configured for semaphores");
169
+ collector_error("IPC: kernel is not configured for semaphores");
170
error_shown = 1;
171
}
172
st->semusz = 0;
@@ -195,7 +195,7 @@ int ipc_msq_get_info(char *msg_filename, struct message_queue **message_queue_ro
195
size_t words = 0;
196
197
if(unlikely(lines < 2)) {
198
- error("Cannot read %s. Expected 2 or more lines, read %zu.", procfile_filename(ff), lines);
198
+ collector_error("Cannot read %s. Expected 2 or more lines, read %zu.", procfile_filename(ff), lines);
199
return 1;
200
}
201
@@ -205,7 +205,7 @@ int ipc_msq_get_info(char *msg_filename, struct message_queue **message_queue_ro
205
words = procfile_linewords(ff, l);
206
if(unlikely(words < 2)) continue;
207
if(unlikely(words < 14)) {
208
- error("Cannot read %s line. Expected 14 params, read %zu.", procfile_filename(ff), words);
208
+ collector_error("Cannot read %s line. Expected 14 params, read %zu.", procfile_filename(ff), words);
209
continue;
210
}
211
@@ -250,7 +250,7 @@ int ipc_shm_get_info(char *shm_filename, struct shm_stats *shm) {
250
size_t words = 0;
251
252
if(unlikely(lines < 2)) {
253
- error("Cannot read %s. Expected 2 or more lines, read %zu.", procfile_filename(ff), lines);
253
+ collector_error("Cannot read %s. Expected 2 or more lines, read %zu.", procfile_filename(ff), lines);
254
return 1;
255
}
256
@@ -263,7 +263,7 @@ int ipc_shm_get_info(char *shm_filename, struct shm_stats *shm) {
263
words = procfile_linewords(ff, l);
264
if(unlikely(words < 2)) continue;
265
if(unlikely(words < 16)) {
266
- error("Cannot read %s line. Expected 16 params, read %zu.", procfile_filename(ff), words);
266
+ collector_error("Cannot read %s line. Expected 16 params, read %zu.", procfile_filename(ff), words);
267
continue;
268
}
269
@@ -306,11 +306,11 @@ int do_ipc(int update_every, usec_t dt) {
306
307
// make sure it works
308
if(ipc_sem_get_limits(&limits) == -1) {
309
- error("unable to fetch semaphore limits");
309
+ collector_error("unable to fetch semaphore limits");
310
do_sem = CONFIG_BOOLEAN_NO;
311
}
312
else if(ipc_sem_get_status(&status) == -1) {
313
- error("unable to fetch semaphore statistics");
313
+ collector_error("unable to fetch semaphore statistics");
314
do_sem = CONFIG_BOOLEAN_NO;
315
}
316
else {
@@ -362,7 +362,7 @@ int do_ipc(int update_every, usec_t dt) {
362
}
363
364
if(unlikely(do_sem == CONFIG_BOOLEAN_NO && do_msg == CONFIG_BOOLEAN_NO)) {
365
- error("ipc module disabled");
365
+ collector_error("ipc module disabled");
366
return 1;
367
}
368
}
@@ -370,7 +370,7 @@ int do_ipc(int update_every, usec_t dt) {
370
if(likely(do_sem != CONFIG_BOOLEAN_NO)) {
371
if(unlikely(read_limits_next < 0)) {
372
if(unlikely(ipc_sem_get_limits(&limits) == -1)) {
373
- error("Unable to fetch semaphore limits.");
373
+ collector_error("Unable to fetch semaphore limits.");
374
}
375
else {
376
if(semaphores_max) rrdvar_custom_host_variable_set(localhost, semaphores_max, limits.semmns);
@@ -386,7 +386,7 @@ int do_ipc(int update_every, usec_t dt) {
386
read_limits_next--;
387
388
if(unlikely(ipc_sem_get_status(&status) == -1)) {
389
- error("Unable to get semaphore statistics");
389
+ collector_error("Unable to get semaphore statistics");
390
return 0;
391
}
392
@@ -478,8 +478,8 @@ int do_ipc(int update_every, usec_t dt) {
478
long long dimensions_num = rrdset_number_of_dimensions(st_msq_messages);
479
480
if(unlikely(dimensions_num > dimensions_limit)) {
481
- info("Message queue statistics has been disabled");
482
- info("There are %lld dimensions in memory but limit was set to %lld", dimensions_num, dimensions_limit);
481
+ collector_info("Message queue statistics has been disabled");
482
+ collector_info("There are %lld dimensions in memory but limit was set to %lld", dimensions_num, dimensions_limit);
483
rrdset_is_obsolete(st_msq_messages);
484
rrdset_is_obsolete(st_msq_bytes);
485
st_msq_messages = NULL;
@@ -487,11 +487,11 @@ int do_ipc(int update_every, usec_t dt) {
487
do_msg = CONFIG_BOOLEAN_NO;
488
}
489
else if(unlikely(!message_queue_root)) {
490
- info("Making chart %s (%s) obsolete since it does not have any dimensions", rrdset_name(st_msq_messages), rrdset_id(st_msq_messages));
490
+ collector_info("Making chart %s (%s) obsolete since it does not have any dimensions", rrdset_name(st_msq_messages), rrdset_id(st_msq_messages));
491
rrdset_is_obsolete(st_msq_messages);
492
st_msq_messages = NULL;
493
494
- info("Making chart %s (%s) obsolete since it does not have any dimensions", rrdset_name(st_msq_bytes), rrdset_id(st_msq_bytes));
494
+ collector_info("Making chart %s (%s) obsolete since it does not have any dimensions", rrdset_name(st_msq_bytes), rrdset_id(st_msq_bytes));
495
rrdset_is_obsolete(st_msq_bytes);
496
st_msq_bytes = NULL;
497
}
collectors/proc.plugin/plugin_proc.c
+1
-1
@@ -86,7 +86,7 @@ static void proc_main_cleanup(void *ptr)
86
struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
87
static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
88
89
- info("cleaning up...");
89
+ collector_info("cleaning up...");
90
91
if (netdev_thread) {
92
netdata_thread_join(*netdev_thread, NULL);
collectors/proc.plugin/proc_diskstats.c
+31
-31
@@ -214,7 +214,7 @@ static unsigned long long int bcache_read_number_with_units(const char *filename
214
else if(*end == 'T')
215
return (unsigned long long int)(value * 1024.0 * 1024.0 * 1024.0 * 1024.0);
216
else if(unknown_units_error > 0) {
217
- error("bcache file '%s' provides value '%s' with unknown units '%s'", filename, buffer, end);
217
+ collector_error("bcache file '%s' provides value '%s' with unknown units '%s'", filename, buffer, end);
218
unknown_units_error--;
219
}
220
}
@@ -269,7 +269,7 @@ void bcache_read_priority_stats(struct disk *d, const char *family, int update_e
269
for(l = 0; l < lines ;l++) {
270
size_t words = procfile_linewords(ff, l);
271
if(unlikely(words < 2)) {
272
- if(unlikely(words)) error("Cannot read '%s' line %zu. Expected 2 params, read %zu.", d->bcache_filename_priority_stats, l, words);
272
+ if(unlikely(words)) collector_error("Cannot read '%s' line %zu. Expected 2 params, read %zu.", d->bcache_filename_priority_stats, l, words);
273
continue;
274
}
275
@@ -344,7 +344,7 @@ static inline int is_major_enabled(int major) {
344
}
345
346
static inline int get_disk_name_from_path(const char *path, char *result, size_t result_size, unsigned long major, unsigned long minor, char *disk, char *prefix, int depth) {
347
- //info("DEVICE-MAPPER ('%s', %lu:%lu): examining directory '%s' (allowed depth %d).", disk, major, minor, path, depth);
347
+ //collector_info("DEVICE-MAPPER ('%s', %lu:%lu): examining directory '%s' (allowed depth %d).", disk, major, minor, path, depth);
348
349
int found = 0, preferred = 0;
350
@@ -352,7 +352,7 @@ static inline int get_disk_name_from_path(const char *path, char *result, size_t
352
353
DIR *dir = opendir(path);
354
if (!dir) {
355
- error("DEVICE-MAPPER ('%s', %lu:%lu): Cannot open directory '%s'.", disk, major, minor, path);
355
+ collector_error("DEVICE-MAPPER ('%s', %lu:%lu): Cannot open directory '%s'.", disk, major, minor, path);
356
goto failed;
357
}
358
@@ -363,7 +363,7 @@ static inline int get_disk_name_from_path(const char *path, char *result, size_t
363
continue;
364
365
if(depth <= 0) {
366
- error("DEVICE-MAPPER ('%s', %lu:%lu): Depth limit reached for path '%s/%s'. Ignoring path.", disk, major, minor, path, de->d_name);
366
+ collector_error("DEVICE-MAPPER ('%s', %lu:%lu): Depth limit reached for path '%s/%s'. Ignoring path.", disk, major, minor, path, de->d_name);
367
break;
368
}
369
else {
@@ -393,7 +393,7 @@ static inline int get_disk_name_from_path(const char *path, char *result, size_t
393
snprintfz(filename, FILENAME_MAX, "%s/%s", path, de->d_name);
394
ssize_t len = readlink(filename, result, result_size - 1);
395
if(len <= 0) {
396
- error("DEVICE-MAPPER ('%s', %lu:%lu): Cannot read link '%s'.", disk, major, minor, filename);
396
+ collector_error("DEVICE-MAPPER ('%s', %lu:%lu): Cannot read link '%s'.", disk, major, minor, filename);
397
continue;
398
}
399
@@ -409,21 +409,21 @@ static inline int get_disk_name_from_path(const char *path, char *result, size_t
409
410
struct stat sb;
411
if(stat(filename, &sb) == -1) {
412
- error("DEVICE-MAPPER ('%s', %lu:%lu): Cannot stat() file '%s'.", disk, major, minor, filename);
412
+ collector_error("DEVICE-MAPPER ('%s', %lu:%lu): Cannot stat() file '%s'.", disk, major, minor, filename);
413
continue;
414
}
415
416
if((sb.st_mode & S_IFMT) != S_IFBLK) {
417
- //info("DEVICE-MAPPER ('%s', %lu:%lu): file '%s' is not a block device.", disk, major, minor, filename);
417
+ //collector_info("DEVICE-MAPPER ('%s', %lu:%lu): file '%s' is not a block device.", disk, major, minor, filename);
418
continue;
419
}
420
421
if(major(sb.st_rdev) != major || minor(sb.st_rdev) != minor || strcmp(basename(filename), disk)) {
422
- //info("DEVICE-MAPPER ('%s', %lu:%lu): filename '%s' does not match %lu:%lu.", disk, major, minor, filename, (unsigned long)major(sb.st_rdev), (unsigned long)minor(sb.st_rdev));
422
+ //collector_info("DEVICE-MAPPER ('%s', %lu:%lu): filename '%s' does not match %lu:%lu.", disk, major, minor, filename, (unsigned long)major(sb.st_rdev), (unsigned long)minor(sb.st_rdev));
423
continue;
424
}
425
426
- //info("DEVICE-MAPPER ('%s', %lu:%lu): filename '%s' matches.", disk, major, minor, filename);
426
+ //collector_info("DEVICE-MAPPER ('%s', %lu:%lu): filename '%s' matches.", disk, major, minor, filename);
427
428
snprintfz(result, result_size - 1, "%s%s%s", (prefix)?prefix:"", (prefix)?"_":"", de->d_name);
429
@@ -672,7 +672,7 @@ static struct disk *get_disk(unsigned long major, unsigned long minor, char *dis
672
break;
673
}
674
if (unlikely(closedir(dirp) == -1))
675
- error("Unable to close dir %s", buffer);
675
+ collector_error("Unable to close dir %s", buffer);
676
}
677
}
678
}
@@ -721,15 +721,15 @@ static struct disk *get_disk(unsigned long major, unsigned long minor, char *dis
721
if(likely(tmp)) {
722
d->sector_size = str2i(tmp);
723
if(unlikely(d->sector_size <= 0)) {
724
- error("Invalid sector size %d for device %s in %s. Assuming 512.", d->sector_size, d->device, buffer);
724
+ collector_error("Invalid sector size %d for device %s in %s. Assuming 512.", d->sector_size, d->device, buffer);
725
d->sector_size = 512;
726
}
727
}
728
- else error("Cannot read data for sector size for device %s from %s. Assuming 512.", d->device, buffer);
728
+ else collector_error("Cannot read data for sector size for device %s from %s. Assuming 512.", d->device, buffer);
729
730
fclose(fpss);
731
}
732
- else error("Cannot read sector size for device %s from %s. Assuming 512.", d->device, buffer);
732
+ else collector_error("Cannot read sector size for device %s from %s. Assuming 512.", d->device, buffer);
733
}
734
*/
735
@@ -748,103 +748,103 @@ static struct disk *get_disk(unsigned long major, unsigned long minor, char *dis
748
if(access(buffer2, R_OK) == 0)
749
d->bcache_filename_cache_congested = strdupz(buffer2);
750
else
751
- error("bcache file '%s' cannot be read.", buffer2);
751
+ collector_error("bcache file '%s' cannot be read.", buffer2);
752
753
snprintfz(buffer2, FILENAME_MAX, "%s/readahead", buffer);
754
if(access(buffer2, R_OK) == 0)
755
d->bcache_filename_stats_total_cache_readaheads = strdupz(buffer2);
756
else
757
- error("bcache file '%s' cannot be read.", buffer2);
757
+ collector_error("bcache file '%s' cannot be read.", buffer2);
758
759
snprintfz(buffer2, FILENAME_MAX, "%s/cache/cache0/priority_stats", buffer); // only one cache is supported by bcache
760
if(access(buffer2, R_OK) == 0)
761
d->bcache_filename_priority_stats = strdupz(buffer2);
762
else
763
- error("bcache file '%s' cannot be read.", buffer2);
763
+ collector_error("bcache file '%s' cannot be read.", buffer2);
764
765
snprintfz(buffer2, FILENAME_MAX, "%s/cache/internal/cache_read_races", buffer);
766
if(access(buffer2, R_OK) == 0)
767
d->bcache_filename_cache_read_races = strdupz(buffer2);
768
else
769
- error("bcache file '%s' cannot be read.", buffer2);
769
+ collector_error("bcache file '%s' cannot be read.", buffer2);
770
771
snprintfz(buffer2, FILENAME_MAX, "%s/cache/cache0/io_errors", buffer);
772
if(access(buffer2, R_OK) == 0)
773
d->bcache_filename_cache_io_errors = strdupz(buffer2);
774
else
775
- error("bcache file '%s' cannot be read.", buffer2);
775
+ collector_error("bcache file '%s' cannot be read.", buffer2);
776
777
snprintfz(buffer2, FILENAME_MAX, "%s/dirty_data", buffer);
778
if(access(buffer2, R_OK) == 0)
779
d->bcache_filename_dirty_data = strdupz(buffer2);
780
else
781
- error("bcache file '%s' cannot be read.", buffer2);
781
+ collector_error("bcache file '%s' cannot be read.", buffer2);
782
783
snprintfz(buffer2, FILENAME_MAX, "%s/writeback_rate", buffer);
784
if(access(buffer2, R_OK) == 0)
785
d->bcache_filename_writeback_rate = strdupz(buffer2);
786
else
787
- error("bcache file '%s' cannot be read.", buffer2);
787
+ collector_error("bcache file '%s' cannot be read.", buffer2);
788
789
snprintfz(buffer2, FILENAME_MAX, "%s/cache/cache_available_percent", buffer);
790
if(access(buffer2, R_OK) == 0)
791
d->bcache_filename_cache_available_percent = strdupz(buffer2);
792
else
793
- error("bcache file '%s' cannot be read.", buffer2);
793
+ collector_error("bcache file '%s' cannot be read.", buffer2);
794
795
snprintfz(buffer2, FILENAME_MAX, "%s/stats_total/cache_hits", buffer);
796
if(access(buffer2, R_OK) == 0)
797
d->bcache_filename_stats_total_cache_hits = strdupz(buffer2);
798
else
799
- error("bcache file '%s' cannot be read.", buffer2);
799
+ collector_error("bcache file '%s' cannot be read.", buffer2);
800
801
snprintfz(buffer2, FILENAME_MAX, "%s/stats_five_minute/cache_hit_ratio", buffer);
802
if(access(buffer2, R_OK) == 0)
803
d->bcache_filename_stats_five_minute_cache_hit_ratio = strdupz(buffer2);
804
else
805
- error("bcache file '%s' cannot be read.", buffer2);
805
+ collector_error("bcache file '%s' cannot be read.", buffer2);
806
807
snprintfz(buffer2, FILENAME_MAX, "%s/stats_hour/cache_hit_ratio", buffer);
808
if(access(buffer2, R_OK) == 0)
809
d->bcache_filename_stats_hour_cache_hit_ratio = strdupz(buffer2);
810
else
811
- error("bcache file '%s' cannot be read.", buffer2);
811
+ collector_error("bcache file '%s' cannot be read.", buffer2);
812
813
snprintfz(buffer2, FILENAME_MAX, "%s/stats_day/cache_hit_ratio", buffer);
814
if(access(buffer2, R_OK) == 0)
815
d->bcache_filename_stats_day_cache_hit_ratio = strdupz(buffer2);
816
else
817
- error("bcache file '%s' cannot be read.", buffer2);
817
+ collector_error("bcache file '%s' cannot be read.", buffer2);
818
819
snprintfz(buffer2, FILENAME_MAX, "%s/stats_total/cache_hit_ratio", buffer);
820
if(access(buffer2, R_OK) == 0)
821
d->bcache_filename_stats_total_cache_hit_ratio = strdupz(buffer2);
822
else
823
- error("bcache file '%s' cannot be read.", buffer2);
823
+ collector_error("bcache file '%s' cannot be read.", buffer2);
824
825
snprintfz(buffer2, FILENAME_MAX, "%s/stats_total/cache_misses", buffer);
826
if(access(buffer2, R_OK) == 0)
827
d->bcache_filename_stats_total_cache_misses = strdupz(buffer2);
828
else
829
- error("bcache file '%s' cannot be read.", buffer2);
829
+ collector_error("bcache file '%s' cannot be read.", buffer2);
830
831
snprintfz(buffer2, FILENAME_MAX, "%s/stats_total/cache_bypass_hits", buffer);
832
if(access(buffer2, R_OK) == 0)
833
d->bcache_filename_stats_total_cache_bypass_hits = strdupz(buffer2);
834
else
835
- error("bcache file '%s' cannot be read.", buffer2);
835
+ collector_error("bcache file '%s' cannot be read.", buffer2);
836
837
snprintfz(buffer2, FILENAME_MAX, "%s/stats_total/cache_bypass_misses", buffer);
838
if(access(buffer2, R_OK) == 0)
839
d->bcache_filename_stats_total_cache_bypass_misses = strdupz(buffer2);
840
else
841
- error("bcache file '%s' cannot be read.", buffer2);
841
+ collector_error("bcache file '%s' cannot be read.", buffer2);
842
843
snprintfz(buffer2, FILENAME_MAX, "%s/stats_total/cache_miss_collisions", buffer);
844
if(access(buffer2, R_OK) == 0)
845
d->bcache_filename_stats_total_cache_miss_collisions = strdupz(buffer2);
846
else
847
- error("bcache file '%s' cannot be read.", buffer2);
847
+ collector_error("bcache file '%s' cannot be read.", buffer2);
848
}
849
850
get_disk_config(d);
collectors/proc.plugin/proc_interrupts.c
+2
-2
@@ -78,7 +78,7 @@ int do_proc_interrupts(int update_every, usec_t dt) {
78
size_t words = procfile_linewords(ff, 0);
79
80
if(unlikely(!lines)) {
81
- error("Cannot read /proc/interrupts, zero lines reported.");
81
+ collector_error("Cannot read /proc/interrupts, zero lines reported.");
82
return 1;
83
}
84
@@ -93,7 +93,7 @@ int do_proc_interrupts(int update_every, usec_t dt) {
93
}
94
95
if(unlikely(!cpus)) {
96
- error("PLUGIN: PROC_INTERRUPTS: Cannot find the number of CPUs in /proc/interrupts");
96
+ collector_error("PLUGIN: PROC_INTERRUPTS: Cannot find the number of CPUs in /proc/interrupts");
97
return 1;
98
}
99
collectors/proc.plugin/proc_loadavg.c
+2
-2
@@ -32,11 +32,11 @@ int do_proc_loadavg(int update_every, usec_t dt) {
32
}
33
34
if(unlikely(procfile_lines(ff) < 1)) {
35
- error("/proc/loadavg has no lines.");
35
+ collector_error("/proc/loadavg has no lines.");
36
return 1;
37
}
38
if(unlikely(procfile_linewords(ff, 0) < 6)) {
39
- error("/proc/loadavg has less than 6 words in it.");
39
+ collector_error("/proc/loadavg has less than 6 words in it.");
40
return 1;
41
}
42
collectors/proc.plugin/proc_mdstat.c
+6
-6
@@ -135,7 +135,7 @@ int do_proc_mdstat(int update_every, usec_t dt)
135
size_t words = 0;
136
137
if (unlikely(lines < 2)) {
138
- error("Cannot read /proc/mdstat. Expected 2 or more lines, read %zu.", lines);
138
+ collector_error("Cannot read /proc/mdstat. Expected 2 or more lines, read %zu.", lines);
139
return 1;
140
}
141
@@ -212,7 +212,7 @@ int do_proc_mdstat(int update_every, usec_t dt)
212
213
s = procfile_lineword(ff, l, words - 2);
214
if (unlikely(s[0] != '[')) {
215
- error("Cannot read /proc/mdstat raid health status. Unexpected format: missing opening bracket.");
215
+ collector_error("Cannot read /proc/mdstat raid health status. Unexpected format: missing opening bracket.");
216
continue;
217
}
218
str_total = ++s;
@@ -227,7 +227,7 @@ int do_proc_mdstat(int update_every, usec_t dt)
227
s++;
228
}
229
if (unlikely(str_total[0] == '\0' || !str_inuse || str_inuse[0] == '\0')) {
230
- error("Cannot read /proc/mdstat raid health status. Unexpected format.");
230
+ collector_error("Cannot read /proc/mdstat raid health status. Unexpected format.");
231
continue;
232
}
233
@@ -260,7 +260,7 @@ int do_proc_mdstat(int update_every, usec_t dt)
260
continue;
261
262
if (unlikely(words < 7)) {
263
- error("Cannot read /proc/mdstat line. Expected 7 params, read %zu.", words);
263
+ collector_error("Cannot read /proc/mdstat line. Expected 7 params, read %zu.", words);
264
continue;
265
}
266
@@ -326,9 +326,9 @@ int do_proc_mdstat(int update_every, usec_t dt)
326
raid->mismatch_cnt_filename = strdupz(filename);
327
}
328
if (unlikely(read_single_number_file(raid->mismatch_cnt_filename, &raid->mismatch_cnt))) {
329
- error("Cannot read file '%s'", raid->mismatch_cnt_filename);
329
+ collector_error("Cannot read file '%s'", raid->mismatch_cnt_filename);
330
do_mismatch = CONFIG_BOOLEAN_NO;
331
- error("Monitoring for mismatch count has been disabled");
331
+ collector_error("Monitoring for mismatch count has been disabled");
332
break;
333
}
334
}
collectors/proc.plugin/proc_net_dev.c
+13
-13
@@ -391,7 +391,7 @@ void netdev_rename_device_add(
391
r->processed = 0;
392
netdev_rename_root = r;
393
netdev_pending_renames++;
394
- info("CGROUP: registered network interface rename for '%s' as '%s' under '%s'", r->host_device, r->container_device, r->container_name);
394
+ collector_info("CGROUP: registered network interface rename for '%s' as '%s' under '%s'", r->host_device, r->container_device, r->container_name);
395
}
396
else {
397
if(strcmp(r->container_device, container_device) != 0 || strcmp(r->container_name, container_name) != 0) {
@@ -405,7 +405,7 @@ void netdev_rename_device_add(
405
406
r->processed = 0;
407
netdev_pending_renames++;
408
- info("CGROUP: altered network interface rename for '%s' as '%s' under '%s'", r->host_device, r->container_device, r->container_name);
408
+ collector_info("CGROUP: altered network interface rename for '%s' as '%s' under '%s'", r->host_device, r->container_device, r->container_name);
409
}
410
}
411
@@ -429,7 +429,7 @@ void netdev_rename_device_del(const char *host_device) {
429
if(!r->processed)
430
netdev_pending_renames--;
431
432
- info("CGROUP: unregistered network interface rename for '%s' as '%s' under '%s'", r->host_device, r->container_device, r->container_name);
432
+ collector_info("CGROUP: unregistered network interface rename for '%s' as '%s' under '%s'", r->host_device, r->container_device, r->container_name);
433
434
freez((void *) r->host_device);
435
freez((void *) r->container_name);
@@ -445,7 +445,7 @@ void netdev_rename_device_del(const char *host_device) {
445
}
446
447
static inline void netdev_rename_cgroup(struct netdev *d, struct netdev_rename *r) {
448
- info("CGROUP: renaming network interface '%s' as '%s' under '%s'", r->host_device, r->container_device, r->container_name);
448
+ collector_info("CGROUP: renaming network interface '%s' as '%s' under '%s'", r->host_device, r->container_device, r->container_name);
449
450
netdev_charts_release(d);
451
netdev_free_chart_strings(d);
@@ -560,7 +560,7 @@ static void netdev_cleanup() {
560
struct netdev *d = netdev_root, *last = NULL;
561
while(d) {
562
if(unlikely(!d->updated)) {
563
- // info("Removing network device '%s', linked after '%s'", d->name, last?last->name:"ROOT");
563
+ // collector_info("Removing network device '%s', linked after '%s'", d->name, last?last->name:"ROOT");
564
565
if(netdev_last_used == d)
566
netdev_last_used = last;
@@ -874,7 +874,7 @@ int do_proc_net_dev(int update_every, usec_t dt) {
874
now_monotonic_sec() - d->carrier_file_lost_time > READ_RETRY_PERIOD)) {
875
if (read_single_number_file(d->filename_carrier, &d->carrier)) {
876
if (d->carrier_file_exists)
877
- error(
877
+ collector_error(
878
"Cannot refresh interface %s carrier state by reading '%s'. Next update is in %d seconds.",
879
d->name,
880
d->filename_carrier,
@@ -896,7 +896,7 @@ int do_proc_net_dev(int update_every, usec_t dt) {
896
897
if (read_file(d->filename_duplex, buffer, STATE_LENGTH_MAX)) {
898
if (d->duplex_file_exists)
899
- error("Cannot refresh interface %s duplex state by reading '%s'.", d->name, d->filename_duplex);
899
+ collector_error("Cannot refresh interface %s duplex state by reading '%s'.", d->name, d->filename_duplex);
900
d->duplex_file_exists = 0;
901
d->duplex_file_lost_time = now_monotonic_sec();
902
d->duplex = NETDEV_DUPLEX_UNKNOWN;
@@ -919,7 +919,7 @@ int do_proc_net_dev(int update_every, usec_t dt) {
919
char buffer[STATE_LENGTH_MAX + 1], *trimmed_buffer;
920
921
if (read_file(d->filename_operstate, buffer, STATE_LENGTH_MAX)) {
922
- error(
922
+ collector_error(
923
"Cannot refresh %s operstate by reading '%s'. Will not update its status anymore.",
924
d->name, d->filename_operstate);
925
freez(d->filename_operstate);
@@ -932,14 +932,14 @@ int do_proc_net_dev(int update_every, usec_t dt) {
932
933
if (d->do_mtu != CONFIG_BOOLEAN_NO && d->filename_mtu) {
934
if (read_single_number_file(d->filename_mtu, &d->mtu)) {
935
- error(
935
+ collector_error(
936
"Cannot refresh mtu for interface %s by reading '%s'. Stop updating it.", d->name, d->filename_mtu);
937
freez(d->filename_mtu);
938
d->filename_mtu = NULL;
939
}
940
}
941
942
- //info("PROC_NET_DEV: %s speed %zu, bytes %zu/%zu, packets %zu/%zu/%zu, errors %zu/%zu, drops %zu/%zu, fifo %zu/%zu, compressed %zu/%zu, rframe %zu, tcollisions %zu, tcarrier %zu"
942
+ //collector_info("PROC_NET_DEV: %s speed %zu, bytes %zu/%zu, packets %zu/%zu/%zu, errors %zu/%zu, drops %zu/%zu, fifo %zu/%zu, compressed %zu/%zu, rframe %zu, tcollisions %zu, tcarrier %zu"
943
// , d->name, d->speed
944
// , d->rbytes, d->tbytes
945
// , d->rpackets, d->tpackets, d->rmulticast
@@ -996,7 +996,7 @@ int do_proc_net_dev(int update_every, usec_t dt) {
996
d->chart_var_speed =
997
rrdsetvar_custom_chart_variable_add_and_acquire(d->st_bandwidth, "nic_speed_max");
998
if(!d->chart_var_speed) {
999
- error(
999
+ collector_error(
1000
"Cannot create interface %s chart variable 'nic_speed_max'. Will not update its speed anymore.",
1001
d->name);
1002
freez(d->filename_speed);
@@ -1016,7 +1016,7 @@ int do_proc_net_dev(int update_every, usec_t dt) {
1016
1017
if(ret) {
1018
if (d->speed_file_exists)
1019
- error("Cannot refresh interface %s speed by reading '%s'.", d->name, d->filename_speed);
1019
+ collector_error("Cannot refresh interface %s speed by reading '%s'.", d->name, d->filename_speed);
1020
d->speed_file_exists = 0;
1021
d->speed_file_lost_time = now_monotonic_sec();
1022
}
@@ -1488,7 +1488,7 @@ static void netdev_main_cleanup(void *ptr)
1488
{
1489
UNUSED(ptr);
1490
1491
- info("cleaning up...");
1491
+ collector_info("cleaning up...");
1492
1493
worker_unregister();
1494
}
collectors/proc.plugin/proc_net_netstat.c
+16
-16
@@ -97,7 +97,7 @@ static void parse_line_pair(procfile *ff_netstat, ARL_BASE *base, size_t header_
97
size_t w;
98
99
if(unlikely(vwords > hwords)) {
100
- error("File /proc/net/netstat on header line %zu has %zu words, but on value line %zu has %zu words.", header_line, hwords, values_line, vwords);
100
+ collector_error("File /proc/net/netstat on header line %zu has %zu words, but on value line %zu has %zu words.", header_line, hwords, values_line, vwords);
101
vwords = hwords;
102
}
103
@@ -366,7 +366,7 @@ static void do_proc_net_snmp6(int update_every) {
366
size_t words = procfile_linewords(ff_snmp6, l);
367
if (unlikely(words < 2)) {
368
if (unlikely(words)) {
369
- error("Cannot read /proc/net/snmp6 line %zu. Expected 2 params, read %zu.", l, words);
369
+ collector_error("Cannot read /proc/net/snmp6 line %zu. Expected 2 params, read %zu.", l, words);
370
continue;
371
}
372
}
@@ -1678,7 +1678,7 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
1678
1679
words = procfile_linewords(ff_netstat, l);
1680
if(unlikely(words < 2)) {
1681
- error("Cannot read /proc/net/netstat IpExt line. Expected 2+ params, read %zu.", words);
1681
+ collector_error("Cannot read /proc/net/netstat IpExt line. Expected 2+ params, read %zu.", words);
1682
continue;
1683
}
1684
@@ -1690,7 +1690,7 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
1690
1691
words = procfile_linewords(ff_netstat, l);
1692
if(unlikely(words < 2)) {
1693
- error("Cannot read /proc/net/netstat TcpExt line. Expected 2+ params, read %zu.", words);
1693
+ collector_error("Cannot read /proc/net/netstat TcpExt line. Expected 2+ params, read %zu.", words);
1694
continue;
1695
}
1696
@@ -1721,13 +1721,13 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
1721
size_t h = l++;
1722
1723
if(strcmp(procfile_lineword(ff_snmp, l, 0), "Ip") != 0) {
1724
- error("Cannot read Ip line from /proc/net/snmp.");
1724
+ collector_error("Cannot read Ip line from /proc/net/snmp.");
1725
break;
1726
}
1727
1728
words = procfile_linewords(ff_snmp, l);
1729
if(words < 3) {
1730
- error("Cannot read /proc/net/snmp Ip line. Expected 3+ params, read %zu.", words);
1730
+ collector_error("Cannot read /proc/net/snmp Ip line. Expected 3+ params, read %zu.", words);
1731
continue;
1732
}
1733
@@ -1741,13 +1741,13 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
1741
size_t h = l++;
1742
1743
if(strcmp(procfile_lineword(ff_snmp, l, 0), "Icmp") != 0) {
1744
- error("Cannot read Icmp line from /proc/net/snmp.");
1744
+ collector_error("Cannot read Icmp line from /proc/net/snmp.");
1745
break;
1746
}
1747
1748
words = procfile_linewords(ff_snmp, l);
1749
if(words < 3) {
1750
- error("Cannot read /proc/net/snmp Icmp line. Expected 3+ params, read %zu.", words);
1750
+ collector_error("Cannot read /proc/net/snmp Icmp line. Expected 3+ params, read %zu.", words);
1751
continue;
1752
}
1753
@@ -1761,13 +1761,13 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
1761
size_t h = l++;
1762
1763
if(strcmp(procfile_lineword(ff_snmp, l, 0), "IcmpMsg") != 0) {
1764
- error("Cannot read IcmpMsg line from /proc/net/snmp.");
1764
+ collector_error("Cannot read IcmpMsg line from /proc/net/snmp.");
1765
break;
1766
}
1767
1768
words = procfile_linewords(ff_snmp, l);
1769
if(words < 2) {
1770
- error("Cannot read /proc/net/snmp IcmpMsg line. Expected 2+ params, read %zu.", words);
1770
+ collector_error("Cannot read /proc/net/snmp IcmpMsg line. Expected 2+ params, read %zu.", words);
1771
continue;
1772
}
1773
@@ -1781,13 +1781,13 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
1781
size_t h = l++;
1782
1783
if(strcmp(procfile_lineword(ff_snmp, l, 0), "Tcp") != 0) {
1784
- error("Cannot read Tcp line from /proc/net/snmp.");
1784
+ collector_error("Cannot read Tcp line from /proc/net/snmp.");
1785
break;
1786
}
1787
1788
words = procfile_linewords(ff_snmp, l);
1789
if(words < 3) {
1790
- error("Cannot read /proc/net/snmp Tcp line. Expected 3+ params, read %zu.", words);
1790
+ collector_error("Cannot read /proc/net/snmp Tcp line. Expected 3+ params, read %zu.", words);
1791
continue;
1792
}
1793
@@ -1801,13 +1801,13 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
1801
size_t h = l++;
1802
1803
if(strcmp(procfile_lineword(ff_snmp, l, 0), "Udp") != 0) {
1804
- error("Cannot read Udp line from /proc/net/snmp.");
1804
+ collector_error("Cannot read Udp line from /proc/net/snmp.");
1805
break;
1806
}
1807
1808
words = procfile_linewords(ff_snmp, l);
1809
if(words < 3) {
1810
- error("Cannot read /proc/net/snmp Udp line. Expected 3+ params, read %zu.", words);
1810
+ collector_error("Cannot read /proc/net/snmp Udp line. Expected 3+ params, read %zu.", words);
1811
continue;
1812
}
1813
@@ -1821,13 +1821,13 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
1821
size_t h = l++;
1822
1823
if(strcmp(procfile_lineword(ff_snmp, l, 0), "UdpLite") != 0) {
1824
- error("Cannot read UdpLite line from /proc/net/snmp.");
1824
+ collector_error("Cannot read UdpLite line from /proc/net/snmp.");
1825
break;
1826
}
1827
1828
words = procfile_linewords(ff_snmp, l);
1829
if(words < 3) {
1830
- error("Cannot read /proc/net/snmp UdpLite line. Expected 3+ params, read %zu.", words);
1830
+ collector_error("Cannot read /proc/net/snmp UdpLite line. Expected 3+ params, read %zu.", words);
1831
continue;
1832
}
1833
collectors/proc.plugin/proc_net_rpc_nfs.c
+5
-5
@@ -183,7 +183,7 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
183
184
if(do_net == 1 && strcmp(type, "net") == 0) {
185
if(words < 5) {
186
- error("%s line of /proc/net/rpc/nfs has %zu words, expected %d", type, words, 5);
186
+ collector_error("%s line of /proc/net/rpc/nfs has %zu words, expected %d", type, words, 5);
187
continue;
188
}
189
@@ -198,7 +198,7 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
198
}
199
else if(do_rpc == 1 && strcmp(type, "rpc") == 0) {
200
if(words < 4) {
201
- error("%s line of /proc/net/rpc/nfs has %zu words, expected %d", type, words, 6);
201
+ collector_error("%s line of /proc/net/rpc/nfs has %zu words, expected %d", type, words, 6);
202
continue;
203
}
204
@@ -224,7 +224,7 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
224
225
if(sum == 0ULL) {
226
if(!proc2_warning) {
227
- error("Disabling /proc/net/rpc/nfs v2 procedure calls chart. It seems unused on this machine. It will be enabled automatically when found with data in it.");
227
+ collector_error("Disabling /proc/net/rpc/nfs v2 procedure calls chart. It seems unused on this machine. It will be enabled automatically when found with data in it.");
228
proc2_warning = 1;
229
}
230
do_proc2 = 0;
@@ -245,7 +245,7 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
245
246
if(sum == 0ULL) {
247
if(!proc3_warning) {
248
- info("Disabling /proc/net/rpc/nfs v3 procedure calls chart. It seems unused on this machine. It will be enabled automatically when found with data in it.");
248
+ collector_info("Disabling /proc/net/rpc/nfs v3 procedure calls chart. It seems unused on this machine. It will be enabled automatically when found with data in it.");
249
proc3_warning = 1;
250
}
251
do_proc3 = 0;
@@ -266,7 +266,7 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
266
267
if(sum == 0ULL) {
268
if(!proc4_warning) {
269
- info("Disabling /proc/net/rpc/nfs v4 procedure calls chart. It seems unused on this machine. It will be enabled automatically when found with data in it.");
269
+ collector_info("Disabling /proc/net/rpc/nfs v4 procedure calls chart. It seems unused on this machine. It will be enabled automatically when found with data in it.");
270
proc4_warning = 1;
271
}
272
do_proc4 = 0;
collectors/proc.plugin/proc_net_rpc_nfsd.c
+10
-10
@@ -282,7 +282,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
282
283
if(do_rc == 1 && strcmp(type, "rc") == 0) {
284
if(unlikely(words < 4)) {
285
- error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 4);
285
+ collector_error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 4);
286
continue;
287
}
288
@@ -296,7 +296,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
296
}
297
else if(do_fh == 1 && strcmp(type, "fh") == 0) {
298
if(unlikely(words < 6)) {
299
- error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 6);
299
+ collector_error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 6);
300
continue;
301
}
302
@@ -309,7 +309,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
309
}
310
else if(do_io == 1 && strcmp(type, "io") == 0) {
311
if(unlikely(words < 3)) {
312
- error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 3);
312
+ collector_error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 3);
313
continue;
314
}
315
@@ -322,7 +322,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
322
}
323
else if(do_th == 1 && strcmp(type, "th") == 0) {
324
if(unlikely(words < 13)) {
325
- error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 13);
325
+ collector_error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 13);
326
continue;
327
}
328
@@ -335,7 +335,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
335
}
336
else if(do_net == 1 && strcmp(type, "net") == 0) {
337
if(unlikely(words < 5)) {
338
- error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 5);
338
+ collector_error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 5);
339
continue;
340
}
341
@@ -350,7 +350,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
350
}
351
else if(do_rpc == 1 && strcmp(type, "rpc") == 0) {
352
if(unlikely(words < 6)) {
353
- error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 6);
353
+ collector_error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 6);
354
continue;
355
}
356
@@ -377,7 +377,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
377
378
if(sum == 0ULL) {
379
if(!proc2_warning) {
380
- error("Disabling /proc/net/rpc/nfsd v2 procedure calls chart. It seems unused on this machine. It will be enabled automatically when found with data in it.");
380
+ collector_error("Disabling /proc/net/rpc/nfsd v2 procedure calls chart. It seems unused on this machine. It will be enabled automatically when found with data in it.");
381
proc2_warning = 1;
382
}
383
do_proc2 = 0;
@@ -398,7 +398,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
398
399
if(sum == 0ULL) {
400
if(!proc3_warning) {
401
- info("Disabling /proc/net/rpc/nfsd v3 procedure calls chart. It seems unused on this machine. It will be enabled automatically when found with data in it.");
401
+ collector_info("Disabling /proc/net/rpc/nfsd v3 procedure calls chart. It seems unused on this machine. It will be enabled automatically when found with data in it.");
402
proc3_warning = 1;
403
}
404
do_proc3 = 0;
@@ -419,7 +419,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
419
420
if(sum == 0ULL) {
421
if(!proc4_warning) {
422
- info("Disabling /proc/net/rpc/nfsd v4 procedure calls chart. It seems unused on this machine. It will be enabled automatically when found with data in it.");
422
+ collector_info("Disabling /proc/net/rpc/nfsd v4 procedure calls chart. It seems unused on this machine. It will be enabled automatically when found with data in it.");
423
proc4_warning = 1;
424
}
425
do_proc4 = 0;
@@ -440,7 +440,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
440
441
if(sum == 0ULL) {
442
if(!proc4ops_warning) {
443
- info("Disabling /proc/net/rpc/nfsd v4 operations chart. It seems unused on this machine. It will be enabled automatically when found with data in it.");
443
+ collector_info("Disabling /proc/net/rpc/nfsd v4 operations chart. It seems unused on this machine. It will be enabled automatically when found with data in it.");
444
proc4ops_warning = 1;
445
}
446
do_proc4ops = 0;
collectors/proc.plugin/proc_net_sctp_snmp.c
+1
-1
@@ -113,7 +113,7 @@ int do_proc_net_sctp_snmp(int update_every, usec_t dt) {
113
for(l = 0; l < lines ;l++) {
114
size_t words = procfile_linewords(ff, l);
115
if(unlikely(words < 2)) {
116
- if(unlikely(words)) error("Cannot read /proc/net/sctp/snmp line %zu. Expected 2 params, read %zu.", l, words);
116
+ if(unlikely(words)) collector_error("Cannot read /proc/net/sctp/snmp line %zu. Expected 2 params, read %zu.", l, words);
117
continue;
118
}
119
collectors/proc.plugin/proc_net_softnet_stat.c
+1
-1
@@ -40,7 +40,7 @@ int do_proc_net_softnet_stat(int update_every, usec_t dt) {
40
size_t words = procfile_linewords(ff, 0), w;
41
42
if(unlikely(!lines || !words)) {
43
- error("Cannot read /proc/net/softnet_stat, %zu lines and %zu columns reported.", lines, words);
43
+ collector_error("Cannot read /proc/net/softnet_stat, %zu lines and %zu columns reported.", lines, words);
44
return 1;
45
}
46
collectors/proc.plugin/proc_net_stat_conntrack.c
+1
-1
@@ -69,7 +69,7 @@ int do_proc_net_stat_conntrack(int update_every, usec_t dt) {
69
for(l = 1; l < lines ;l++) {
70
size_t words = procfile_linewords(ff, l);
71
if(unlikely(words < 17)) {
72
- if(unlikely(words)) error("Cannot read /proc/net/stat/nf_conntrack line. Expected 17 params, read %zu.", words);
72
+ if(unlikely(words)) collector_error("Cannot read /proc/net/stat/nf_conntrack line. Expected 17 params, read %zu.", words);
73
continue;
74
}
75
collectors/proc.plugin/proc_net_stat_synproxy.c
+1
-1
@@ -34,7 +34,7 @@ int do_proc_net_stat_synproxy(int update_every, usec_t dt) {
34
// make sure we have 3 lines
35
size_t lines = procfile_lines(ff), l;
36
if(unlikely(lines < 2)) {
37
- error("/proc/net/stat/synproxy has %zu lines, expected no less than 2. Disabling it.", lines);
37
+ collector_error("/proc/net/stat/synproxy has %zu lines, expected no less than 2. Disabling it.", lines);
38
return 1;
39
}
40
collectors/proc.plugin/proc_pagetypeinfo.c
+7
-7
@@ -112,7 +112,7 @@ int do_proc_pagetypeinfo(int update_every, usec_t dt) {
112
113
ff_lines = procfile_lines(ff);
114
if(unlikely(!ff_lines)) {
115
- error("PLUGIN: PROC_PAGETYPEINFO: Cannot read %s, zero lines reported.", ff_path);
115
+ collector_error("PLUGIN: PROC_PAGETYPEINFO: Cannot read %s, zero lines reported.", ff_path);
116
return 1;
117
}
118
@@ -135,21 +135,21 @@ int do_proc_pagetypeinfo(int update_every, usec_t dt) {
135
pagelines_cnt++;
136
}
137
if (pagelines_cnt == 0) {
138
- error("PLUGIN: PROC_PAGETYPEINFO: Unable to parse any valid line in %s", ff_path);
138
+ collector_error("PLUGIN: PROC_PAGETYPEINFO: Unable to parse any valid line in %s", ff_path);
139
return 1;
140
}
141
142
// 4th line is the "Free pages count per migrate type at order". Just subtract these 8 words.
143
pageorders_cnt = procfile_linewords(ff, 3);
144
if (pageorders_cnt < 9) {
145
- error("PLUGIN: PROC_PAGETYPEINFO: Unable to parse Line 4 of %s", ff_path);
145
+ collector_error("PLUGIN: PROC_PAGETYPEINFO: Unable to parse Line 4 of %s", ff_path);
146
return 1;
147
}
148
149
pageorders_cnt -= 9;
150
151
if (pageorders_cnt > MAX_PAGETYPE_ORDER) {
152
- error("PLUGIN: PROC_PAGETYPEINFO: pageorder found (%lu) is higher than max %d",
152
+ collector_error("PLUGIN: PROC_PAGETYPEINFO: pageorder found (%lu) is higher than max %d",
153
(long unsigned int) pageorders_cnt, MAX_PAGETYPE_ORDER);
154
return 1;
155
}
@@ -158,7 +158,7 @@ int do_proc_pagetypeinfo(int update_every, usec_t dt) {
158
if (!pagelines) {
159
pagelines = callocz(pagelines_cnt, sizeof(struct pageline));
160
if (!pagelines) {
161
- error("PLUGIN: PROC_PAGETYPEINFO: Cannot allocate %lu pagelines of %lu B",
161
+ collector_error("PLUGIN: PROC_PAGETYPEINFO: Cannot allocate %lu pagelines of %lu B",
162
(long unsigned int) pagelines_cnt, (long unsigned int) sizeof(struct pageline));
163
return 1;
164
}
@@ -291,8 +291,8 @@ int do_proc_pagetypeinfo(int update_every, usec_t dt) {
291
size_t words = procfile_linewords(ff, l);
292
293
if (words != 7+pageorders_cnt) {
294
- error("PLUGIN: PROC_PAGETYPEINFO: Unable to read line %lu, %lu words found instead of %lu",
295
- l+1, (long unsigned int) words, (long unsigned int) 7+pageorders_cnt);
294
+ collector_error("PLUGIN: PROC_PAGETYPEINFO: Unable to read line %lu, %lu words found instead of %lu",
295
+ l+1, (long unsigned int) words, (long unsigned int) 7+pageorders_cnt);
296
break;
297
}
298
collectors/proc.plugin/proc_pressure.c
+2
-2
@@ -171,7 +171,7 @@ int do_proc_pressure(int update_every, usec_t dt) {
171
172
ff = procfile_open(filename, " =", PROCFILE_FLAG_DEFAULT);
173
if (unlikely(!ff)) {
174
- error("Cannot read pressure information from %s.", filename);
174
+ collector_error("Cannot read pressure information from %s.", filename);
175
fail_count++;
176
continue;
177
}
@@ -186,7 +186,7 @@ int do_proc_pressure(int update_every, usec_t dt) {
186
187
size_t lines = procfile_lines(ff);
188
if (unlikely(lines < 1)) {
189
- error("%s has no lines.", procfile_filename(ff));
189
+ collector_error("%s has no lines.", procfile_filename(ff));
190
fail_count++;
191
continue;
192
}
collectors/proc.plugin/proc_self_mountinfo.c
+2
-2
@@ -253,7 +253,7 @@ struct mountinfo *mountinfo_read(int do_statvfs) {
253
for(minor = major; *minor && *minor != ':' ;minor++) ;
254
255
if(unlikely(!*minor)) {
256
- error("Cannot parse major:minor on '%s' at line %lu of '%s'", major, l + 1, filename);
256
+ collector_error("Cannot parse major:minor on '%s' at line %lu of '%s'", major, l + 1, filename);
257
freez(mi);
258
continue;
259
}
@@ -443,7 +443,7 @@ struct mountinfo *mountinfo_read(int do_statvfs) {
443
444
#ifdef NETDATA_INTERNAL_CHECKS
445
if(unlikely(!mi)) {
446
- error("Mount point '%s' not found in /proc/self/mountinfo", mnt->mnt_dir);
446
+ collector_error("Mount point '%s' not found in /proc/self/mountinfo", mnt->mnt_dir);
447
}
448
#endif
449
}
collectors/proc.plugin/proc_softirqs.c
+2
-2
@@ -75,7 +75,7 @@ int do_proc_softirqs(int update_every, usec_t dt) {
75
size_t words = procfile_linewords(ff, 0);
76
77
if(unlikely(!lines)) {
78
- error("Cannot read /proc/softirqs, zero lines reported.");
78
+ collector_error("Cannot read /proc/softirqs, zero lines reported.");
79
return 1;
80
}
81
@@ -90,7 +90,7 @@ int do_proc_softirqs(int update_every, usec_t dt) {
90
}
91
92
if(unlikely(!cpus)) {
93
- error("PLUGIN: PROC_SOFTIRQS: Cannot find the number of CPUs in /proc/softirqs");
93
+ collector_error("PLUGIN: PROC_SOFTIRQS: Cannot find the number of CPUs in /proc/softirqs");
94
return 1;
95
}
96
collectors/proc.plugin/proc_spl_kstat_zfs.c
+5
-5
@@ -140,7 +140,7 @@ int do_proc_spl_kstat_zfs_arcstats(int update_every, usec_t dt) {
140
if(likely(!do_zfs_stats)) {
141
DIR *dir = opendir(dirname);
142
if(unlikely(!dir)) {
143
- error("Cannot read directory '%s'", dirname);
143
+ collector_error("Cannot read directory '%s'", dirname);
144
return 1;
145
}
146
@@ -177,7 +177,7 @@ int do_proc_spl_kstat_zfs_arcstats(int update_every, usec_t dt) {
177
for(l = 0; l < lines ;l++) {
178
size_t words = procfile_linewords(ff, l);
179
if(unlikely(words < 3)) {
180
- if(unlikely(words)) error("Cannot read " ZFS_PROC_ARCSTATS " line %zu. Expected 3 params, read %zu.", l, words);
180
+ if(unlikely(words)) collector_error("Cannot read " ZFS_PROC_ARCSTATS " line %zu. Expected 3 params, read %zu.", l, words);
181
continue;
182
}
183
@@ -330,7 +330,7 @@ int do_proc_spl_kstat_zfs_pool_state(int update_every, usec_t dt)
330
if (likely(do_zfs_pool_state)) {
331
DIR *dir = opendir(dirname);
332
if (unlikely(!dir)) {
333
- error("Cannot read directory '%s'", dirname);
333
+ collector_error("Cannot read directory '%s'", dirname);
334
return 1;
335
}
336
@@ -394,7 +394,7 @@ int do_proc_spl_kstat_zfs_pool_state(int update_every, usec_t dt)
394
char *c = strchr(state, '\n');
395
if (c)
396
*c = '\0';
397
- error("ZFS POOLS: Undefined state %s for zpool %s, disabling the chart", state, de->d_name);
397
+ collector_error("ZFS POOLS: Undefined state %s for zpool %s, disabling the chart", state, de->d_name);
398
}
399
}
400
}
@@ -404,7 +404,7 @@ int do_proc_spl_kstat_zfs_pool_state(int update_every, usec_t dt)
404
}
405
406
if (do_zfs_pool_state && pool_found && !state_file_found) {
407
- info("ZFS POOLS: State files not found. Disabling the module.");
407
+ collector_info("ZFS POOLS: State files not found. Disabling the module.");
408
do_zfs_pool_state = 0;
409
}
410
collectors/proc.plugin/proc_stat.c
+21
-21
@@ -69,7 +69,7 @@ static int read_per_core_files(struct cpu_chart *all_cpu_charts, size_t len, siz
69
if(unlikely(f->fd == -1)) {
70
f->fd = open(f->filename, O_RDONLY);
71
if (unlikely(f->fd == -1)) {
72
- error("Cannot open file '%s'", f->filename);
72
+ collector_error("Cannot open file '%s'", f->filename);
73
continue;
74
}
75
}
@@ -78,7 +78,7 @@ static int read_per_core_files(struct cpu_chart *all_cpu_charts, size_t len, siz
78
if(unlikely(ret < 0)) {
79
// cannot read that file
80
81
- error("Cannot read file '%s'", f->filename);
81
+ collector_error("Cannot read file '%s'", f->filename);
82
close(f->fd);
83
f->fd = -1;
84
continue;
@@ -94,7 +94,7 @@ static int read_per_core_files(struct cpu_chart *all_cpu_charts, size_t len, siz
94
f->fd = -1;
95
}
96
else if(lseek(f->fd, 0, SEEK_SET) == -1) {
97
- error("Cannot seek in file '%s'", f->filename);
97
+ collector_error("Cannot seek in file '%s'", f->filename);
98
close(f->fd);
99
f->fd = -1;
100
}
@@ -133,14 +133,14 @@ static int read_per_core_time_in_state_files(struct cpu_chart *all_cpu_charts, s
133
tsf->ff = procfile_open(tsf->filename, " \t:", PROCFILE_FLAG_DEFAULT);
134
if(unlikely(!tsf->ff))
135
{
136
- error("Cannot open file '%s'", tsf->filename);
136
+ collector_error("Cannot open file '%s'", tsf->filename);
137
continue;
138
}
139
}
140
141
tsf->ff = procfile_readall(tsf->ff);
142
if(unlikely(!tsf->ff)) {
143
- error("Cannot read file '%s'", tsf->filename);
143
+ collector_error("Cannot read file '%s'", tsf->filename);
144
procfile_close(tsf->ff);
145
tsf->ff = NULL;
146
continue;
@@ -179,7 +179,7 @@ static int read_per_core_time_in_state_files(struct cpu_chart *all_cpu_charts, s
179
180
words = procfile_linewords(tsf->ff, l);
181
if(unlikely(words < 2)) {
182
- error("Cannot read time_in_state line. Expected 2 params, read %zu.", words);
182
+ collector_error("Cannot read time_in_state line. Expected 2 params, read %zu.", words);
183
continue;
184
}
185
frequency = str2ull(procfile_lineword(tsf->ff, l, 0));
@@ -273,11 +273,11 @@ static void* wake_cpu_thread(void* core) {
273
thread = pthread_self();
274
if(unlikely(pthread_setaffinity_np(thread, sizeof(cpu_set_t), &cpu_set))) {
275
if(unlikely(errors < 8)) {
276
- error("Cannot set CPU affinity for core %d", *(int*)core);
276
+ collector_error("Cannot set CPU affinity for core %d", *(int*)core);
277
errors++;
278
}
279
else if(unlikely(errors < 9)) {
280
- error("CPU affinity errors are disabled");
280
+ collector_error("CPU affinity errors are disabled");
281
errors++;
282
}
283
}
@@ -312,14 +312,14 @@ static int read_schedstat(char *schedstat_filename, struct per_core_cpuidle_char
312
if(likely(row_key[0] == 'c' && row_key[1] == 'p' && row_key[2] == 'u')) {
313
words = procfile_linewords(ff, l);
314
if(unlikely(words < 10)) {
315
- error("Cannot read /proc/schedstat cpu line. Expected 9 params, read %zu.", words);
315
+ collector_error("Cannot read /proc/schedstat cpu line. Expected 9 params, read %zu.", words);
316
return 1;
317
}
318
cores_found++;
319
320
size_t core = str2ul(&row_key[3]);
321
if(unlikely(core >= cores_found)) {
322
- error("Core %zu found but no more than %zu cores were expected.", core, cores_found);
322
+ collector_error("Core %zu found but no more than %zu cores were expected.", core, cores_found);
323
return 1;
324
}
325
@@ -343,7 +343,7 @@ static int read_one_state(char *buf, const char *filename, int *fd) {
343
344
if(unlikely(ret <= 0)) {
345
// cannot read that file
346
- error("Cannot read file '%s'", filename);
346
+ collector_error("Cannot read file '%s'", filename);
347
close(*fd);
348
*fd = -1;
349
return 0;
@@ -359,7 +359,7 @@ static int read_one_state(char *buf, const char *filename, int *fd) {
359
*fd = -1;
360
}
361
else if(lseek(*fd, 0, SEEK_SET) == -1) {
362
- error("Cannot seek in file '%s'", filename);
362
+ collector_error("Cannot seek in file '%s'", filename);
363
close(*fd);
364
*fd = -1;
365
}
@@ -413,14 +413,14 @@ static int read_cpuidle_states(char *cpuidle_name_filename , char *cpuidle_time_
413
414
int fd = open(filename, O_RDONLY, 0666);
415
if(unlikely(fd == -1)) {
416
- error("Cannot open file '%s'", filename);
416
+ collector_error("Cannot open file '%s'", filename);
417
cc->rescan_cpu_states = 1;
418
return 1;
419
}
420
421
ssize_t r = read(fd, name_buf, 50);
422
if(unlikely(r < 1)) {
423
- error("Cannot read file '%s'", filename);
423
+ collector_error("Cannot read file '%s'", filename);
424
close(fd);
425
cc->rescan_cpu_states = 1;
426
return 1;
@@ -445,7 +445,7 @@ static int read_cpuidle_states(char *cpuidle_name_filename , char *cpuidle_time_
445
if(unlikely(cs->time_fd == -1)) {
446
cs->time_fd = open(cs->time_filename, O_RDONLY);
447
if (unlikely(cs->time_fd == -1)) {
448
- error("Cannot open file '%s'", cs->time_filename);
448
+ collector_error("Cannot open file '%s'", cs->time_filename);
449
cc->rescan_cpu_states = 1;
450
return 1;
451
}
@@ -585,7 +585,7 @@ int do_proc_stat(int update_every, usec_t dt) {
585
if(likely(row_key[0] == 'c' && row_key[1] == 'p' && row_key[2] == 'u')) {
586
words = procfile_linewords(ff, l);
587
if(unlikely(words < 9)) {
588
- error("Cannot read /proc/stat cpu line. Expected 9 params, read %zu.", words);
588
+ collector_error("Cannot read /proc/stat cpu line. Expected 9 params, read %zu.", words);
589
continue;
590
}
591
@@ -936,7 +936,7 @@ int do_proc_stat(int update_every, usec_t dt) {
936
if(r > 0 && !accurate_freq_is_used) {
937
accurate_freq_is_used = 1;
938
snprintfz(filename, FILENAME_MAX, time_in_state_filename, "cpu*");
939
- info("cpufreq is using %s", filename);
939
+ collector_info("cpufreq is using %s", filename);
940
}
941
}
942
if (r < 1) {
@@ -944,7 +944,7 @@ int do_proc_stat(int update_every, usec_t dt) {
944
if(accurate_freq_is_used) {
945
accurate_freq_is_used = 0;
946
snprintfz(filename, FILENAME_MAX, scaling_cur_freq_filename, "cpu*");
947
- info("cpufreq fell back to %s", filename);
947
+ collector_info("cpufreq fell back to %s", filename);
948
}
949
}
950
@@ -999,13 +999,13 @@ int do_proc_stat(int update_every, usec_t dt) {
999
}
1000
}
1001
else
1002
- error("Cannot read current process affinity");
1002
+ collector_error("Cannot read current process affinity");
1003
1004
// These threads are very ephemeral and don't need to have a specific name
1005
if(unlikely(pthread_create(&thread, NULL, wake_cpu_thread, (void *)&core)))
1006
- error("Cannot create wake_cpu_thread");
1006
+ collector_error("Cannot create wake_cpu_thread");
1007
else if(unlikely(pthread_join(thread, NULL)))
1008
- error("Cannot join wake_cpu_thread");
1008
+ collector_error("Cannot join wake_cpu_thread");
1009
cpu_states_updated = 1;
1010
}
1011
}
collectors/proc.plugin/proc_vmstat.c
+1
-1
@@ -100,7 +100,7 @@ int do_proc_vmstat(int update_every, usec_t dt) {
100
for(l = 0; l < lines ;l++) {
101
size_t words = procfile_linewords(ff, l);
102
if(unlikely(words < 2)) {
103
- if(unlikely(words)) error("Cannot read /proc/vmstat line %zu. Expected 2 params, read %zu.", l, words);
103
+ if(unlikely(words)) collector_error("Cannot read /proc/vmstat line %zu. Expected 2 params, read %zu.", l, words);
104
continue;
105
}
106
collectors/proc.plugin/sys_block_zram.c
+5
-5
@@ -144,17 +144,17 @@ static int init_devices(DICTIONARY *devices, unsigned int zram_id, int update_ev
144
snprintfz(filename, FILENAME_MAX, "/dev/%s", de->d_name);
145
if (unlikely(stat(filename, &st) != 0))
146
{
147
- error("ZRAM : Unable to stat %s: %s", filename, strerror(errno));
147
+ collector_error("ZRAM : Unable to stat %s: %s", filename, strerror(errno));
148
continue;
149
}
150
if (major(st.st_rdev) == zram_id)
151
{
152
- info("ZRAM : Found device %s", filename);
152
+ collector_info("ZRAM : Found device %s", filename);
153
snprintfz(filename, FILENAME_MAX, "/sys/block/%s/mm_stat", de->d_name);
154
ff = procfile_open(filename, " \t:", PROCFILE_FLAG_DEFAULT);
155
if (ff == NULL)
156
{
157
- error("ZRAM : Failed to open %s: %s", filename, strerror(errno));
157
+ collector_error("ZRAM : Failed to open %s: %s", filename, strerror(errno));
158
continue;
159
}
160
device.file = ff;
@@ -170,7 +170,7 @@ static int init_devices(DICTIONARY *devices, unsigned int zram_id, int update_ev
170
static void free_device(DICTIONARY *dict, const char *name)
171
{
172
ZRAM_DEVICE *d = (ZRAM_DEVICE*)dictionary_get(dict, name);
173
- info("ZRAM : Disabling monitoring of device %s", name);
173
+ collector_info("ZRAM : Disabling monitoring of device %s", name);
174
rrdset_obsolete_and_pointer_null(d->st_usage);
175
rrdset_obsolete_and_pointer_null(d->st_savings);
176
rrdset_obsolete_and_pointer_null(d->st_alloc_efficiency);
@@ -252,7 +252,7 @@ int do_sys_block_zram(int update_every, usec_t dt) {
252
ff = procfile_open("/proc/devices", " \t:", PROCFILE_FLAG_DEFAULT);
253
if (ff == NULL)
254
{
255
- error("Cannot read /proc/devices");
255
+ collector_error("Cannot read /proc/devices");
256
return 1;
257
}
258
ff = procfile_readall(ff);
collectors/proc.plugin/sys_class_infiniband.c
+10
-11
@@ -200,7 +200,7 @@ static struct ibport {
200
#define GEN_DO_HWCOUNTER_READ(NAME, GRP, DESC, DIR, PORT, HW, ...) \
201
if (HW->file_##NAME) { \
202
if (read_single_number_file(HW->file_##NAME, (unsigned long long *)&HW->NAME)) { \
203
- error("cannot read iface '%s' hwcounter '" #HW "'", PORT->name); \
203
+ collector_error("cannot read iface '%s' hwcounter '" #HW "'", PORT->name); \
204
HW->file_##NAME = NULL; \
205
} \
206
}
@@ -469,7 +469,7 @@ int do_sys_class_infiniband(int update_every, usec_t dt)
469
snprintfz(buffer, FILENAME_MAX, "%s/%s/%s", ports_dirname, port_dent->d_name, "rate");
470
char buffer_rate[65];
471
if (read_file(buffer, buffer_rate, 64)) {
472
- error("Unable to read '%s'", buffer);
472
+ collector_error("Unable to read '%s'", buffer);
473
p->width = 1;
474
} else {
475
char *buffer_width = strstr(buffer_rate, "(");
@@ -480,12 +480,11 @@ int do_sys_class_infiniband(int update_every, usec_t dt)
480
}
481
482
if (!p->discovered)
483
- info(
484
- "Infiniband card %s port %s at speed %" PRIu64 " width %" PRIu64 "",
485
- dev_dent->d_name,
486
- port_dent->d_name,
487
- p->speed,
488
- p->width);
483
+ collector_info("Infiniband card %s port %s at speed %" PRIu64 " width %" PRIu64 "",
484
+ dev_dent->d_name,
485
+ port_dent->d_name,
486
+ p->speed,
487
+ p->width);
488
489
p->discovered = 1;
490
}
@@ -511,7 +510,7 @@ int do_sys_class_infiniband(int update_every, usec_t dt)
510
#define GEN_DO_COUNTER_READ(NAME, GRP, DESC, DIR, PORT, ...) \
511
if (PORT->file_##NAME) { \
512
if (read_single_number_file(PORT->file_##NAME, (unsigned long long *)&PORT->NAME)) { \
514
- error("cannot read iface '%s' counter '" #NAME "'", PORT->name); \
513
+ collector_error("cannot read iface '%s' counter '" #NAME "'", PORT->name); \
514
PORT->file_##NAME = NULL; \
515
} \
516
}
@@ -650,7 +649,7 @@ int do_sys_class_infiniband(int update_every, usec_t dt)
649
650
// Unknown vendor, should not happen
651
else {
653
- error(
652
+ collector_error(
653
"Unmanaged vendor for '%s', do_hwerrors should have been set to no. Please report this bug",
654
port->name);
655
port->do_hwerrors = CONFIG_BOOLEAN_NO;
@@ -686,7 +685,7 @@ int do_sys_class_infiniband(int update_every, usec_t dt)
685
686
// Unknown vendor, should not happen
687
else {
689
- error(
688
+ collector_error(
689
"Unmanaged vendor for '%s', do_hwpackets should have been set to no. Please report this bug",
690
port->name);
691
port->do_hwpackets = CONFIG_BOOLEAN_NO;
collectors/proc.plugin/sys_class_power_supply.c
+7
-7
@@ -137,7 +137,7 @@ int do_sys_class_power_supply(int update_every, usec_t dt) {
137
138
DIR *dir = opendir(dirname);
139
if(unlikely(!dir)) {
140
- error("Cannot read directory '%s'", dirname);
140
+ collector_error("Cannot read directory '%s'", dirname);
141
return 1;
142
}
143
@@ -247,7 +247,7 @@ int do_sys_class_power_supply(int update_every, usec_t dt) {
247
if(unlikely(ps->capacity->fd == -1)) {
248
ps->capacity->fd = open(ps->capacity->filename, O_RDONLY, 0666);
249
if(unlikely(ps->capacity->fd == -1)) {
250
- error("Cannot open file '%s'", ps->capacity->filename);
250
+ collector_error("Cannot open file '%s'", ps->capacity->filename);
251
power_supply_free(ps);
252
ps = NULL;
253
}
@@ -257,7 +257,7 @@ int do_sys_class_power_supply(int update_every, usec_t dt) {
257
{
258
ssize_t r = read(ps->capacity->fd, buffer, 30);
259
if(unlikely(r < 1)) {
260
- error("Cannot read file '%s'", ps->capacity->filename);
260
+ collector_error("Cannot read file '%s'", ps->capacity->filename);
261
power_supply_free(ps);
262
ps = NULL;
263
}
@@ -270,7 +270,7 @@ int do_sys_class_power_supply(int update_every, usec_t dt) {
270
ps->capacity->fd = -1;
271
}
272
else if(unlikely(lseek(ps->capacity->fd, 0, SEEK_SET) == -1)) {
273
- error("Cannot seek in file '%s'", ps->capacity->filename);
273
+ collector_error("Cannot seek in file '%s'", ps->capacity->filename);
274
close(ps->capacity->fd);
275
ps->capacity->fd = -1;
276
}
@@ -292,7 +292,7 @@ int do_sys_class_power_supply(int update_every, usec_t dt) {
292
if(unlikely(pd->fd == -1)) {
293
pd->fd = open(pd->filename, O_RDONLY, 0666);
294
if(unlikely(pd->fd == -1)) {
295
- error("Cannot open file '%s'", pd->filename);
295
+ collector_error("Cannot open file '%s'", pd->filename);
296
read_error = 1;
297
power_supply_free(ps);
298
break;
@@ -301,7 +301,7 @@ int do_sys_class_power_supply(int update_every, usec_t dt) {
301
302
ssize_t r = read(pd->fd, buffer, 30);
303
if(unlikely(r < 1)) {
304
- error("Cannot read file '%s'", pd->filename);
304
+ collector_error("Cannot read file '%s'", pd->filename);
305
read_error = 1;
306
power_supply_free(ps);
307
break;
@@ -314,7 +314,7 @@ int do_sys_class_power_supply(int update_every, usec_t dt) {
314
pd->fd = -1;
315
}
316
else if(unlikely(lseek(pd->fd, 0, SEEK_SET) == -1)) {
317
- error("Cannot seek in file '%s'", pd->filename);
317
+ collector_error("Cannot seek in file '%s'", pd->filename);
318
close(pd->fd);
319
pd->fd = -1;
320
}
collectors/proc.plugin/sys_devices_system_edac_mc.c
+1
-1
@@ -30,7 +30,7 @@ static void find_all_mc() {
30
31
DIR *dir = opendir(dirname);
32
if(unlikely(!dir)) {
33
- error("Cannot read ECC memory errors directory '%s'", dirname);
33
+ collector_error("Cannot read ECC memory errors directory '%s'", dirname);
34
return;
35
}
36
collectors/proc.plugin/sys_devices_system_node.c
+2
-2
@@ -19,7 +19,7 @@ static int find_all_nodes() {
19
20
DIR *dir = opendir(dirname);
21
if(!dir) {
22
- error("Cannot read NUMA node directory '%s'", dirname);
22
+ collector_error("Cannot read NUMA node directory '%s'", dirname);
23
return 0;
24
}
25
@@ -134,7 +134,7 @@ int do_proc_sys_devices_system_node(int update_every, usec_t dt) {
134
135
if(unlikely(words < 2)) {
136
if(unlikely(words))
137
- error("Cannot read %s numastat line %zu. Expected 2 params, read %zu.", m->name, l, words);
137
+ collector_error("Cannot read %s numastat line %zu. Expected 2 params, read %zu.", m->name, l, words);
138
continue;
139
}
140
collectors/proc.plugin/sys_fs_btrfs.c
+20
-20
@@ -90,7 +90,7 @@ static inline void btrfs_free_disk(BTRFS_DISK *d) {
90
}
91
92
static inline void btrfs_free_node(BTRFS_NODE *node) {
93
- // info("BTRFS: destroying '%s'", node->id);
93
+ // collector_info("BTRFS: destroying '%s'", node->id);
94
95
if(node->st_allocation_disks)
96
rrdset_is_obsolete(node->st_allocation_disks);
@@ -136,7 +136,7 @@ static inline int find_btrfs_disks(BTRFS_NODE *node, const char *path) {
136
DIR *dir = opendir(path);
137
if (!dir) {
138
if(!node->logged_error) {
139
- error("BTRFS: Cannot open directory '%s'.", path);
139
+ collector_error("BTRFS: Cannot open directory '%s'.", path);
140
node->logged_error = 1;
141
}
142
return 1;
@@ -149,7 +149,7 @@ static inline int find_btrfs_disks(BTRFS_NODE *node, const char *path) {
149
|| !strcmp(de->d_name, ".")
150
|| !strcmp(de->d_name, "..")
151
) {
152
- // info("BTRFS: ignoring '%s'", de->d_name);
152
+ // collector_info("BTRFS: ignoring '%s'", de->d_name);
153
continue;
154
}
155
@@ -200,13 +200,13 @@ static inline int find_btrfs_disks(BTRFS_NODE *node, const char *path) {
200
// update the values
201
202
if(read_single_number_file(d->size_filename, &d->size) != 0) {
203
- error("BTRFS: failed to read '%s'", d->size_filename);
203
+ collector_error("BTRFS: failed to read '%s'", d->size_filename);
204
d->exists = 0;
205
continue;
206
}
207
208
if(read_single_number_file(d->hw_sector_size_filename, &d->hw_sector_size) != 0) {
209
- error("BTRFS: failed to read '%s'", d->hw_sector_size_filename);
209
+ collector_error("BTRFS: failed to read '%s'", d->hw_sector_size_filename);
210
d->exists = 0;
211
continue;
212
}
@@ -257,7 +257,7 @@ static inline int find_all_btrfs_pools(const char *path) {
257
DIR *dir = opendir(path);
258
if (!dir) {
259
if(!logged_error) {
260
- error("BTRFS: Cannot open directory '%s'.", path);
260
+ collector_error("BTRFS: Cannot open directory '%s'.", path);
261
logged_error = 1;
262
}
263
return 1;
@@ -271,7 +271,7 @@ static inline int find_all_btrfs_pools(const char *path) {
271
|| !strcmp(de->d_name, "..")
272
|| !strcmp(de->d_name, "features")
273
) {
274
- // info("BTRFS: ignoring '%s'", de->d_name);
274
+ // collector_info("BTRFS: ignoring '%s'", de->d_name);
275
continue;
276
}
277
@@ -285,7 +285,7 @@ static inline int find_all_btrfs_pools(const char *path) {
285
286
// did we find it?
287
if(node) {
288
- // info("BTRFS: already exists '%s'", de->d_name);
288
+ // collector_info("BTRFS: already exists '%s'", de->d_name);
289
node->exists = 1;
290
291
// update the disk sizes
@@ -295,7 +295,7 @@ static inline int find_all_btrfs_pools(const char *path) {
295
continue;
296
}
297
298
- // info("BTRFS: adding '%s'", de->d_name);
298
+ // collector_info("BTRFS: adding '%s'", de->d_name);
299
300
// not found, create it
301
node = callocz(sizeof(BTRFS_NODE), 1);
@@ -309,7 +309,7 @@ static inline int find_all_btrfs_pools(const char *path) {
309
310
snprintfz(filename, FILENAME_MAX, "%s/%s/label", path, de->d_name);
311
if(read_file(filename, label, FILENAME_MAX) != 0) {
312
- error("BTRFS: failed to read '%s'", filename);
312
+ collector_error("BTRFS: failed to read '%s'", filename);
313
btrfs_free_node(node);
314
continue;
315
}
@@ -326,21 +326,21 @@ static inline int find_all_btrfs_pools(const char *path) {
326
327
//snprintfz(filename, FILENAME_MAX, "%s/%s/sectorsize", path, de->d_name);
328
//if(read_single_number_file(filename, &node->sectorsize) != 0) {
329
- // error("BTRFS: failed to read '%s'", filename);
329
+ // collector_error("BTRFS: failed to read '%s'", filename);
330
// btrfs_free_node(node);
331
// continue;
332
//}
333
334
//snprintfz(filename, FILENAME_MAX, "%s/%s/nodesize", path, de->d_name);
335
//if(read_single_number_file(filename, &node->nodesize) != 0) {
336
- // error("BTRFS: failed to read '%s'", filename);
336
+ // collector_error("BTRFS: failed to read '%s'", filename);
337
// btrfs_free_node(node);
338
// continue;
339
//}
340
341
//snprintfz(filename, FILENAME_MAX, "%s/%s/quota_override", path, de->d_name);
342
//if(read_single_number_file(filename, &node->quota_override) != 0) {
343
- // error("BTRFS: failed to read '%s'", filename);
343
+ // collector_error("BTRFS: failed to read '%s'", filename);
344
// btrfs_free_node(node);
345
// continue;
346
//}
@@ -351,7 +351,7 @@ static inline int find_all_btrfs_pools(const char *path) {
351
#define init_btrfs_allocation_field(FIELD) {\
352
snprintfz(filename, FILENAME_MAX, "%s/%s/allocation/" #FIELD, path, de->d_name); \
353
if(read_single_number_file(filename, &node->allocation_ ## FIELD) != 0) {\
354
- error("BTRFS: failed to read '%s'", filename);\
354
+ collector_error("BTRFS: failed to read '%s'", filename);\
355
btrfs_free_node(node);\
356
continue;\
357
}\
@@ -362,7 +362,7 @@ static inline int find_all_btrfs_pools(const char *path) {
362
#define init_btrfs_allocation_section_field(SECTION, FIELD) {\
363
snprintfz(filename, FILENAME_MAX, "%s/%s/allocation/" #SECTION "/" #FIELD, path, de->d_name); \
364
if(read_single_number_file(filename, &node->allocation_ ## SECTION ## _ ## FIELD) != 0) {\
365
- error("BTRFS: failed to read '%s'", filename);\
365
+ collector_error("BTRFS: failed to read '%s'", filename);\
366
btrfs_free_node(node);\
367
continue;\
368
}\
@@ -411,7 +411,7 @@ static inline int find_all_btrfs_pools(const char *path) {
411
// --------------------------------------------------------------------
412
// link it
413
414
- // info("BTRFS: linking '%s'", node->id);
414
+ // collector_info("BTRFS: linking '%s'", node->id);
415
node->next = nodes;
416
nodes = node;
417
}
@@ -505,7 +505,7 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
505
|| collect_btrfs_allocation_section_field(metadata, disk_used) != 0
506
|| collect_btrfs_allocation_section_field(system, disk_total) != 0
507
|| collect_btrfs_allocation_section_field(system, disk_used) != 0) {
508
- error("BTRFS: failed to collect physical disks allocation for '%s'", node->id);
508
+ collector_error("BTRFS: failed to collect physical disks allocation for '%s'", node->id);
509
// make it refresh btrfs at the next iteration
510
refresh_delta = refresh_every;
511
continue;
@@ -515,7 +515,7 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
515
if(do_allocation_data != CONFIG_BOOLEAN_NO) {
516
if (collect_btrfs_allocation_section_field(data, total_bytes) != 0
517
|| collect_btrfs_allocation_section_field(data, bytes_used) != 0) {
518
- error("BTRFS: failed to collect allocation/data for '%s'", node->id);
518
+ collector_error("BTRFS: failed to collect allocation/data for '%s'", node->id);
519
// make it refresh btrfs at the next iteration
520
refresh_delta = refresh_every;
521
continue;
@@ -527,7 +527,7 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
527
|| collect_btrfs_allocation_section_field(metadata, bytes_used) != 0
528
|| collect_btrfs_allocation_field(global_rsv_size) != 0
529
) {
530
- error("BTRFS: failed to collect allocation/metadata for '%s'", node->id);
530
+ collector_error("BTRFS: failed to collect allocation/metadata for '%s'", node->id);
531
// make it refresh btrfs at the next iteration
532
refresh_delta = refresh_every;
533
continue;
@@ -537,7 +537,7 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
537
if(do_allocation_system != CONFIG_BOOLEAN_NO) {
538
if (collect_btrfs_allocation_section_field(system, total_bytes) != 0
539
|| collect_btrfs_allocation_section_field(system, bytes_used) != 0) {
540
- error("BTRFS: failed to collect allocation/system for '%s'", node->id);
540
+ collector_error("BTRFS: failed to collect allocation/system for '%s'", node->id);
541
// make it refresh btrfs at the next iteration
542
refresh_delta = refresh_every;
543
continue;
collectors/slabinfo.plugin/slabinfo.c
+5
-4
@@ -142,14 +142,14 @@ struct slabinfo *read_file_slabinfo() {
142
if(unlikely(!ff)) {
143
ff = procfile_reopen(ff, PLUGIN_SLABINFO_PROCFILE, " ,:" , PROCFILE_FLAG_DEFAULT);
144
if(unlikely(!ff)) {
145
- error("<- Cannot open file '%s", PLUGIN_SLABINFO_PROCFILE);
145
+ collector_error("<- Cannot open file '%s", PLUGIN_SLABINFO_PROCFILE);
146
exit(1);
147
}
148
}
149
150
ff = procfile_readall(ff);
151
if(unlikely(!ff)) {
152
- error("<- Cannot read file '%s'", PLUGIN_SLABINFO_PROCFILE);
152
+ collector_error("<- Cannot read file '%s'", PLUGIN_SLABINFO_PROCFILE);
153
exit(0);
154
}
155
@@ -336,6 +336,7 @@ void usage(void) {
336
}
337
338
int main(int argc, char **argv) {
339
+ stderror = stderr;
340
clocks_init();
341
342
program_name = argv[0];
@@ -350,7 +351,7 @@ int main(int argc, char **argv) {
351
n = (int) str2l(argv[i]);
352
if (n > 0) {
353
if (n >= UPDATE_EVERY_MAX) {
353
- error("Invalid interval value: %s", argv[i]);
354
+ collector_error("Invalid interval value: %s", argv[i]);
355
exit(1);
356
}
357
freq = n;
@@ -383,7 +384,7 @@ int main(int argc, char **argv) {
384
if(freq >= update_every)
385
update_every = freq;
386
else if(freq)
386
- error("update frequency %d seconds is too small for slabinfo. Using %d.", freq, update_every);
387
+ collector_error("update frequency %d seconds is too small for slabinfo. Using %d.", freq, update_every);
388
389
390
// Call the main function. Time drift to be added
collectors/statsd.plugin/statsd.c
+17
-17
@@ -434,7 +434,7 @@ static inline NETDATA_DOUBLE statsd_parse_float(const char *v, NETDATA_DOUBLE de
434
char *e = NULL;
435
value = str2ndd(v, &e);
436
if(unlikely(e && *e))
437
- error("STATSD: excess data '%s' after value '%s'", e, v);
437
+ collector_error("STATSD: excess data '%s' after value '%s'", e, v);
438
}
439
else
440
value = def;
@@ -456,7 +456,7 @@ static inline long long statsd_parse_int(const char *v, long long def) {
456
char *e = NULL;
457
value = str2ll(v, &e);
458
if(unlikely(e && *e))
459
- error("STATSD: excess data '%s' after value '%s'", e, v);
459
+ collector_error("STATSD: excess data '%s' after value '%s'", e, v);
460
}
461
else
462
value = def;
@@ -484,7 +484,7 @@ static inline void statsd_process_gauge(STATSD_METRIC *m, const char *value, con
484
if(!is_metric_useful_for_collection(m)) return;
485
486
if(unlikely(!value || !*value)) {
487
- error("STATSD: metric '%s' of type gauge, with empty value is ignored.", m->name);
487
+ collector_error("STATSD: metric '%s' of type gauge, with empty value is ignored.", m->name);
488
return;
489
}
490
@@ -532,7 +532,7 @@ static inline void statsd_process_histogram_or_timer(STATSD_METRIC *m, const cha
532
if(!is_metric_useful_for_collection(m)) return;
533
534
if(unlikely(!value || !*value)) {
535
- error("STATSD: metric of type %s, with empty value is ignored.", type);
535
+ collector_error("STATSD: metric of type %s, with empty value is ignored.", type);
536
return;
537
}
538
@@ -1100,7 +1100,7 @@ void statsd_collector_thread_cleanup(void *data) {
1100
d->status->running = false;
1101
netdata_spinlock_unlock(&d->status->spinlock);
1102
1103
- info("cleaning up...");
1103
+ collector_info("cleaning up...");
1104
1105
#ifdef HAVE_RECVMMSG
1106
size_t i;
@@ -1131,7 +1131,7 @@ void *statsd_collector_thread(void *ptr) {
1131
worker_register_job_name(WORKER_JOB_TYPE_RCV_DATA, "receive");
1132
worker_register_job_name(WORKER_JOB_TYPE_SND_DATA, "send");
1133
1134
- info("STATSD collector thread started with taskid %d", gettid());
1134
+ collector_info("STATSD collector thread started with taskid %d", gettid());
1135
1136
struct statsd_udp *d = callocz(sizeof(struct statsd_udp), 1);
1137
d->status = status;
@@ -1942,7 +1942,7 @@ static inline void statsd_flush_dictionary(STATSD_METRIC *m) {
1942
if(m->dictionary.unique >= statsd.dictionary_max_unique) {
1943
if(!(m->options & STATSD_METRIC_OPTION_COLLECTION_FULL_LOGGED)) {
1944
m->options |= STATSD_METRIC_OPTION_COLLECTION_FULL_LOGGED;
1945
- info(
1945
+ collector_info(
1946
"STATSD dictionary '%s' reach max of %zu items - try increasing 'dictionaries max unique dimensions' in netdata.conf",
1947
m->name,
1948
m->dictionary.unique);
@@ -2315,7 +2315,7 @@ static inline void statsd_flush_index_metrics(STATSD_INDEX *index, void (*flush_
2315
if(unlikely(!(m->options & STATSD_METRIC_OPTION_PRIVATE_CHART_CHECKED))) {
2316
if(unlikely(statsd.private_charts >= statsd.max_private_charts_hard)) {
2317
debug(D_STATSD, "STATSD: metric '%s' will not be charted, because the hard limit of the maximum number of charts has been reached.", m->name);
2318
- info("STATSD: metric '%s' will not be charted, because the hard limit of the maximum number of charts (%zu) has been reached. Increase the number of charts by editing netdata.conf, [statsd] section.", m->name, statsd.max_private_charts_hard);
2318
+ collector_info("STATSD: metric '%s' will not be charted, because the hard limit of the maximum number of charts (%zu) has been reached. Increase the number of charts by editing netdata.conf, [statsd] section.", m->name, statsd.max_private_charts_hard);
2319
m->options &= ~STATSD_METRIC_OPTION_PRIVATE_CHART_ENABLED;
2320
}
2321
else {
@@ -2361,24 +2361,24 @@ static int statsd_listen_sockets_setup(void) {
2361
static void statsd_main_cleanup(void *data) {
2362
struct netdata_static_thread *static_thread = (struct netdata_static_thread *)data;
2363
static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
2364
- info("cleaning up...");
2364
+ collector_info("cleaning up...");
2365
2366
if (statsd.collection_threads_status) {
2367
int i;
2368
for (i = 0; i < statsd.threads; i++) {
2369
netdata_spinlock_lock(&statsd.collection_threads_status[i].spinlock);
2370
if(statsd.collection_threads_status[i].running) {
2371
- info("STATSD: stopping data collection thread %d...", i + 1);
2371
+ collector_info("STATSD: stopping data collection thread %d...", i + 1);
2372
netdata_thread_cancel(statsd.collection_threads_status[i].thread);
2373
}
2374
else {
2375
- info("STATSD: data collection thread %d found stopped.", i + 1);
2375
+ collector_info("STATSD: data collection thread %d found stopped.", i + 1);
2376
}
2377
netdata_spinlock_unlock(&statsd.collection_threads_status[i].spinlock);
2378
}
2379
}
2380
2381
- info("STATSD: closing sockets...");
2381
+ collector_info("STATSD: closing sockets...");
2382
listen_sockets_close(&statsd.sockets);
2383
2384
// destroy the dictionaries
@@ -2390,7 +2390,7 @@ static void statsd_main_cleanup(void *data) {
2390
dictionary_destroy(statsd.sets.dict);
2391
dictionary_destroy(statsd.timers.dict);
2392
2393
- info("STATSD: cleanup completed.");
2393
+ collector_info("STATSD: cleanup completed.");
2394
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
2395
2396
worker_unregister();
@@ -2454,7 +2454,7 @@ void *statsd_main(void *ptr) {
2454
statsd.update_every = default_rrd_update_every;
2455
statsd.update_every = (int)config_get_number(CONFIG_SECTION_STATSD, "update every (flushInterval)", statsd.update_every);
2456
if(statsd.update_every < default_rrd_update_every) {
2457
- error("STATSD: minimum flush interval %d given, but the minimum is the update every of netdata. Using %d", statsd.update_every, default_rrd_update_every);
2457
+ collector_error("STATSD: minimum flush interval %d given, but the minimum is the update every of netdata. Using %d", statsd.update_every, default_rrd_update_every);
2458
statsd.update_every = default_rrd_update_every;
2459
}
2460
@@ -2471,7 +2471,7 @@ void *statsd_main(void *ptr) {
2471
2472
statsd.histogram_percentile = (double)config_get_float(CONFIG_SECTION_STATSD, "histograms and timers percentile (percentThreshold)", statsd.histogram_percentile);
2473
if(isless(statsd.histogram_percentile, 0) || isgreater(statsd.histogram_percentile, 100)) {
2474
- error("STATSD: invalid histograms and timers percentile %0.5f given", statsd.histogram_percentile);
2474
+ collector_error("STATSD: invalid histograms and timers percentile %0.5f given", statsd.histogram_percentile);
2475
statsd.histogram_percentile = 95.0;
2476
}
2477
{
@@ -2518,7 +2518,7 @@ void *statsd_main(void *ptr) {
2518
#ifdef STATSD_MULTITHREADED
2519
statsd.threads = (int)config_get_number(CONFIG_SECTION_STATSD, "threads", processors);
2520
if(statsd.threads < 1) {
2521
- error("STATSD: Invalid number of threads %d, using %d", statsd.threads, processors);
2521
+ collector_error("STATSD: Invalid number of threads %d, using %d", statsd.threads, processors);
2522
statsd.threads = processors;
2523
config_set_number(CONFIG_SECTION_STATSD, "collector threads", statsd.threads);
2524
}
@@ -2536,7 +2536,7 @@ void *statsd_main(void *ptr) {
2536
2537
statsd_listen_sockets_setup();
2538
if(!statsd.sockets.opened) {
2539
- error("STATSD: No statsd sockets to listen to. statsd will be disabled.");
2539
+ collector_error("STATSD: No statsd sockets to listen to. statsd will be disabled.");
2540
goto cleanup;
2541
}
2542
collectors/tc.plugin/plugin_tc.c
+8
-8
@@ -89,7 +89,7 @@ static bool tc_class_conflict_callback(const DICTIONARY_ITEM *item __maybe_unuse
89
struct tc_class *c = old_value; (void)c;
90
struct tc_class *new_c = new_value; (void)new_c;
91
92
- error("TC: class '%s' is already in device '%s'. Ignoring duplicate.", dictionary_acquired_item_name(item), string2str(d->id));
92
+ collector_error("TC: class '%s' is already in device '%s'. Ignoring duplicate.", dictionary_acquired_item_name(item), string2str(d->id));
93
94
tc_class_free_callback(item, new_value, data);
95
@@ -277,7 +277,7 @@ static inline void tc_device_commit(struct tc_device *d) {
277
}
278
279
if(unlikely(updated_classes && updated_qdiscs)) {
280
- error("TC: device '%s' has active both classes (%d) and qdiscs (%d). Will render only qdiscs.", string2str(d->id), updated_classes, updated_qdiscs);
280
+ collector_error("TC: device '%s' has active both classes (%d) and qdiscs (%d). Will render only qdiscs.", string2str(d->id), updated_classes, updated_qdiscs);
281
282
// set all classes to !updated
283
dfe_start_read(d->classes, c) {
@@ -353,7 +353,7 @@ static inline void tc_device_commit(struct tc_device *d) {
353
}
354
355
//if(unlikely(!c->hasparent)) {
356
- // if(root) error("TC: multiple root class/qdisc for device '%s' (old: '%s', new: '%s')", d->id, root->id, c->id);
356
+ // if(root) collector_error("TC: multiple root class/qdisc for device '%s' (old: '%s', new: '%s')", d->id, root->id, c->id);
357
// root = c;
358
// debug(D_TC_LOOP, "TC: found root class/qdisc '%s'", root->id);
359
//}
@@ -856,14 +856,14 @@ static void tc_main_cleanup(void *ptr) {
856
struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
857
static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
858
859
- info("cleaning up...");
859
+ collector_info("cleaning up...");
860
861
if(tc_child_pid) {
862
- info("TC: killing with SIGTERM tc-qos-helper process %d", tc_child_pid);
862
+ collector_info("TC: killing with SIGTERM tc-qos-helper process %d", tc_child_pid);
863
if(killpid(tc_child_pid) != -1) {
864
siginfo_t info;
865
866
- info("TC: waiting for tc plugin child process pid %d to exit...", tc_child_pid);
866
+ collector_info("TC: waiting for tc plugin child process pid %d to exit...", tc_child_pid);
867
waitid(P_PID, (id_t) tc_child_pid, &info, WEXITED);
868
}
869
@@ -940,7 +940,7 @@ void *tc_main(void *ptr) {
940
941
fp_child_output = netdata_popen(command, (pid_t *)&tc_child_pid, &fp_child_input);
942
if(unlikely(!fp_child_output)) {
943
- error("TC: Cannot popen(\"%s\", \"r\").", command);
943
+ collector_error("TC: Cannot popen(\"%s\", \"r\").", command);
944
goto cleanup;
945
}
946
@@ -1169,7 +1169,7 @@ void *tc_main(void *ptr) {
1169
if(code == 1 || code == 127) {
1170
// 1 = DISABLE
1171
// 127 = cannot even run it
1172
- error("TC: tc-qos-helper.sh exited with code %d. Disabling it.", code);
1172
+ collector_error("TC: tc-qos-helper.sh exited with code %d. Disabling it.", code);
1173
goto cleanup;
1174
}
1175
collectors/xenstat.plugin/xenstat_plugin.c
+1
@@ -920,6 +920,7 @@ static void xenstat_send_domain_metrics() {
920
}
921
922
int main(int argc, char **argv) {
923
+ stderror = stderr;
924
clocks_init();
925
926
// ------------------------------------------------------------------------
daemon/README.md
+18
-11
@@ -210,25 +210,22 @@ You can send commands during runtime via [netdatacli](/cli/README.md).
210
211
## Log files
212
213
-Netdata uses 3 log files:
213
+Netdata uses 4 log files:
214
215
1. `error.log`
216
-2. `access.log`
217
-3. `debug.log`
216
+2. `collector.log`
217
+3. `access.log`
218
+4. `debug.log`
219
219
-Any of them can be disabled by setting it to `/dev/null` or `none` in `netdata.conf`. By default `error.log` and
220
-`access.log` are enabled. `debug.log` is only enabled if debugging/tracing is also enabled (Netdata needs to be compiled
221
-with debugging enabled).
220
+Any of them can be disabled by setting it to `/dev/null` or `none` in `netdata.conf`. By default `error.log`,
221
+`collector.log`, and `access.log` are enabled. `debug.log` is only enabled if debugging/tracing is also enabled
222
+(Netdata needs to be compiled with debugging enabled).
223
224
Log files are stored in `/var/log/netdata/` by default.
225
226
### error.log
227
227
-The `error.log` is the `stderr` of the `netdata` daemon and all external plugins
228
-run by `netdata`.
229
-
230
-So if any process, in the Netdata process tree, writes anything to its standard error,
231
-it will appear in `error.log`.
228
+The `error.log` is the `stderr` of the `netdata` daemon .
229
230
For most Netdata programs (including standard external plugins shipped by netdata), the following lines may appear:
231
@@ -243,6 +240,16 @@ program continues to run.
240
241
When a Netdata program cannot run at all, a `FATAL` line is logged.
242
243
+### collector.log
244
+
245
+The `collector.log` is the `stderr` of all [collectors](https://github.com/netdata/netdata/blob/master/collectors/COLLECTORS.md)
246
+ run by `netdata`.
247
+
248
+So if any process, in the Netdata process tree, writes anything to its standard error,
249
+it will appear in `collector.log`.
250
+
251
+Data stored inside this file follows pattern already described for `error.log`.
252
+
253
### access.log
254
255
The `access.log` logs web requests. The format is:
daemon/global_statistics.c
+1
-1
@@ -3783,7 +3783,7 @@ static int read_thread_cpu_time_from_proc_stat(pid_t pid __maybe_unused, kernel_
3783
3784
// (re)open the procfile to the new filename
3785
bool set_quotes = (ff == NULL) ? true : false;
3786
- ff = procfile_reopen(ff, filename, NULL, PROCFILE_FLAG_DEFAULT);
3786
+ ff = procfile_reopen(ff, filename, NULL, PROCFILE_FLAG_ERROR_ON_ERROR_LOG);
3787
if(unlikely(!ff)) return -1;
3788
3789
if(set_quotes)
daemon/main.c
+5
@@ -831,6 +831,9 @@ static void log_init(void) {
831
snprintfz(filename, FILENAME_MAX, "%s/error.log", netdata_configured_log_dir);
832
stderr_filename = config_get(CONFIG_SECTION_LOGS, "error", filename);
833
834
+ snprintfz(filename, FILENAME_MAX, "%s/collector.log", netdata_configured_log_dir);
835
+ stdcollector_filename = config_get(CONFIG_SECTION_LOGS, "collector", filename);
836
+
837
snprintfz(filename, FILENAME_MAX, "%s/access.log", netdata_configured_log_dir);
838
stdaccess_filename = config_get(CONFIG_SECTION_LOGS, "access", filename);
839
@@ -1320,6 +1323,8 @@ int main(int argc, char **argv) {
1323
usec_t started_ut = now_monotonic_usec();
1324
usec_t last_ut = started_ut;
1325
const char *prev_msg = NULL;
1326
+ // Initialize stderror avoiding coredump when info() or error() is called
1327
+ stderror = stderr;
1328
1329
int i;
1330
int config_loaded = 0;
libnetdata/log/log.c
+58
-34
@@ -14,6 +14,7 @@ uint64_t debug_flags = 0;
14
15
int access_log_syslog = 1;
16
int error_log_syslog = 1;
17
+int collector_log_syslog = 1;
18
int output_log_syslog = 1; // debug log
19
int health_log_syslog = 1;
20
@@ -23,11 +24,15 @@ FILE *stdaccess = NULL;
24
int stdhealth_fd = -1;
25
FILE *stdhealth = NULL;
26
27
+int stdcollector_fd = -1;
28
+FILE *stderror = NULL;
29
+
30
const char *stdaccess_filename = NULL;
31
const char *stderr_filename = NULL;
32
const char *stdout_filename = NULL;
33
const char *facility_log = NULL;
34
const char *stdhealth_filename = NULL;
35
+const char *stdcollector_filename = NULL;
36
37
#ifdef ENABLE_ACLK
38
const char *aclklog_filename = NULL;
@@ -573,8 +578,14 @@ void reopen_all_log_files() {
578
if(stdout_filename)
579
open_log_file(STDOUT_FILENO, stdout, stdout_filename, &output_log_syslog, 0, NULL);
580
576
- if(stderr_filename)
577
- open_log_file(STDERR_FILENO, stderr, stderr_filename, &error_log_syslog, 0, NULL);
581
+ if(stdcollector_filename)
582
+ open_log_file(STDERR_FILENO, stderr, stdcollector_filename, &collector_log_syslog, 0, NULL);
583
+
584
+ if(stderr_filename) {
585
+ log_lock();
586
+ stderror = open_log_file(stdcollector_fd, stderror, stderr_filename, &error_log_syslog, 1, &stdcollector_fd);
587
+ log_unlock();
588
+ }
589
590
#ifdef ENABLE_ACLK
591
if (aclklog_enabled)
@@ -593,7 +604,11 @@ void open_all_log_files() {
604
open_log_file(STDIN_FILENO, stdin, "/dev/null", NULL, 0, NULL);
605
606
open_log_file(STDOUT_FILENO, stdout, stdout_filename, &output_log_syslog, 0, NULL);
596
- open_log_file(STDERR_FILENO, stderr, stderr_filename, &error_log_syslog, 0, NULL);
607
+ open_log_file(STDERR_FILENO, stderr, stdcollector_filename, &collector_log_syslog, 0, NULL);
608
+
609
+ log_lock();
610
+ stderror = open_log_file(stdcollector_fd, NULL, stderr_filename, &error_log_syslog, 1, &stdcollector_fd);
611
+ log_unlock();
612
613
#ifdef ENABLE_ACLK
614
if(aclklog_enabled)
@@ -616,7 +631,7 @@ int error_log_limit(int reset) {
631
static time_t start = 0;
632
static unsigned long counter = 0, prevented = 0;
633
619
- // fprintf(stderr, "FLOOD: counter=%lu, allowed=%lu, backup=%lu, period=%llu\n", counter, error_log_errors_per_period, error_log_errors_per_period_backup, (unsigned long long)error_log_throttle_period);
634
+ // fprintf(stderror, "FLOOD: counter=%lu, allowed=%lu, backup=%lu, period=%llu\n", counter, error_log_errors_per_period, error_log_errors_per_period_backup, (unsigned long long)error_log_throttle_period);
635
636
// do not throttle if the period is 0
637
if(error_log_throttle_period == 0)
@@ -638,7 +653,7 @@ int error_log_limit(int reset) {
653
char date[LOG_DATE_LENGTH];
654
log_date(date, LOG_DATE_LENGTH, now_realtime_sec());
655
fprintf(
641
- stderr,
656
+ stderror,
657
"%s: %s LOG FLOOD PROTECTION reset for process '%s' "
658
"(prevented %lu logs in the last %"PRId64" seconds).\n",
659
date,
@@ -661,7 +676,7 @@ int error_log_limit(int reset) {
676
char date[LOG_DATE_LENGTH];
677
log_date(date, LOG_DATE_LENGTH, now_realtime_sec());
678
fprintf(
664
- stderr,
679
+ stderror,
680
"%s: %s LOG FLOOD PROTECTION resuming logging from process '%s' "
681
"(prevented %lu logs in the last %"PRId64" seconds).\n",
682
date,
@@ -685,7 +700,7 @@ int error_log_limit(int reset) {
700
char date[LOG_DATE_LENGTH];
701
log_date(date, LOG_DATE_LENGTH, now_realtime_sec());
702
fprintf(
688
- stderr,
703
+ stderror,
704
"%s: %s LOG FLOOD PROTECTION too many logs (%lu logs in %"PRId64" seconds, threshold is set to %lu logs "
705
"in %"PRId64" seconds). Preventing more logs from process '%s' for %"PRId64" seconds.\n",
706
date,
@@ -758,9 +773,10 @@ void debug_int( const char *file, const char *function, const unsigned long line
773
// ----------------------------------------------------------------------------
774
// info log
775
761
-void info_int( const char *file __maybe_unused, const char *function __maybe_unused, const unsigned long line __maybe_unused, const char *fmt, ... )
776
+void info_int( int is_collector, const char *file __maybe_unused, const char *function __maybe_unused, const unsigned long line __maybe_unused, const char *fmt, ... )
777
{
778
va_list args;
779
+ FILE *fp = (is_collector) ? stderr : stderror;
780
781
log_lock();
782
@@ -770,7 +786,7 @@ void info_int( const char *file __maybe_unused, const char *function __maybe_unu
786
return;
787
}
788
773
- if(error_log_syslog) {
789
+ if(collector_log_syslog) {
790
va_start( args, fmt );
791
vsyslog(LOG_INFO, fmt, args );
792
va_end( args );
@@ -781,14 +797,15 @@ void info_int( const char *file __maybe_unused, const char *function __maybe_unu
797
798
va_start( args, fmt );
799
#ifdef NETDATA_INTERNAL_CHECKS
784
- fprintf(stderr, "%s: %s INFO : %s : (%04lu@%-20.20s:%-15.15s): ", date, program_name, netdata_thread_tag(), line, file, function);
800
+ fprintf(fp, "%s: %s INFO : %s : (%04lu@%-20.20s:%-15.15s): ",
801
+ date, program_name, netdata_thread_tag(), line, file, function);
802
#else
786
- fprintf(stderr, "%s: %s INFO : %s : ", date, program_name, netdata_thread_tag());
803
+ fprintf(fp, "%s: %s INFO : %s : ", date, program_name, netdata_thread_tag());
804
#endif
788
- vfprintf( stderr, fmt, args );
805
+ vfprintf(fp, fmt, args );
806
va_end( args );
807
791
- fputc('\n', stderr);
808
+ fputc('\n', fp);
809
810
log_unlock();
811
}
@@ -842,7 +859,7 @@ void error_limit_int(ERROR_LIMIT *erl, const char *prefix, const char *file __ma
859
return;
860
}
861
845
- if(error_log_syslog) {
862
+ if(collector_log_syslog) {
863
va_start( args, fmt );
864
vsyslog(LOG_ERR, fmt, args );
865
va_end( args );
@@ -853,26 +870,29 @@ void error_limit_int(ERROR_LIMIT *erl, const char *prefix, const char *file __ma
870
871
va_start( args, fmt );
872
#ifdef NETDATA_INTERNAL_CHECKS
856
- fprintf(stderr, "%s: %s %-5.5s : %s : (%04lu@%-20.20s:%-15.15s): ", date, program_name, prefix, netdata_thread_tag(), line, file, function);
873
+ fprintf(stderror, "%s: %s %-5.5s : %s : (%04lu@%-20.20s:%-15.15s): ",
874
+ date, program_name, prefix, netdata_thread_tag(), line, file, function);
875
#else
858
- fprintf(stderr, "%s: %s %-5.5s : %s : ", date, program_name, prefix, netdata_thread_tag());
876
+ fprintf(stderror, "%s: %s %-5.5s : %s : ", date, program_name, prefix, netdata_thread_tag());
877
#endif
860
- vfprintf( stderr, fmt, args );
878
+ vfprintf(stderror, fmt, args );
879
va_end( args );
880
881
if(erl->count > 1)
864
- fprintf(stderr, " (similar messages repeated %zu times in the last %llu secs)", erl->count, (unsigned long long)(erl->last_logged ? now - erl->last_logged : 0));
882
+ fprintf(stderror, " (similar messages repeated %zu times in the last %llu secs)",
883
+ erl->count, (unsigned long long)(erl->last_logged ? now - erl->last_logged : 0));
884
885
if(erl->sleep_ut)
867
- fprintf(stderr, " (sleeping for %llu microseconds every time this happens)", erl->sleep_ut);
886
+ fprintf(stderror, " (sleeping for %llu microseconds every time this happens)", erl->sleep_ut);
887
888
if(__errno) {
889
char buf[1024];
871
- fprintf(stderr, " (errno %d, %s)\n", __errno, strerror_result(strerror_r(__errno, buf, 1023), buf));
890
+ fprintf(stderror,
891
+ " (errno %d, %s)\n", __errno, strerror_result(strerror_r(__errno, buf, 1023), buf));
892
errno = 0;
893
}
894
else
875
- fputc('\n', stderr);
895
+ fputc('\n', stderror);
896
897
erl->last_logged = now;
898
erl->count = 0;
@@ -880,9 +900,10 @@ void error_limit_int(ERROR_LIMIT *erl, const char *prefix, const char *file __ma
900
log_unlock();
901
}
902
883
-void error_int(const char *prefix, const char *file __maybe_unused, const char *function __maybe_unused, const unsigned long line __maybe_unused, const char *fmt, ... ) {
903
+void error_int(int is_collector, const char *prefix, const char *file __maybe_unused, const char *function __maybe_unused, const unsigned long line __maybe_unused, const char *fmt, ... ) {
904
// save a copy of errno - just in case this function generates a new error
905
int __errno = errno;
906
+ FILE *fp = (is_collector) ? stderr : stderror;
907
908
va_list args;
909
@@ -894,7 +915,7 @@ void error_int(const char *prefix, const char *file __maybe_unused, const char *
915
return;
916
}
917
897
- if(error_log_syslog) {
918
+ if(collector_log_syslog) {
919
va_start( args, fmt );
920
vsyslog(LOG_ERR, fmt, args );
921
va_end( args );
@@ -905,20 +926,22 @@ void error_int(const char *prefix, const char *file __maybe_unused, const char *
926
927
va_start( args, fmt );
928
#ifdef NETDATA_INTERNAL_CHECKS
908
- fprintf(stderr, "%s: %s %-5.5s : %s : (%04lu@%-20.20s:%-15.15s): ", date, program_name, prefix, netdata_thread_tag(), line, file, function);
929
+ fprintf(fp, "%s: %s %-5.5s : %s : (%04lu@%-20.20s:%-15.15s): ",
930
+ date, program_name, prefix, netdata_thread_tag(), line, file, function);
931
#else
910
- fprintf(stderr, "%s: %s %-5.5s : %s : ", date, program_name, prefix, netdata_thread_tag());
932
+ fprintf(fp, "%s: %s %-5.5s : %s : ", date, program_name, prefix, netdata_thread_tag());
933
#endif
912
- vfprintf( stderr, fmt, args );
934
+ vfprintf(fp, fmt, args );
935
va_end( args );
936
937
if(__errno) {
938
char buf[1024];
917
- fprintf(stderr, " (errno %d, %s)\n", __errno, strerror_result(strerror_r(__errno, buf, 1023), buf));
939
+ fprintf(fp,
940
+ " (errno %d, %s)\n", __errno, strerror_result(strerror_r(__errno, buf, 1023), buf));
941
errno = 0;
942
}
943
else
921
- fputc('\n', stderr);
944
+ fputc('\n', fp);
945
946
log_unlock();
947
}
@@ -938,7 +961,7 @@ static void print_call_stack(void) {
961
962
nptrs = backtrace(buffer, BT_BUF_SIZE);
963
if(nptrs)
941
- backtrace_symbols_fd(buffer, nptrs, fileno(stderr));
964
+ backtrace_symbols_fd(buffer, nptrs, fileno(stderror));
965
}
966
#endif
967
@@ -949,7 +972,7 @@ void fatal_int( const char *file, const char *function, const unsigned long line
972
const char *thread_tag;
973
char os_threadname[NETDATA_THREAD_NAME_MAX + 1];
974
952
- if(error_log_syslog) {
975
+ if(collector_log_syslog) {
976
va_start( args, fmt );
977
vsyslog(LOG_CRIT, fmt, args );
978
va_end( args );
@@ -970,15 +993,16 @@ void fatal_int( const char *file, const char *function, const unsigned long line
993
994
va_start( args, fmt );
995
#ifdef NETDATA_INTERNAL_CHECKS
973
- fprintf(stderr, "%s: %s FATAL : %s : (%04lu@%-20.20s:%-15.15s): ", date, program_name, thread_tag, line, file, function);
996
+ fprintf(stderror,
997
+ "%s: %s FATAL : %s : (%04lu@%-20.20s:%-15.15s): ", date, program_name, thread_tag, line, file, function);
998
#else
975
- fprintf(stderr, "%s: %s FATAL : %s : ", date, program_name, thread_tag);
999
+ fprintf(stderror, "%s: %s FATAL : %s : ", date, program_name, thread_tag);
1000
#endif
977
- vfprintf( stderr, fmt, args );
1001
+ vfprintf(stderror, fmt, args );
1002
va_end( args );
1003
1004
perror(" # ");
981
- fputc('\n', stderr);
1005
+ fputc('\n', stderror);
1006
1007
log_unlock();
1008
libnetdata/log/log.h
+13
-6
@@ -61,10 +61,14 @@ extern FILE *stdaccess;
61
extern int stdhealth_fd;
62
extern FILE *stdhealth;
63
64
+extern int stdcollector_fd;
65
+extern FILE *stderror;
66
+
67
extern const char *stdaccess_filename;
68
extern const char *stderr_filename;
69
extern const char *stdout_filename;
70
extern const char *stdhealth_filename;
71
+extern const char *stdcollector_filename;
72
extern const char *facility_log;
73
74
#ifdef ENABLE_ACLK
@@ -106,7 +110,7 @@ typedef struct error_with_limit {
110
111
#ifdef NETDATA_INTERNAL_CHECKS
112
#define debug(type, args...) do { if(unlikely(debug_flags & type)) debug_int(__FILE__, __FUNCTION__, __LINE__, ##args); } while(0)
109
-#define internal_error(condition, args...) do { if(unlikely(condition)) error_int("IERR", __FILE__, __FUNCTION__, __LINE__, ##args); } while(0)
113
+#define internal_error(condition, args...) do { if(unlikely(condition)) error_int(0, "IERR", __FILE__, __FUNCTION__, __LINE__, ##args); } while(0)
114
#define internal_fatal(condition, args...) do { if(unlikely(condition)) fatal_int(__FILE__, __FUNCTION__, __LINE__, ##args); } while(0)
115
#else
116
#define debug(type, args...) debug_dummy()
@@ -114,17 +118,20 @@ typedef struct error_with_limit {
118
#define internal_fatal(args...) debug_dummy()
119
#endif
120
117
-#define info(args...) info_int(__FILE__, __FUNCTION__, __LINE__, ##args)
118
-#define infoerr(args...) error_int("INFO", __FILE__, __FUNCTION__, __LINE__, ##args)
119
-#define error(args...) error_int("ERROR", __FILE__, __FUNCTION__, __LINE__, ##args)
121
+#define info(args...) info_int(0, __FILE__, __FUNCTION__, __LINE__, ##args)
122
+#define collector_info(args...) info_int(1, __FILE__, __FUNCTION__, __LINE__, ##args)
123
+#define infoerr(args...) error_int(0, "INFO", __FILE__, __FUNCTION__, __LINE__, ##args)
124
+#define error(args...) error_int(0, "ERROR", __FILE__, __FUNCTION__, __LINE__, ##args)
125
+#define collector_infoerr(args...) error_int(1, "INFO", __FILE__, __FUNCTION__, __LINE__, ##args)
126
+#define collector_error(args...) error_int(1, "ERROR", __FILE__, __FUNCTION__, __LINE__, ##args)
127
#define error_limit(erl, args...) error_limit_int(erl, "ERROR", __FILE__, __FUNCTION__, __LINE__, ##args)
128
#define fatal(args...) fatal_int(__FILE__, __FUNCTION__, __LINE__, ##args)
129
#define fatal_assert(expr) ((expr) ? (void)(0) : fatal_int(__FILE__, __FUNCTION__, __LINE__, "Assertion `%s' failed", #expr))
130
131
void send_statistics(const char *action, const char *action_result, const char *action_data);
132
void debug_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) PRINTFLIKE(4, 5);
126
-void info_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) PRINTFLIKE(4, 5);
127
-void error_int( const char *prefix, const char *file, const char *function, const unsigned long line, const char *fmt, ... ) PRINTFLIKE(5, 6);
133
+void info_int( int is_collector, const char *file, const char *function, const unsigned long line, const char *fmt, ... ) PRINTFLIKE(5, 6);
134
+void error_int( int is_collector, const char *prefix, const char *file, const char *function, const unsigned long line, const char *fmt, ... ) PRINTFLIKE(6, 7);
135
void error_limit_int(ERROR_LIMIT *erl, const char *prefix, const char *file __maybe_unused, const char *function __maybe_unused, unsigned long line __maybe_unused, const char *fmt, ... ) PRINTFLIKE(6, 7);;
136
void fatal_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) NORETURN PRINTFLIKE(4, 5);
137
void log_access( const char *fmt, ... ) PRINTFLIKE(1, 2);
libnetdata/procfile/procfile.c
+6
-3
@@ -296,7 +296,8 @@ procfile *procfile_readall(procfile *ff) {
296
debug(D_PROCFILE, "Reading file '%s', from position %zd with length %zd", procfile_filename(ff), s, (ssize_t)(ff->size - s));
297
r = read(ff->fd, &ff->data[s], ff->size - s);
298
if(unlikely(r == -1)) {
299
- if(unlikely(!(ff->flags & PROCFILE_FLAG_NO_ERROR_ON_FILE_IO))) error(PF_PREFIX ": Cannot read from file '%s' on fd %d", procfile_filename(ff), ff->fd);
299
+ if(unlikely(!(ff->flags & PROCFILE_FLAG_NO_ERROR_ON_FILE_IO))) collector_error(PF_PREFIX ": Cannot read from file '%s' on fd %d", procfile_filename(ff), ff->fd);
300
+ else if(unlikely(ff->flags & PROCFILE_FLAG_ERROR_ON_ERROR_LOG)) error(PF_PREFIX ": Cannot read from file '%s' on fd %d", procfile_filename(ff), ff->fd);
301
procfile_close(ff);
302
return NULL;
303
}
@@ -306,7 +307,8 @@ procfile *procfile_readall(procfile *ff) {
307
308
// debug(D_PROCFILE, "Rewinding file '%s'", ff->filename);
309
if(unlikely(lseek(ff->fd, 0, SEEK_SET) == -1)) {
309
- if(unlikely(!(ff->flags & PROCFILE_FLAG_NO_ERROR_ON_FILE_IO))) error(PF_PREFIX ": Cannot rewind on file '%s'.", procfile_filename(ff));
310
+ if(unlikely(!(ff->flags & PROCFILE_FLAG_NO_ERROR_ON_FILE_IO))) collector_error(PF_PREFIX ": Cannot rewind on file '%s'.", procfile_filename(ff));
311
+ else if(unlikely(ff->flags & PROCFILE_FLAG_ERROR_ON_ERROR_LOG)) error(PF_PREFIX ": Cannot rewind on file '%s'.", procfile_filename(ff));
312
procfile_close(ff);
313
return NULL;
314
}
@@ -403,7 +405,8 @@ procfile *procfile_open(const char *filename, const char *separators, uint32_t f
405
406
int fd = open(filename, procfile_open_flags, 0666);
407
if(unlikely(fd == -1)) {
406
- if(unlikely(!(flags & PROCFILE_FLAG_NO_ERROR_ON_FILE_IO))) error(PF_PREFIX ": Cannot open file '%s'", filename);
408
+ if(unlikely(!(flags & PROCFILE_FLAG_NO_ERROR_ON_FILE_IO))) collector_error(PF_PREFIX ": Cannot open file '%s'", filename);
409
+ else if(unlikely(flags & PROCFILE_FLAG_ERROR_ON_ERROR_LOG)) error(PF_PREFIX ": Cannot open file '%s'", filename);
410
return NULL;
411
}
412
libnetdata/procfile/procfile.h
+3
-2
@@ -34,8 +34,9 @@ typedef struct {
34
// ----------------------------------------------------------------------------
35
// The procfile
36
37
-#define PROCFILE_FLAG_DEFAULT 0x00000000
38
-#define PROCFILE_FLAG_NO_ERROR_ON_FILE_IO 0x00000001
37
+#define PROCFILE_FLAG_DEFAULT 0x00000000 // To store inside `collector.log`
38
+#define PROCFILE_FLAG_NO_ERROR_ON_FILE_IO 0x00000001 // Do not store nothing
39
+#define PROCFILE_FLAG_ERROR_ON_ERROR_LOG 0x00000002 // Store inside `error.log`
40
41
typedef enum __attribute__ ((__packed__)) procfile_separator {
42
PF_CHAR_IS_SEPARATOR,
packaging/docker/Dockerfile
+1
@@ -76,6 +76,7 @@ RUN mkdir -p /opt/src /var/log/netdata && \
76
ln -sf /dev/stdout /var/log/netdata/access.log && \
77
ln -sf /dev/stdout /var/log/netdata/debug.log && \
78
ln -sf /dev/stderr /var/log/netdata/error.log && \
79
+ ln -sf /dev/stdout /var/log/netdata/collector.log && \
80
# Add netdata user
81
addgroup -g ${NETDATA_GID} -S "${DOCKER_GRP}" && \
82
adduser -S -H -s /usr/sbin/nologin -u ${NETDATA_GID} -h /etc/netdata -G "${DOCKER_GRP}" "${DOCKER_USR}"
web/api/formatters/charts2json.c
+1
-1
@@ -10,7 +10,7 @@ const char* get_release_channel() {
10
if (use_stable == -1) {
11
char filename[FILENAME_MAX + 1];
12
snprintfz(filename, FILENAME_MAX, "%s/.environment", netdata_configured_user_config_dir);
13
- procfile *ff = procfile_open(filename, "=", PROCFILE_FLAG_DEFAULT);
13
+ procfile *ff = procfile_open(filename, "=", PROCFILE_FLAG_ERROR_ON_ERROR_LOG);
14
if (ff) {
15
procfile_set_quotes(ff, "'\"");
16
ff = procfile_readall(ff);