]> arthur.barton.de Git - netdata.git/commitdiff
prevent cgroup renames for disabled cgroups; fixes #797
authorCosta Tsaousis <costa@tsaousis.gr>
Sun, 21 Aug 2016 10:01:55 +0000 (13:01 +0300)
committerCosta Tsaousis <costa@tsaousis.gr>
Sun, 21 Aug 2016 10:01:55 +0000 (13:01 +0300)
src/sys_fs_cgroup.c

index 5ab17f8646b42e9d0c74b9b75947238f1aaa2666..9a42bda4c1a397b2cc0bf12f87f6aa33a74f2e94 100644 (file)
@@ -616,8 +616,8 @@ void cgroup_get_chart_id(struct cgroup *cg) {
 
         freez(cg->chart_id);
         cg->chart_id = strdupz(s);
-
         netdata_fix_chart_id(cg->chart_id);
+        cg->hash_chart = simple_hash(cg->chart_id);
 
         debug(D_CGROUP, "cgroup '%s' renamed to '%s' (title: '%s')", cg->id, cg->chart_id, cg->chart_title);
     }
@@ -679,12 +679,11 @@ struct cgroup *cgroup_add(const char *id) {
 
     struct cgroup *cg = callocz(1, sizeof(struct cgroup));
 
-    debug(D_CGROUP, "adding cgroup '%s'", id);
-
     cg->id = strdupz(id);
     cg->hash = simple_hash(cg->id);
 
     cg->chart_id = strdupz(chart_id);
+    netdata_fix_chart_id(cg->chart_id);
     cg->hash_chart = simple_hash(cg->chart_id);
 
     cg->chart_title = strdupz(chart_id);
@@ -701,7 +700,9 @@ struct cgroup *cgroup_add(const char *id) {
     cgroup_root_count++;
 
     // fix the name by calling the external script
-    cgroup_get_chart_id(cg);
+    if(def) cgroup_get_chart_id(cg);
+
+    debug(D_CGROUP, "adding cgroup '%s' with chart id '%s'", id, chart_id);
 
     char option[FILENAME_MAX + 1];
     snprintfz(option, FILENAME_MAX, "enable cgroup %s", cg->chart_title);