@cryptotaxi247 / netdata-1 / commits / 6720ac9ca

Fix nfsd RPC metrics and remove unused nfsd charts and metrics (#11632)

Vladimir Kobal committed Oct 7, 2021 at 18:20 UTC 6720ac9caaf1f4d79e7decc7088a5f4aa5449094
1 file changed +40 -154
collectors/proc.plugin/proc_net_rpc_nfsd.c
+40 -154
@@ -226,7 +226,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
226 (void)dt;
227 static procfile *ff = NULL;
228 static int do_rc = -1, do_fh = -1, do_io = -1, do_th = -1, do_ra = -1, do_net = -1, do_rpc = -1, do_proc2 = -1, do_proc3 = -1, do_proc4 = -1, do_proc4ops = -1;
229 - static int ra_warning = 0, th_warning = 0, proc2_warning = 0, proc3_warning = 0, proc4_warning = 0, proc4ops_warning = 0;
229 + static int ra_warning = 0, proc2_warning = 0, proc3_warning = 0, proc4_warning = 0, proc4ops_warning = 0;
230
231 if(unlikely(!ff)) {
232 char filename[FILENAME_MAX + 1];
@@ -270,9 +270,9 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
270
271 char *type;
272 unsigned long long rc_hits = 0, rc_misses = 0, rc_nocache = 0;
273 - unsigned long long fh_stale = 0, fh_total_lookups = 0, fh_anonymous_lookups = 0, fh_dir_not_in_dcache = 0, fh_non_dir_not_in_dcache = 0;
273 + unsigned long long fh_stale = 0;
274 unsigned long long io_read = 0, io_write = 0;
275 - unsigned long long th_threads = 0, th_fullcnt = 0, th_hist10 = 0, th_hist20 = 0, th_hist30 = 0, th_hist40 = 0, th_hist50 = 0, th_hist60 = 0, th_hist70 = 0, th_hist80 = 0, th_hist90 = 0, th_hist100 = 0;
275 + unsigned long long th_threads = 0;
276 unsigned long long ra_size = 0, ra_hist10 = 0, ra_hist20 = 0, ra_hist30 = 0, ra_hist40 = 0, ra_hist50 = 0, ra_hist60 = 0, ra_hist70 = 0, ra_hist80 = 0, ra_hist90 = 0, ra_hist100 = 0, ra_none = 0;
277 unsigned long long net_count = 0, net_udp_count = 0, net_tcp_count = 0, net_tcp_connections = 0;
278 unsigned long long rpc_calls = 0, rpc_bad_format = 0, rpc_bad_auth = 0, rpc_bad_client = 0;
@@ -304,13 +304,10 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
304 }
305
306 fh_stale = str2ull(procfile_lineword(ff, l, 1));
307 - fh_total_lookups = str2ull(procfile_lineword(ff, l, 2));
308 - fh_anonymous_lookups = str2ull(procfile_lineword(ff, l, 3));
309 - fh_dir_not_in_dcache = str2ull(procfile_lineword(ff, l, 4));
310 - fh_non_dir_not_in_dcache = str2ull(procfile_lineword(ff, l, 5));
307 +
308 + // other file handler metrics were never used and are always zero
309
312 - unsigned long long sum = fh_stale + fh_total_lookups + fh_anonymous_lookups + fh_dir_not_in_dcache + fh_non_dir_not_in_dcache;
313 - if(sum == 0ULL) do_fh = -1;
310 + if(fh_stale == 0ULL) do_fh = -1;
311 else do_fh = 2;
312 }
313 else if(do_io == 1 && strcmp(type, "io") == 0) {
@@ -333,29 +330,11 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
330 }
331
332 th_threads = str2ull(procfile_lineword(ff, l, 1));
336 - th_fullcnt = str2ull(procfile_lineword(ff, l, 2));
337 - th_hist10 = (unsigned long long)(atof(procfile_lineword(ff, l, 3)) * 1000.0);
338 - th_hist20 = (unsigned long long)(atof(procfile_lineword(ff, l, 4)) * 1000.0);
339 - th_hist30 = (unsigned long long)(atof(procfile_lineword(ff, l, 5)) * 1000.0);
340 - th_hist40 = (unsigned long long)(atof(procfile_lineword(ff, l, 6)) * 1000.0);
341 - th_hist50 = (unsigned long long)(atof(procfile_lineword(ff, l, 7)) * 1000.0);
342 - th_hist60 = (unsigned long long)(atof(procfile_lineword(ff, l, 8)) * 1000.0);
343 - th_hist70 = (unsigned long long)(atof(procfile_lineword(ff, l, 9)) * 1000.0);
344 - th_hist80 = (unsigned long long)(atof(procfile_lineword(ff, l, 10)) * 1000.0);
345 - th_hist90 = (unsigned long long)(atof(procfile_lineword(ff, l, 11)) * 1000.0);
346 - th_hist100 = (unsigned long long)(atof(procfile_lineword(ff, l, 12)) * 1000.0);
347 -
348 - // threads histogram has been disabled on recent kernels
349 - // http://permalink.gmane.org/gmane.linux.nfs/24528
350 - unsigned long long sum = th_hist10 + th_hist20 + th_hist30 + th_hist40 + th_hist50 + th_hist60 + th_hist70 + th_hist80 + th_hist90 + th_hist100;
351 - if(sum == 0ULL) {
352 - if(!th_warning) {
353 - info("Disabling /proc/net/rpc/nfsd threads histogram. It seems unused on this machine. It will be enabled automatically when found with data in it.");
354 - th_warning = 1;
355 - }
356 - do_th = -1;
357 - }
358 - else do_th = 2;
333 +
334 + // thread histogram has been disabled since 2009 (kernel 2.6.30)
335 + // https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8bbfa9f3889b643fc7de82c0c761ef17097f8faf
336 +
337 + do_th = 2;
338 }
339 else if(do_ra == 1 && strcmp(type, "ra") == 0) {
340 if(unlikely(words < 13)) {
@@ -363,6 +342,9 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
342 continue;
343 }
344
345 + // readahead cache has been disabled since 2019 (kernel 5.4)
346 + // https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/fs/nfsd/vfs.c?id=501cb1849f865960501d19d54e6a5af306f9b6fd
347 +
348 ra_size = str2ull(procfile_lineword(ff, l, 1));
349 ra_hist10 = str2ull(procfile_lineword(ff, l, 2));
350 ra_hist20 = str2ull(procfile_lineword(ff, l, 3));
@@ -408,9 +390,9 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
390 }
391
392 rpc_calls = str2ull(procfile_lineword(ff, l, 1));
411 - rpc_bad_format = str2ull(procfile_lineword(ff, l, 2));
412 - rpc_bad_auth = str2ull(procfile_lineword(ff, l, 3));
413 - rpc_bad_client = str2ull(procfile_lineword(ff, l, 4));
393 + rpc_bad_format = str2ull(procfile_lineword(ff, l, 3));
394 + rpc_bad_auth = str2ull(procfile_lineword(ff, l, 4));
395 + rpc_bad_client = str2ull(procfile_lineword(ff, l, 5));
396
397 unsigned long long sum = rpc_calls + rpc_bad_format + rpc_bad_auth + rpc_bad_client;
398 if(sum == 0ULL) do_rpc = -1;
@@ -542,11 +524,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
524
525 if(do_fh == 2) {
526 static RRDSET *st = NULL;
545 - static RRDDIM *rd_stale = NULL,
546 - *rd_total_lookups = NULL,
547 - *rd_anonymous_lookups = NULL,
548 - *rd_dir_not_in_dcache = NULL,
549 - *rd_non_dir_not_in_dcache = NULL;
527 + static RRDDIM *rd_stale = NULL;
528
529 if(unlikely(!st)) {
530 st = rrdset_create_localhost(
@@ -566,18 +544,10 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
544 rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
545
546 rd_stale = rrddim_add(st, "stale", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
569 - rd_total_lookups = rrddim_add(st, "total_lookups", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
570 - rd_anonymous_lookups = rrddim_add(st, "anonymous_lookups", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
571 - rd_dir_not_in_dcache = rrddim_add(st, "dir_not_in_dcache", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
572 - rd_non_dir_not_in_dcache = rrddim_add(st, "non_dir_not_in_dcache", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
547 }
548 else rrdset_next(st);
549
550 rrddim_set_by_pointer(st, rd_stale, fh_stale);
577 - rrddim_set_by_pointer(st, rd_total_lookups, fh_total_lookups);
578 - rrddim_set_by_pointer(st, rd_anonymous_lookups, fh_anonymous_lookups);
579 - rrddim_set_by_pointer(st, rd_dir_not_in_dcache, fh_dir_not_in_dcache);
580 - rrddim_set_by_pointer(st, rd_non_dir_not_in_dcache, fh_non_dir_not_in_dcache);
551 rrdset_done(st);
552 }
553
@@ -617,116 +587,32 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
587 // --------------------------------------------------------------------
588
589 if(do_th == 2) {
620 - {
621 - static RRDSET *st = NULL;
622 - static RRDDIM *rd_threads = NULL;
623 -
624 - if(unlikely(!st)) {
625 - st = rrdset_create_localhost(
626 - "nfsd"
627 - , "threads"
628 - , NULL
629 - , "threads"
630 - , NULL
631 - , "NFS Server Threads"
632 - , "threads"
633 - , PLUGIN_PROC_NAME
634 - , PLUGIN_PROC_MODULE_NFSD_NAME
635 - , NETDATA_CHART_PRIO_NFSD_THREADS
636 - , update_every
637 - , RRDSET_TYPE_LINE
638 - );
639 -
640 - rd_threads = rrddim_add(st, "threads", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
641 - }
642 - else rrdset_next(st);
643 -
644 - rrddim_set_by_pointer(st, rd_threads, th_threads);
645 - rrdset_done(st);
646 - }
590 + static RRDSET *st = NULL;
591 + static RRDDIM *rd_threads = NULL;
592
648 - {
649 - static RRDSET *st = NULL;
650 - static RRDDIM *rd_full_count = NULL;
651 -
652 - if(unlikely(!st)) {
653 - st = rrdset_create_localhost(
654 - "nfsd"
655 - , "threads_fullcnt"
656 - , NULL
657 - , "threads"
658 - , NULL
659 - , "NFS Server Threads Full Count"
660 - , "events"
661 - , PLUGIN_PROC_NAME
662 - , PLUGIN_PROC_MODULE_NFSD_NAME
663 - , NETDATA_CHART_PRIO_NFSD_THREADS_FULLCNT
664 - , update_every
665 - , RRDSET_TYPE_LINE
666 - );
667 -
668 - rd_full_count = rrddim_add(st, "full_count", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
669 - }
670 - else rrdset_next(st);
593 + if(unlikely(!st)) {
594 + st = rrdset_create_localhost(
595 + "nfsd"
596 + , "threads"
597 + , NULL
598 + , "threads"
599 + , NULL
600 + , "NFS Server Threads"
601 + , "threads"
602 + , PLUGIN_PROC_NAME
603 + , PLUGIN_PROC_MODULE_NFSD_NAME
604 + , NETDATA_CHART_PRIO_NFSD_THREADS
605 + , update_every
606 + , RRDSET_TYPE_LINE
607 + );
608
672 - rrddim_set_by_pointer(st, rd_full_count, th_fullcnt);
673 - rrdset_done(st);
609 + rd_threads = rrddim_add(st, "threads", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
610 }
611 + else rrdset_next(st);
612 +
613 + rrddim_set_by_pointer(st, rd_threads, th_threads);
614 + rrdset_done(st);
615
676 - {
677 - static RRDSET *st = NULL;
678 - static RRDDIM *rd_th_hist10 = NULL,
679 - *rd_th_hist20 = NULL,
680 - *rd_th_hist30 = NULL,
681 - *rd_th_hist40 = NULL,
682 - *rd_th_hist50 = NULL,
683 - *rd_th_hist60 = NULL,
684 - *rd_th_hist70 = NULL,
685 - *rd_th_hist80 = NULL,
686 - *rd_th_hist90 = NULL,
687 - *rd_th_hist100 = NULL;
688 -
689 - if(unlikely(!st)) {
690 - st = rrdset_create_localhost(
691 - "nfsd"
692 - , "threads_histogram"
693 - , NULL
694 - , "threads"
695 - , NULL
696 - , "NFS Server Threads Usage Histogram"
697 - , "percentage"
698 - , PLUGIN_PROC_NAME
699 - , PLUGIN_PROC_MODULE_NFSD_NAME
700 - , NETDATA_CHART_PRIO_NFSD_THREADS_HISTOGRAM
701 - , update_every
702 - , RRDSET_TYPE_LINE
703 - );
704 -
705 - rd_th_hist10 = rrddim_add(st, "0%-10%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
706 - rd_th_hist20 = rrddim_add(st, "10%-20%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
707 - rd_th_hist30 = rrddim_add(st, "20%-30%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
708 - rd_th_hist40 = rrddim_add(st, "30%-40%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
709 - rd_th_hist50 = rrddim_add(st, "40%-50%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
710 - rd_th_hist60 = rrddim_add(st, "50%-60%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
711 - rd_th_hist70 = rrddim_add(st, "60%-70%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
712 - rd_th_hist80 = rrddim_add(st, "70%-80%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
713 - rd_th_hist90 = rrddim_add(st, "80%-90%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
714 - rd_th_hist100 = rrddim_add(st, "90%-100%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
715 - }
716 - else rrdset_next(st);
717 -
718 - rrddim_set_by_pointer(st, rd_th_hist10, th_hist10);
719 - rrddim_set_by_pointer(st, rd_th_hist20, th_hist20);
720 - rrddim_set_by_pointer(st, rd_th_hist30, th_hist30);
721 - rrddim_set_by_pointer(st, rd_th_hist40, th_hist40);
722 - rrddim_set_by_pointer(st, rd_th_hist50, th_hist50);
723 - rrddim_set_by_pointer(st, rd_th_hist60, th_hist60);
724 - rrddim_set_by_pointer(st, rd_th_hist70, th_hist70);
725 - rrddim_set_by_pointer(st, rd_th_hist80, th_hist80);
726 - rrddim_set_by_pointer(st, rd_th_hist90, th_hist90);
727 - rrddim_set_by_pointer(st, rd_th_hist100, th_hist100);
728 - rrdset_done(st);
729 - }
616 }
617
618 // --------------------------------------------------------------------