@cryptotaxi247 / netdata-1 / commits / 28e65ca36

apps: disable reporting min/avg/max group uptime by default (#11609)

Ilya Mashchenko committed Oct 4, 2021 at 14:46 UTC 28e65ca36480d257a4cbe1316e663f5a403d252c
1 file changed +60 -48
collectors/apps.plugin/apps_plugin.c
+60 -48
@@ -128,6 +128,7 @@ static int
128 enable_file_charts = 1,
129 max_fds_cache_seconds = 60,
130 #endif
131 + enable_detailed_uptime_charts = 0,
132 enable_users_charts = 1,
133 enable_groups_charts = 1,
134 include_exited_childs = 1;
@@ -3519,26 +3520,28 @@ static void send_collected_data_to_netdata(struct target *root, const char *type
3520 }
3521 send_END();
3522
3522 - send_BEGIN(type, "uptime_min", dt);
3523 - for (w = root; w ; w = w->next) {
3524 - if(unlikely(w->exposed && w->processes))
3525 - send_SET(w->name, w->uptime_min);
3526 - }
3527 - send_END();
3523 + if (enable_detailed_uptime_charts) {
3524 + send_BEGIN(type, "uptime_min", dt);
3525 + for (w = root; w ; w = w->next) {
3526 + if(unlikely(w->exposed && w->processes))
3527 + send_SET(w->name, w->uptime_min);
3528 + }
3529 + send_END();
3530
3529 - send_BEGIN(type, "uptime_avg", dt);
3530 - for (w = root; w ; w = w->next) {
3531 - if(unlikely(w->exposed && w->processes))
3532 - send_SET(w->name, w->uptime_sum / w->processes);
3533 - }
3534 - send_END();
3531 + send_BEGIN(type, "uptime_avg", dt);
3532 + for (w = root; w ; w = w->next) {
3533 + if(unlikely(w->exposed && w->processes))
3534 + send_SET(w->name, w->uptime_sum / w->processes);
3535 + }
3536 + send_END();
3537
3536 - send_BEGIN(type, "uptime_max", dt);
3537 - for (w = root; w ; w = w->next) {
3538 - if(unlikely(w->exposed && w->processes))
3539 - send_SET(w->name, w->uptime_max);
3538 + send_BEGIN(type, "uptime_max", dt);
3539 + for (w = root; w ; w = w->next) {
3540 + if(unlikely(w->exposed && w->processes))
3541 + send_SET(w->name, w->uptime_max);
3542 + }
3543 + send_END();
3544 }
3541 - send_END();
3545 #endif
3546
3547 send_BEGIN(type, "mem", dt);
@@ -3710,22 +3713,24 @@ static void send_charts_updates_to_netdata(struct target *root, const char *type
3713 fprintf(stdout, "DIMENSION %s '' absolute 1 1\n", w->name);
3714 }
3715
3713 - fprintf(stdout, "CHART %s.uptime_min '' '%s Minimum Uptime' 'seconds' processes %s.uptime_min line 20009 %d\n", type, title, type, update_every);
3714 - for (w = root; w ; w = w->next) {
3715 - if(unlikely(w->exposed))
3716 - fprintf(stdout, "DIMENSION %s '' absolute 1 1\n", w->name);
3717 - }
3716 + if (enable_detailed_uptime_charts) {
3717 + fprintf(stdout, "CHART %s.uptime_min '' '%s Minimum Uptime' 'seconds' processes %s.uptime_min line 20009 %d\n", type, title, type, update_every);
3718 + for (w = root; w ; w = w->next) {
3719 + if(unlikely(w->exposed))
3720 + fprintf(stdout, "DIMENSION %s '' absolute 1 1\n", w->name);
3721 + }
3722
3719 - fprintf(stdout, "CHART %s.uptime_avg '' '%s Average Uptime' 'seconds' processes %s.uptime_avg line 20010 %d\n", type, title, type, update_every);
3720 - for (w = root; w ; w = w->next) {
3721 - if(unlikely(w->exposed))
3722 - fprintf(stdout, "DIMENSION %s '' absolute 1 1\n", w->name);
3723 - }
3723 + fprintf(stdout, "CHART %s.uptime_avg '' '%s Average Uptime' 'seconds' processes %s.uptime_avg line 20010 %d\n", type, title, type, update_every);
3724 + for (w = root; w ; w = w->next) {
3725 + if(unlikely(w->exposed))
3726 + fprintf(stdout, "DIMENSION %s '' absolute 1 1\n", w->name);
3727 + }
3728
3725 - fprintf(stdout, "CHART %s.uptime_max '' '%s Maximum Uptime' 'seconds' processes %s.uptime_max line 20011 %d\n", type, title, type, update_every);
3726 - for (w = root; w ; w = w->next) {
3727 - if(unlikely(w->exposed))
3728 - fprintf(stdout, "DIMENSION %s '' absolute 1 1\n", w->name);
3729 + fprintf(stdout, "CHART %s.uptime_max '' '%s Maximum Uptime' 'seconds' processes %s.uptime_max line 20011 %d\n", type, title, type, update_every);
3730 + for (w = root; w ; w = w->next) {
3731 + if(unlikely(w->exposed))
3732 + fprintf(stdout, "DIMENSION %s '' absolute 1 1\n", w->name);
3733 + }
3734 }
3735 #endif
3736
@@ -3939,6 +3944,11 @@ static void parse_args(int argc, char **argv)
3944 continue;
3945 }
3946
3947 + if(strcmp("with-detailed-uptime", argv[i]) == 0) {
3948 + enable_detailed_uptime_charts = 1;
3949 + continue;
3950 + }
3951 +
3952 if(strcmp("-h", argv[i]) == 0 || strcmp("--help", argv[i]) == 0) {
3953 fprintf(stderr,
3954 "\n"
@@ -3951,34 +3961,36 @@ static void parse_args(int argc, char **argv)
3961 "\n"
3962 " Available command line options:\n"
3963 "\n"
3954 - " SECONDS set the data collection frequency\n"
3964 + " SECONDS set the data collection frequency\n"
3965 "\n"
3956 - " debug enable debugging (lot of output)\n"
3966 + " debug enable debugging (lot of output)\n"
3967 "\n"
3968 " with-childs\n"
3959 - " without-childs enable / disable aggregating exited\n"
3960 - " children resources into parents\n"
3961 - " (default is enabled)\n"
3969 + " without-childs enable / disable aggregating exited\n"
3970 + " children resources into parents\n"
3971 + " (default is enabled)\n"
3972 "\n"
3973 " with-guest\n"
3964 - " without-guest enable / disable reporting guest charts\n"
3965 - " (default is disabled)\n"
3974 + " without-guest enable / disable reporting guest charts\n"
3975 + " (default is disabled)\n"
3976 "\n"
3977 " with-files\n"
3968 - " without-files enable / disable reporting files, sockets, pipes\n"
3969 - " (default is enabled)\n"
3978 + " without-files enable / disable reporting files, sockets, pipes\n"
3979 + " (default is enabled)\n"
3980 + "\n"
3981 + " without-users disable reporting per user charts\n"
3982 "\n"
3971 - " without-users disable reporting per user charts\n"
3983 + " without-groups disable reporting per user group charts\n"
3984 "\n"
3973 - " without-groups disable reporting per user group charts\n"
3985 + " with-detailed-uptime enable reporting min/avg/max uptime charts\n"
3986 "\n"
3987 #ifndef __FreeBSD__
3976 - " fds-cache-secs N cache the files of processed for N seconds\n"
3977 - " caching is adaptive per file (when a file\n"
3978 - " is found, it starts at 0 and while the file\n"
3979 - " remains open, it is incremented up to the\n"
3980 - " max given)\n"
3981 - " (default is %d seconds)\n"
3988 + " fds-cache-secs N cache the files of processed for N seconds\n"
3989 + " caching is adaptive per file (when a file\n"
3990 + " is found, it starts at 0 and while the file\n"
3991 + " remains open, it is incremented up to the\n"
3992 + " max given)\n"
3993 + " (default is %d seconds)\n"
3994 "\n"
3995 #endif
3996 " version or -v or -V print program version and exit\n"