@cryptotaxi247 / netdata-1 / commits / 6bdb045ff

updated all info and error logs in cgroups to state their source

Costa Tsaousis (ktsaou) committed Jul 25, 2017 at 21:21 UTC 6bdb045ffd21ff0ce45a3b408963c35199f3d669
1 file changed +21 -21
src/sys_fs_cgroup.c
+21 -21
@@ -103,7 +103,7 @@ void read_cgroup_plugin_configuration() {
103 mi = mountinfo_find_by_filesystem_super_option(root, "cgroup", "cpuacct");
104 if(!mi) mi = mountinfo_find_by_filesystem_mount_source(root, "cgroup", "cpuacct");
105 if(!mi) {
106 - error("Cannot find cgroup cpuacct mountinfo. Assuming default: /sys/fs/cgroup/cpuacct");
106 + error("CGROUP: cannot find cpuacct mountinfo. Assuming default: /sys/fs/cgroup/cpuacct");
107 s = "/sys/fs/cgroup/cpuacct";
108 }
109 else s = mi->mount_point;
@@ -113,7 +113,7 @@ void read_cgroup_plugin_configuration() {
113 mi = mountinfo_find_by_filesystem_super_option(root, "cgroup", "blkio");
114 if(!mi) mi = mountinfo_find_by_filesystem_mount_source(root, "cgroup", "blkio");
115 if(!mi) {
116 - error("Cannot find cgroup blkio mountinfo. Assuming default: /sys/fs/cgroup/blkio");
116 + error("CGROUP: cannot find blkio mountinfo. Assuming default: /sys/fs/cgroup/blkio");
117 s = "/sys/fs/cgroup/blkio";
118 }
119 else s = mi->mount_point;
@@ -123,7 +123,7 @@ void read_cgroup_plugin_configuration() {
123 mi = mountinfo_find_by_filesystem_super_option(root, "cgroup", "memory");
124 if(!mi) mi = mountinfo_find_by_filesystem_mount_source(root, "cgroup", "memory");
125 if(!mi) {
126 - error("Cannot find cgroup memory mountinfo. Assuming default: /sys/fs/cgroup/memory");
126 + error("CGROUP: cannot find memory mountinfo. Assuming default: /sys/fs/cgroup/memory");
127 s = "/sys/fs/cgroup/memory";
128 }
129 else s = mi->mount_point;
@@ -133,7 +133,7 @@ void read_cgroup_plugin_configuration() {
133 mi = mountinfo_find_by_filesystem_super_option(root, "cgroup", "devices");
134 if(!mi) mi = mountinfo_find_by_filesystem_mount_source(root, "cgroup", "devices");
135 if(!mi) {
136 - error("Cannot find cgroup devices mountinfo. Assuming default: /sys/fs/cgroup/devices");
136 + error("CGROUP: cannot find devices mountinfo. Assuming default: /sys/fs/cgroup/devices");
137 s = "/sys/fs/cgroup/devices";
138 }
139 else s = mi->mount_point;
@@ -433,7 +433,7 @@ static inline void cgroup_read_cpuacct_stat(struct cpuacct_stat *cp) {
433 unsigned long i, lines = procfile_lines(ff);
434
435 if(unlikely(lines < 1)) {
436 - error("File '%s' should have 1+ lines.", cp->filename);
436 + error("CGROUP: file '%s' should have 1+ lines.", cp->filename);
437 cp->updated = 0;
438 return;
439 }
@@ -475,7 +475,7 @@ static inline void cgroup_read_cpuacct_usage(struct cpuacct_usage *ca) {
475 }
476
477 if(unlikely(procfile_lines(ff) < 1)) {
478 - error("File '%s' should have 1+ lines but has %zu.", ca->filename, procfile_lines(ff));
478 + error("CGROUP: file '%s' should have 1+ lines but has %zu.", ca->filename, procfile_lines(ff));
479 ca->updated = 0;
480 return;
481 }
@@ -539,7 +539,7 @@ static inline void cgroup_read_blkio(struct blkio *io) {
539 unsigned long i, lines = procfile_lines(ff);
540
541 if(unlikely(lines < 1)) {
542 - error("File '%s' should have 1+ lines.", io->filename);
542 + error("CGROUP: file '%s' should have 1+ lines.", io->filename);
543 io->updated = 0;
544 return;
545 }
@@ -612,7 +612,7 @@ static inline void cgroup_read_memory(struct memory *mem) {
612 unsigned long i, lines = procfile_lines(ff);
613
614 if(unlikely(lines < 1)) {
615 - error("File '%s' should have 1+ lines.", mem->filename_detailed);
615 + error("CGROUP: file '%s' should have 1+ lines.", mem->filename_detailed);
616 mem->updated_detailed = 0;
617 goto memory_next;
618 }
@@ -775,7 +775,7 @@ static inline void cgroup_get_chart_name(struct cgroup *cg) {
775 }
776 }
777 else
778 - error("CGROUP: Cannot popen(\"%s\", \"r\").", buffer);
778 + error("CGROUP: cannot popen(\"%s\", \"r\").", buffer);
779 }
780
781 static inline struct cgroup *cgroup_add(const char *id) {
@@ -783,7 +783,7 @@ static inline struct cgroup *cgroup_add(const char *id) {
783 debug(D_CGROUP, "adding to list, cgroup with id '%s'", id);
784
785 if(cgroup_root_count >= cgroup_root_max) {
786 - info("Maximum number of cgroups reached (%d). Not adding cgroup '%s'", cgroup_root_count, id);
786 + info("CGROUP: maximum number of cgroups reached (%d). Not adding cgroup '%s'", cgroup_root_count, id);
787 return NULL;
788 }
789
@@ -872,7 +872,7 @@ static inline struct cgroup *cgroup_add(const char *id) {
872 for (t = cgroup_root; t; t = t->next) {
873 if (t != cg && t->enabled && t->hash_chart == cg->hash_chart && !strcmp(t->chart_id, cg->chart_id)) {
874 if (!strncmp(t->chart_id, "/system.slice/", 14) && !strncmp(cg->chart_id, "/init.scope/system.slice/", 25)) {
875 - error("Control group with chart id '%s' already exists with id '%s' and is enabled. Swapping them by enabling cgroup with id '%s' and disabling cgroup with id '%s'.",
875 + error("CGROUP: chart id '%s' already exists with id '%s' and is enabled. Swapping them by enabling cgroup with id '%s' and disabling cgroup with id '%s'.",
876 cg->chart_id, t->id, cg->id, t->id);
877 debug(D_CGROUP, "Control group with chart id '%s' already exists with id '%s' and is enabled. Swapping them by enabling cgroup with id '%s' and disabling cgroup with id '%s'.",
878 cg->chart_id, t->id, cg->id, t->id);
@@ -880,7 +880,7 @@ static inline struct cgroup *cgroup_add(const char *id) {
880 t->options |= CGROUP_OPTIONS_DISABLED_DUPLICATE;
881 }
882 else {
883 - error("Control group with chart id '%s' already exists with id '%s' and is enabled and available. Disabling cgroup with id '%s'.",
883 + error("CGROUP: chart id '%s' already exists with id '%s' and is enabled and available. Disabling cgroup with id '%s'.",
884 cg->chart_id, t->id, cg->id);
885 debug(D_CGROUP, "Control group with chart id '%s' already exists with id '%s' and is enabled and available. Disabling cgroup with id '%s'.",
886 cg->chart_id, t->id, cg->id);
@@ -979,7 +979,7 @@ static inline void found_subdir_in_dir(const char *dir) {
979 depth++;
980
981 if(depth > cgroup_max_depth) {
982 - info("cgroup '%s' is too deep (%d, while max is %d)", dir, depth, cgroup_max_depth);
982 + info("CGROUP: '%s' is too deep (%d, while max is %d)", dir, depth, cgroup_max_depth);
983 return;
984 }
985 }
@@ -1004,7 +1004,7 @@ static inline int find_dir_in_subdirs(const char *base, const char *this, void (
1004
1005 DIR *dir = opendir(this);
1006 if(!dir) {
1007 - error("Cannot read cgroups directory '%s'", base);
1007 + error("CGROUP: cannot read directory '%s'", base);
1008 return ret;
1009 }
1010 ret = 1;
@@ -1110,7 +1110,7 @@ static inline void find_all_cgroups() {
1110 if(find_dir_in_subdirs(cgroup_cpuacct_base, NULL, found_subdir_in_dir) == -1) {
1111 cgroup_enable_cpuacct_stat =
1112 cgroup_enable_cpuacct_usage = CONFIG_BOOLEAN_NO;
1113 - error("disabled CGROUP cpu statistics.");
1113 + error("CGROUP: disabled cpu statistics.");
1114 }
1115 }
1116
@@ -1122,7 +1122,7 @@ static inline void find_all_cgroups() {
1122 cgroup_enable_blkio_throttle_ops =
1123 cgroup_enable_blkio_merged_ops =
1124 cgroup_enable_blkio_queued_ops = CONFIG_BOOLEAN_NO;
1125 - error("disabled CGROUP blkio statistics.");
1125 + error("CGROUP: disabled blkio statistics.");
1126 }
1127 }
1128
@@ -1132,14 +1132,14 @@ static inline void find_all_cgroups() {
1132 cgroup_enable_detailed_memory =
1133 cgroup_enable_swap =
1134 cgroup_enable_memory_failcnt = CONFIG_BOOLEAN_NO;
1135 - error("disabled CGROUP memory statistics.");
1135 + error("CGROUP: disabled memory statistics.");
1136 }
1137 }
1138
1139 if(cgroup_search_in_devices) {
1140 if(find_dir_in_subdirs(cgroup_devices_base, NULL, found_subdir_in_dir) == -1) {
1141 cgroup_search_in_devices = 0;
1142 - error("disabled CGROUP devices statistics.");
1142 + error("CGROUP: disabled devices statistics.");
1143 }
1144 }
1145
@@ -2508,13 +2508,13 @@ void update_cgroup_charts(int update_every) {
2508 void *cgroups_main(void *ptr) {
2509 struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
2510
2511 - info("CGROUP Plugin thread created with task id %d", gettid());
2511 + info("CGROUP plugin thread created with task id %d", gettid());
2512
2513 if(pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL) != 0)
2514 - error("Cannot set pthread cancel type to DEFERRED.");
2514 + error("CGROUP: cannot set pthread cancel type to DEFERRED.");
2515
2516 if(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) != 0)
2517 - error("Cannot set pthread cancel state to ENABLE.");
2517 + error("CGROUP: cannot set pthread cancel state to ENABLE.");
2518
2519 struct rusage thread;
2520