]> arthur.barton.de Git - netdata.git/blobdiff - src/apps_plugin.c
added support for monitoring cgroups
[netdata.git] / src / apps_plugin.c
index e8a6f43aefe55a0bcc77d714b0c89f831016b042..4d05ab05888924763cbc126298f6618537c41c82 100644 (file)
@@ -43,8 +43,6 @@
 #define MAX_NAME 100
 #define MAX_CMDLINE 1024
 
-unsigned long long Hertz = 1;
-
 long processors = 1;
 long pid_max = 32768;
 int debug = 0;
@@ -267,28 +265,6 @@ long get_system_pid_max(void) {
        return mpid;
 }
 
-unsigned long long get_system_hertz(void)
-{
-       unsigned long long myhz = 1;
-
-#ifdef _SC_CLK_TCK
-       if((myhz = (unsigned long long int) sysconf(_SC_CLK_TCK)) > 0) {
-               return myhz;
-       }
-#endif
-
-#ifdef HZ
-       myhz = HZ;    /* <asm/param.h> */
-#else /* HZ */
-       /* If 32-bit or big-endian (not Alpha or ia64), assume HZ is 100. */
-       hz = (sizeof(long)==sizeof(int) || htons(999)==999) ? 100UL : 1024UL;
-#endif /* HZ */
-
-       error("Unknown HZ value. Assuming %llu.", myhz);
-       return myhz;
-}
-
-
 // ----------------------------------------------------------------------------
 // target
 // target is the structure that process data are aggregated
@@ -410,7 +386,7 @@ struct target *get_users_target(uid_t uid)
        else
                snprintf(w->name, MAX_NAME, "%s", pw->pw_name);
 
-       netdata_fix_id(w->name);
+       netdata_fix_chart_name(w->name);
 
        w->uid = uid;
 
@@ -448,7 +424,7 @@ struct target *get_groups_target(gid_t gid)
        else
                snprintf(w->name, MAX_NAME, "%s", gr->gr_name);
 
-       netdata_fix_id(w->name);
+       netdata_fix_chart_name(w->name);
 
        w->gid = gid;
 
@@ -2267,7 +2243,7 @@ void send_charts_updates_to_netdata(struct target *root, const char *type, const
        for (w = root; w ; w = w->next) {
                if(w->target || (!w->processes && !w->exposed)) continue;
 
-               fprintf(stdout, "DIMENSION %s '' incremental 100 %llu %s\n", w->name, Hertz, w->hidden ? "hidden,noreset" : "noreset");
+               fprintf(stdout, "DIMENSION %s '' incremental 100 %u %s\n", w->name, hz, w->hidden ? "hidden,noreset" : "noreset");
        }
 
        fprintf(stdout, "CHART %s.mem '' '%s Dedicated Memory (w/o shared)' 'MB' mem %s.mem stacked 20003 %d\n", type, title, type, update_every);
@@ -2295,14 +2271,14 @@ void send_charts_updates_to_netdata(struct target *root, const char *type, const
        for (w = root; w ; w = w->next) {
                if(w->target || (!w->processes && !w->exposed)) continue;
 
-               fprintf(stdout, "DIMENSION %s '' incremental 100 %llu noreset\n", w->name, Hertz * processors);
+               fprintf(stdout, "DIMENSION %s '' incremental 100 %ld noreset\n", w->name, hz * processors);
        }
 
        fprintf(stdout, "CHART %s.cpu_system '' '%s CPU System Time (%ld%% = %ld core%s)' 'cpu time %%' cpu %s.cpu_system stacked 20021 %d\n", type, title, (processors * 100), processors, (processors>1)?"s":"", type, update_every);
        for (w = root; w ; w = w->next) {
                if(w->target || (!w->processes && !w->exposed)) continue;
 
-               fprintf(stdout, "DIMENSION %s '' incremental 100 %llu noreset\n", w->name, Hertz * processors);
+               fprintf(stdout, "DIMENSION %s '' incremental 100 %ld noreset\n", w->name, hz * processors);
        }
 
        fprintf(stdout, "CHART %s.major_faults '' '%s Major Page Faults (swap read)' 'page faults/s' swap %s.major_faults stacked 20010 %d\n", type, title, type, update_every);
@@ -2447,7 +2423,7 @@ int main(int argc, char **argv)
 
        time_t started_t = time(NULL);
        time_t current_t;
-       Hertz = get_system_hertz();
+       get_HZ();
        pid_max = get_system_pid_max();
        processors = get_system_cpus();