summaryrefslogtreecommitdiffstats
path: root/collectors/proc.plugin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--collectors/proc.plugin/Makefile.am8
-rw-r--r--collectors/proc.plugin/Makefile.in464
-rw-r--r--collectors/proc.plugin/README.md200
-rw-r--r--collectors/proc.plugin/ipc.c (renamed from src/ipc.c)22
-rw-r--r--collectors/proc.plugin/plugin_proc.c (renamed from src/plugin_proc.c)20
-rw-r--r--collectors/proc.plugin/plugin_proc.h (renamed from src/plugin_proc.h)36
-rw-r--r--collectors/proc.plugin/proc_diskstats.c (renamed from src/proc_diskstats.c)455
-rw-r--r--collectors/proc.plugin/proc_interrupts.c (renamed from src/proc_interrupts.c)77
-rw-r--r--collectors/proc.plugin/proc_loadavg.c (renamed from src/proc_loadavg.c)25
-rw-r--r--collectors/proc.plugin/proc_meminfo.c (renamed from src/proc_meminfo.c)71
-rw-r--r--collectors/proc.plugin/proc_net_dev.c (renamed from src/proc_net_dev.c)82
-rw-r--r--collectors/proc.plugin/proc_net_ip_vs_stats.c (renamed from src/proc_net_ip_vs_stats.c)34
-rw-r--r--collectors/proc.plugin/proc_net_netstat.c (renamed from src/proc_net_netstat.c)421
-rw-r--r--collectors/proc.plugin/proc_net_rpc_nfs.c (renamed from src/proc_net_rpc_nfs.c)49
-rw-r--r--collectors/proc.plugin/proc_net_rpc_nfsd.c (renamed from src/proc_net_rpc_nfsd.c)84
-rw-r--r--collectors/proc.plugin/proc_net_sctp_snmp.c352
-rw-r--r--collectors/proc.plugin/proc_net_snmp.c (renamed from src/proc_net_snmp.c)253
-rw-r--r--collectors/proc.plugin/proc_net_snmp6.c (renamed from src/proc_net_snmp6.c)137
-rw-r--r--collectors/proc.plugin/proc_net_sockstat.c (renamed from src/proc_net_sockstat.c)66
-rw-r--r--collectors/proc.plugin/proc_net_sockstat6.c (renamed from src/proc_net_sockstat6.c)36
-rw-r--r--collectors/proc.plugin/proc_net_softnet_stat.c (renamed from src/proc_net_softnet_stat.c)18
-rw-r--r--collectors/proc.plugin/proc_net_stat_conntrack.c (renamed from src/proc_net_stat_conntrack.c)41
-rw-r--r--collectors/proc.plugin/proc_net_stat_synproxy.c (renamed from src/proc_net_stat_synproxy.c)30
-rw-r--r--collectors/proc.plugin/proc_self_mountinfo.c (renamed from src/proc_self_mountinfo.c)4
-rw-r--r--collectors/proc.plugin/proc_self_mountinfo.h (renamed from src/proc_self_mountinfo.h)2
-rw-r--r--collectors/proc.plugin/proc_softirqs.c (renamed from src/proc_softirqs.c)73
-rw-r--r--collectors/proc.plugin/proc_spl_kstat_zfs.c (renamed from src/proc_spl_kstat_zfs.c)8
-rw-r--r--collectors/proc.plugin/proc_stat.c (renamed from src/proc_stat.c)71
-rw-r--r--collectors/proc.plugin/proc_sys_kernel_random_entropy_avail.c (renamed from src/proc_sys_kernel_random_entropy_avail.c)10
-rw-r--r--collectors/proc.plugin/proc_uptime.c (renamed from src/proc_uptime.c)10
-rw-r--r--collectors/proc.plugin/proc_vmstat.c (renamed from src/proc_vmstat.c)26
-rw-r--r--collectors/proc.plugin/sys_devices_system_edac_mc.c (renamed from src/sys_devices_system_edac_mc.c)12
-rw-r--r--collectors/proc.plugin/sys_devices_system_node.c (renamed from src/sys_devices_system_node.c)8
-rw-r--r--collectors/proc.plugin/sys_fs_btrfs.c (renamed from src/sys_fs_btrfs.c)58
-rw-r--r--collectors/proc.plugin/sys_kernel_mm_ksm.c (renamed from src/sys_kernel_mm_ksm.c)22
-rw-r--r--collectors/proc.plugin/zfs_common.c (renamed from src/zfs_common.c)79
-rw-r--r--collectors/proc.plugin/zfs_common.h (renamed from src/zfs_common.h)10
37 files changed, 2440 insertions, 934 deletions
diff --git a/collectors/proc.plugin/Makefile.am b/collectors/proc.plugin/Makefile.am
new file mode 100644
index 000000000..19554bed8
--- /dev/null
+++ b/collectors/proc.plugin/Makefile.am
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+AUTOMAKE_OPTIONS = subdir-objects
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
+
+dist_noinst_DATA = \
+ README.md \
+ $(NULL)
diff --git a/collectors/proc.plugin/Makefile.in b/collectors/proc.plugin/Makefile.in
new file mode 100644
index 000000000..f6db90c87
--- /dev/null
+++ b/collectors/proc.plugin/Makefile.in
@@ -0,0 +1,464 @@
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = collectors/proc.plugin
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(dist_noinst_DATA)
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/build/m4/ax_c___atomic.m4 \
+ $(top_srcdir)/build/m4/ax_c__generic.m4 \
+ $(top_srcdir)/build/m4/ax_c_lto.m4 \
+ $(top_srcdir)/build/m4/ax_c_mallinfo.m4 \
+ $(top_srcdir)/build/m4/ax_c_mallopt.m4 \
+ $(top_srcdir)/build/m4/ax_check_compile_flag.m4 \
+ $(top_srcdir)/build/m4/ax_gcc_func_attribute.m4 \
+ $(top_srcdir)/build/m4/ax_pthread.m4 \
+ $(top_srcdir)/build/m4/jemalloc.m4 \
+ $(top_srcdir)/build/m4/tcmalloc.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+DATA = $(dist_noinst_DATA)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+IPMIMONITORING_CFLAGS = @IPMIMONITORING_CFLAGS@
+IPMIMONITORING_LIBS = @IPMIMONITORING_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBCAP_CFLAGS = @LIBCAP_CFLAGS@
+LIBCAP_LIBS = @LIBCAP_LIBS@
+LIBMNL_CFLAGS = @LIBMNL_CFLAGS@
+LIBMNL_LIBS = @LIBMNL_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MATH_CFLAGS = @MATH_CFLAGS@
+MATH_LIBS = @MATH_LIBS@
+MKDIR_P = @MKDIR_P@
+NFACCT_CFLAGS = @NFACCT_CFLAGS@
+NFACCT_LIBS = @NFACCT_LIBS@
+OBJEXT = @OBJEXT@
+OPTIONAL_IPMIMONITORING_CFLAGS = @OPTIONAL_IPMIMONITORING_CFLAGS@
+OPTIONAL_IPMIMONITORING_LIBS = @OPTIONAL_IPMIMONITORING_LIBS@
+OPTIONAL_LIBCAP_CFLAGS = @OPTIONAL_LIBCAP_CFLAGS@
+OPTIONAL_LIBCAP_LIBS = @OPTIONAL_LIBCAP_LIBS@
+OPTIONAL_MATH_CLFAGS = @OPTIONAL_MATH_CLFAGS@
+OPTIONAL_MATH_LIBS = @OPTIONAL_MATH_LIBS@
+OPTIONAL_NFACCT_CLFAGS = @OPTIONAL_NFACCT_CLFAGS@
+OPTIONAL_NFACCT_LIBS = @OPTIONAL_NFACCT_LIBS@
+OPTIONAL_UUID_CLFAGS = @OPTIONAL_UUID_CLFAGS@
+OPTIONAL_UUID_LIBS = @OPTIONAL_UUID_LIBS@
+OPTIONAL_ZLIB_CLFAGS = @OPTIONAL_ZLIB_CLFAGS@
+OPTIONAL_ZLIB_LIBS = @OPTIONAL_ZLIB_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_RPM_RELEASE = @PACKAGE_RPM_RELEASE@
+PACKAGE_RPM_VERSION = @PACKAGE_RPM_VERSION@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SSE_CANDIDATE = @SSE_CANDIDATE@
+STRIP = @STRIP@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+ZLIB_CFLAGS = @ZLIB_CFLAGS@
+ZLIB_LIBS = @ZLIB_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_target = @build_target@
+build_vendor = @build_vendor@
+builddir = @builddir@
+cachedir = @cachedir@
+chartsdir = @chartsdir@
+configdir = @configdir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+has_jemalloc = @has_jemalloc@
+has_tcmalloc = @has_tcmalloc@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libconfigdir = @libconfigdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+nodedir = @nodedir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pluginsdir = @pluginsdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pythondir = @pythondir@
+registrydir = @registrydir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+varlibdir = @varlibdir@
+webdir = @webdir@
+AUTOMAKE_OPTIONS = subdir-objects
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
+dist_noinst_DATA = \
+ README.md \
+ $(NULL)
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu collectors/proc.plugin/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu collectors/proc.plugin/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+tags TAGS:
+
+ctags CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic cscopelist-am \
+ ctags-am distclean distclean-generic distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+ pdf-am ps ps-am tags-am uninstall uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/collectors/proc.plugin/README.md b/collectors/proc.plugin/README.md
new file mode 100644
index 000000000..9d444f3d0
--- /dev/null
+++ b/collectors/proc.plugin/README.md
@@ -0,0 +1,200 @@
+
+# proc.plugin
+
+ - `/proc/net/dev` (all network interfaces for all their values)
+ - `/proc/diskstats` (all disks for all their values)
+ - `/proc/net/snmp` (total IPv4, TCP and UDP usage)
+ - `/proc/net/snmp6` (total IPv6 usage)
+ - `/proc/net/netstat` (more IPv4 usage)
+ - `/proc/net/stat/nf_conntrack` (connection tracking performance)
+ - `/proc/net/stat/synproxy` (synproxy performance)
+ - `/proc/net/ip_vs/stats` (IPVS connection statistics)
+ - `/proc/stat` (CPU utilization)
+ - `/proc/meminfo` (memory information)
+ - `/proc/vmstat` (system performance)
+ - `/proc/net/rpc/nfsd` (NFS server statistics for both v3 and v4 NFS servers)
+ - `/sys/fs/cgroup` (Control Groups - Linux Containers)
+ - `/proc/self/mountinfo` (mount points)
+ - `/proc/interrupts` (total and per core hardware interrupts)
+ - `/proc/softirqs` (total and per core software interrupts)
+ - `/proc/loadavg` (system load and total processes running)
+ - `/proc/sys/kernel/random/entropy_avail` (random numbers pool availability - used in cryptography)
+ - `ksm` Kernel Same-Page Merging performance (several files under `/sys/kernel/mm/ksm`).
+ - `netdata` (internal netdata resources utilization)
+
+
+---
+
+# Monitoring Disks
+
+> Live demo of disk monitoring at: **[http://london.netdata.rocks](https://registry.my-netdata.io/#menu_disk)**
+
+Performance monitoring for Linux disks is quite complicated. The main reason is the plethora of disk technologies available. There are many different hardware disk technologies, but there are even more **virtual disk** technologies that can provide additional storage features.
+
+Hopefully, the Linux kernel provides many metrics that can provide deep insights of what our disks our doing. The kernel measures all these metrics on all layers of storage: **virtual disks**, **physical disks** and **partitions of disks**.
+
+Let's see the list of metrics provided by netdata for each of the above:
+
+### I/O bandwidth/s (kb/s)
+
+The amount of data transferred from and to the disk.
+
+### I/O operations/s
+
+The number of I/O operations completed.
+
+### Queued I/O operations
+
+The number of currently queued I/O operations. For traditional disks that execute commands one after another, one of them is being run by the disk and the rest are just waiting in a queue.
+
+### Backlog size (time in ms)
+
+The expected duration of the currently queued I/O operations.
+
+### Utilization (time percentage)
+
+The percentage of time the disk was busy with something. This is a very interesting metric, since for most disks, that execute commands sequentially, **this is the key indication of congestion**. A sequential disk that is 100% of the available time busy, has no time to do anything more, so even if the bandwidth or the number of operations executed by the disk is low, its capacity has been reached.
+
+Of course, for newer disk technologies (like fusion cards) that are capable to execute multiple commands in parallel, this metric is just meaningless.
+
+### Average I/O operation time (ms)
+
+The average time for I/O requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them.
+
+### Average I/O operation size (kb)
+
+The average amount of data of the completed I/O operations.
+
+### Average Service Time (ms)
+
+The average service time for completed I/O operations. This metric is calculated using the total busy time of the disk and the number of completed operations. If the disk is able to execute multiple parallel operations the reporting average service time will be misleading.
+
+### Merged I/O operations/s
+
+The Linux kernel is capable of merging I/O operations. So, if two requests to read data from the disk are adjacent, the Linux kernel may merge them to one before giving them to disk. This metric measures the number of operations that have been merged by the Linux kernel.
+
+### Total I/O time
+
+The sum of the duration of all completed I/O operations. This number can exceed the interval if the disk is able to execute multiple I/O operations in parallel.
+
+### Space usage
+
+For mounted disks, netdata will provide a chart for their space, with 3 dimensions:
+
+1. free
+2. used
+3. reserved for root
+
+### inode usage
+
+For mounted disks, netdata will provide a chart for their inodes (number of file and directories), with 3 dimensions:
+
+1. free
+2. used
+3. reserved for root
+
+---
+
+## disk names
+
+netdata will automatically set the name of disks on the dashboard, from the mount point they are mounted, of course only when they are mounted. Changes in mount points are not currently detected (you will have to restart netdata to change the name of the disk).
+
+---
+
+## performance metrics
+
+By default netdata will enable monitoring metrics only when they are not zero. If they are constantly zero they are ignored. Metrics that will start having values, after netdata is started, will be detected and charts will be automatically added to the dashboard (a refresh of the dashboard is needed for them to appear though).
+
+netdata categorizes all block devices in 3 categories:
+
+1. physical disks (i.e. block devices that does not have slaves and are not partitions)
+2. virtual disks (i.e. block devices that have slaves - like RAID devices)
+3. disk partitions (i.e. block devices that are part of a physical disk)
+
+Performance metrics are enabled by default for all disk devices, except partitions and not-mounted virtual disks. Of course, you can enable/disable monitoring any block device by editing the netdata configuration file.
+
+### netdata configuration
+
+You can get the running netdata configuration using this:
+
+```sh
+cd /etc/netdata
+curl "http://localhost:19999/netdata.conf" >netdata.conf.new
+mv netdata.conf.new netdata.conf
+```
+
+Then edit `netdata.conf` and find the following section. This is the basic plugin configuration.
+
+```
+[plugin:proc:/proc/diskstats]
+ # enable new disks detected at runtime = yes
+ # performance metrics for physical disks = auto
+ # performance metrics for virtual disks = no
+ # performance metrics for partitions = no
+ # performance metrics for mounted filesystems = no
+ # performance metrics for mounted virtual disks = auto
+ # space metrics for mounted filesystems = auto
+ # bandwidth for all disks = auto
+ # operations for all disks = auto
+ # merged operations for all disks = auto
+ # i/o time for all disks = auto
+ # queued operations for all disks = auto
+ # utilization percentage for all disks = auto
+ # backlog for all disks = auto
+ # space usage for all disks = auto
+ # inodes usage for all disks = auto
+ # filename to monitor = /proc/diskstats
+ # path to get block device infos = /sys/dev/block/%lu:%lu/%s
+ # path to get h/w sector size = /sys/block/%s/queue/hw_sector_size
+ # path to get h/w sector size for partitions = /sys/dev/block/%lu:%lu/subsystem/%s/../queue
+/hw_sector_size
+
+```
+
+For each virtual disk, physical disk and partition you will have a section like this:
+
+```
+[plugin:proc:/proc/diskstats:sda]
+ # enable = yes
+ # enable performance metrics = auto
+ # bandwidth = auto
+ # operations = auto
+ # merged operations = auto
+ # i/o time = auto
+ # queued operations = auto
+ # utilization percentage = auto
+ # backlog = auto
+```
+
+For all configuration options:
+- `auto` = enable monitoring if the collected values are not zero
+- `yes` = enable monitoring
+- `no` = disable monitoring
+
+Of course, to set options, you will have to uncomment them. The comments show the internal defaults.
+
+After saving `/etc/netdata/netdata.conf`, restart your netdata to apply them.
+
+#### Disabling performance metrics for individual device and to multiple devices by device type
+You can pretty easy disable performance metrics for individual device, for ex.:
+```
+[plugin:proc:/proc/diskstats:sda]
+ enable performance metrics = no
+```
+But sometimes you need disable performance metrics for all devices with the same type, to do it you need to figure out device type from `/proc/diskstats` for ex.:
+```
+ 7 0 loop0 1651 0 3452 168 0 0 0 0 0 8 168
+ 7 1 loop1 4955 0 11924 880 0 0 0 0 0 64 880
+ 7 2 loop2 36 0 216 4 0 0 0 0 0 4 4
+ 7 6 loop6 0 0 0 0 0 0 0 0 0 0 0
+ 7 7 loop7 0 0 0 0 0 0 0 0 0 0 0
+ 251 2 zram2 27487 0 219896 188 79953 0 639624 1640 0 1828 1828
+ 251 3 zram3 27348 0 218784 152 79952 0 639616 1960 0 2060 2104
+```
+All zram devices starts with `251` number and all loop devices starts with `7`.
+So, to disable performance metrics for all loop devices you could add `performance metrics for disks with major 7 = no` to `[plugin:proc:/proc/diskstats]` section.
+```
+[plugin:proc:/proc/diskstats]
+ performance metrics for disks with major 7 = no
+```
+
diff --git a/src/ipc.c b/collectors/proc.plugin/ipc.c
index a9076fca4..6c6bee519 100644
--- a/src/ipc.c
+++ b/collectors/proc.plugin/ipc.c
@@ -1,4 +1,6 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
#include <sys/sem.h>
#include <sys/msg.h>
@@ -166,7 +168,7 @@ int do_ipc(int update_every, usec_t dt) {
static int initialized = 0, read_limits_next = -1;
static struct ipc_limits limits;
static struct ipc_status status;
- static RRDSETVAR *arrays_max = NULL, *semaphores_max = NULL;
+ static RRDVAR *arrays_max = NULL, *semaphores_max = NULL;
static RRDSET *st_semaphores = NULL, *st_arrays = NULL;
static RRDDIM *rd_semaphores = NULL, *rd_arrays = NULL;
@@ -195,9 +197,9 @@ int do_ipc(int update_every, usec_t dt) {
, NULL
, "IPC Semaphores"
, "semaphores"
- , "linux"
+ , PLUGIN_PROC_NAME
, "ipc"
- , 1000
+ , NETDATA_CHART_PRIO_SYSTEM_IPC_SEMAPHORES
, localhost->rrd_update_every
, RRDSET_TYPE_AREA
);
@@ -213,9 +215,9 @@ int do_ipc(int update_every, usec_t dt) {
, NULL
, "IPC Semaphore Arrays"
, "arrays"
- , "linux"
+ , PLUGIN_PROC_NAME
, "ipc"
- , 1000
+ , NETDATA_CHART_PRIO_SYSTEM_IPC_SEM_ARRAYS
, localhost->rrd_update_every
, RRDSET_TYPE_AREA
);
@@ -223,8 +225,8 @@ int do_ipc(int update_every, usec_t dt) {
}
// variables
- semaphores_max = rrdsetvar_custom_chart_variable_create(st_semaphores, "ipc.semaphores.max");
- arrays_max = rrdsetvar_custom_chart_variable_create(st_arrays, "ipc.semaphores.arrays.max");
+ semaphores_max = rrdvar_custom_host_variable_create(localhost, "ipc_semaphores_max");
+ arrays_max = rrdvar_custom_host_variable_create(localhost, "ipc_semaphores_arrays_max");
}
if(unlikely(read_limits_next < 0)) {
@@ -232,8 +234,8 @@ int do_ipc(int update_every, usec_t dt) {
error("Unable to fetch semaphore limits.");
}
else {
- if(semaphores_max) rrdsetvar_custom_chart_variable_set(semaphores_max, limits.semmns);
- if(arrays_max) rrdsetvar_custom_chart_variable_set(arrays_max, limits.semmni);
+ if(semaphores_max) rrdvar_custom_host_variable_set(localhost, semaphores_max, limits.semmns);
+ if(arrays_max) rrdvar_custom_host_variable_set(localhost, arrays_max, limits.semmni);
st_arrays->red = limits.semmni;
st_semaphores->red = limits.semmns;
diff --git a/src/plugin_proc.c b/collectors/proc.plugin/plugin_proc.c
index e0afb0d6d..0c3244d61 100644
--- a/src/plugin_proc.c
+++ b/collectors/proc.plugin/plugin_proc.c
@@ -1,4 +1,6 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
static struct proc_module {
const char *name;
@@ -37,6 +39,7 @@ static struct proc_module {
{ .name = "/proc/net/netstat", .dim = "netstat", .func = do_proc_net_netstat }, // this has to be before /proc/net/snmp, because there is a shared metric
{ .name = "/proc/net/snmp", .dim = "snmp", .func = do_proc_net_snmp },
{ .name = "/proc/net/snmp6", .dim = "snmp6", .func = do_proc_net_snmp6 },
+ { .name = "/proc/net/sctp/snmp", .dim = "sctp", .func = do_proc_net_sctp_snmp },
{ .name = "/proc/net/softnet_stat", .dim = "softnet", .func = do_proc_net_softnet_stat },
{ .name = "/proc/net/ip_vs/stats", .dim = "ipvs", .func = do_proc_net_ip_vs_stats },
@@ -91,8 +94,12 @@ void *proc_main(void *ptr) {
usec_t step = localhost->rrd_update_every * USEC_PER_SEC;
heartbeat_t hb;
heartbeat_init(&hb);
+ size_t iterations = 0;
while(!netdata_exit) {
+ iterations++;
+ (void)iterations;
+
usec_t hb_dt = heartbeat_next(&hb, step);
usec_t duration = 0ULL;
@@ -106,10 +113,19 @@ void *proc_main(void *ptr) {
debug(D_PROCNETDEV_LOOP, "PROC calling %s.", pm->name);
+//#ifdef NETDATA_LOG_ALLOCATIONS
+// if(pm->func == do_proc_interrupts)
+// log_thread_memory_allocations = iterations;
+//#endif
pm->enabled = !pm->func(localhost->rrd_update_every, hb_dt);
- pm->duration = heartbeat_dt_usec(&hb) - duration;
+ pm->duration = heartbeat_monotonic_dt_to_now_usec(&hb) - duration;
duration += pm->duration;
+//#ifdef NETDATA_LOG_ALLOCATIONS
+// if(pm->func == do_proc_interrupts)
+// log_thread_memory_allocations = 0;
+//#endif
+
if(unlikely(netdata_exit)) break;
}
diff --git a/src/plugin_proc.h b/collectors/proc.plugin/plugin_proc.h
index a7f9b4e38..bfefe1ad4 100644
--- a/src/plugin_proc.h
+++ b/collectors/proc.plugin/plugin_proc.h
@@ -1,7 +1,28 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
#ifndef NETDATA_PLUGIN_PROC_H
#define NETDATA_PLUGIN_PROC_H 1
-void *proc_main(void *ptr);
+#include "../../daemon/common.h"
+
+#if (TARGET_OS == OS_LINUX)
+
+#define NETDATA_PLUGIN_HOOK_LINUX_PROC \
+ { \
+ .name = "PLUGIN[proc]", \
+ .config_section = CONFIG_SECTION_PLUGINS, \
+ .config_name = "proc", \
+ .enabled = 1, \
+ .thread = NULL, \
+ .init_routine = NULL, \
+ .start_routine = proc_main \
+ },
+
+
+#define PLUGIN_PROC_CONFIG_NAME "proc"
+#define PLUGIN_PROC_NAME PLUGIN_PROC_CONFIG_NAME ".plugin"
+
+extern void *proc_main(void *ptr);
extern int do_proc_net_dev(int update_every, usec_t dt);
extern int do_proc_diskstats(int update_every, usec_t dt);
@@ -29,7 +50,8 @@ extern int do_proc_spl_kstat_zfs_arcstats(int update_every, usec_t dt);
extern int do_sys_fs_btrfs(int update_every, usec_t dt);
extern int do_proc_net_sockstat(int update_every, usec_t dt);
extern int do_proc_net_sockstat6(int update_every, usec_t dt);
-
+extern int do_proc_net_sctp_snmp(int update_every, usec_t dt);
+extern int do_ipc(int update_every, usec_t dt);
extern int get_numa_node_count(void);
// metrics that need to be shared among data collectors
@@ -39,4 +61,14 @@ extern unsigned long long tcpext_TCPSynRetrans;
extern void netdev_rename_device_add(const char *host_device, const char *container_device, const char *container_name);
extern void netdev_rename_device_del(const char *host_device);
+#include "proc_self_mountinfo.h"
+#include "zfs_common.h"
+
+#else // (TARGET_OS == OS_LINUX)
+
+#define NETDATA_PLUGIN_HOOK_LINUX_PROC
+
+#endif // (TARGET_OS == OS_LINUX)
+
+
#endif /* NETDATA_PLUGIN_PROC_H */
diff --git a/src/proc_diskstats.c b/collectors/proc.plugin/proc_diskstats.c
index 8cde3334b..387b395a3 100644
--- a/src/proc_diskstats.c
+++ b/collectors/proc.plugin/proc_diskstats.c
@@ -1,13 +1,16 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
#define RRD_TYPE_DISK "disk"
+#define PLUGIN_PROC_MODULE_DISKSTATS_NAME "/proc/diskstats"
+#define CONFIG_SECTION_PLUGIN_PROC_DISKSTATS "plugin:" PLUGIN_PROC_CONFIG_NAME ":" PLUGIN_PROC_MODULE_DISKSTATS_NAME
#define DISK_TYPE_UNKNOWN 0
#define DISK_TYPE_PHYSICAL 1
#define DISK_TYPE_PARTITION 2
#define DISK_TYPE_VIRTUAL 3
-#define CONFIG_SECTION_DISKSTATS "plugin:proc:/proc/diskstats"
#define DEFAULT_EXCLUDED_DISKS "loop* ram*"
static struct disk {
@@ -48,6 +51,12 @@ static struct disk {
char *bcache_filename_stats_total_cache_bypass_hits;
char *bcache_filename_stats_total_cache_bypass_misses;
char *bcache_filename_stats_total_cache_readaheads;
+ char *bcache_filename_cache_read_races;
+ char *bcache_filename_cache_io_errors;
+ char *bcache_filename_priority_stats;
+
+ usec_t bcache_priority_stats_update_every_usec;
+ usec_t bcache_priority_stats_elapsed_usec;
RRDSET *st_io;
RRDDIM *rd_io_reads;
@@ -111,6 +120,17 @@ static struct disk {
RRDDIM *rd_bcache_readaheads;
RRDDIM *rd_bcache_rate_writeback;
+ RRDSET *st_bcache_cache_allocations;
+ RRDDIM *rd_bcache_cache_allocations_unused;
+ RRDDIM *rd_bcache_cache_allocations_clean;
+ RRDDIM *rd_bcache_cache_allocations_dirty;
+ RRDDIM *rd_bcache_cache_allocations_metadata;
+ RRDDIM *rd_bcache_cache_allocations_unknown;
+
+ RRDSET *st_bcache_cache_read_races;
+ RRDDIM *rd_bcache_cache_read_races;
+ RRDDIM *rd_bcache_cache_io_errors;
+
struct disk *next;
} *disk_root = NULL;
@@ -125,7 +145,9 @@ static char *path_to_sys_devices_virtual_block_device = NULL;
static char *path_to_device_mapper = NULL;
static char *path_to_device_label = NULL;
static char *path_to_device_id = NULL;
+static char *path_to_veritas_volume_groups = NULL;
static int name_disks_by_id = CONFIG_BOOLEAN_NO;
+static int global_bcache_priority_stats_update_every = 0; // disabled by default
static int global_enable_new_disks_detected_at_runtime = CONFIG_BOOLEAN_YES,
global_enable_performance_for_physical_disks = CONFIG_BOOLEAN_AUTO,
@@ -170,6 +192,98 @@ static unsigned long long int bcache_read_number_with_units(const char *filename
return 0;
}
+void bcache_read_priority_stats(struct disk *d, const char *family, int update_every, usec_t dt) {
+ static procfile *ff = NULL;
+ static char *separators = " \t:%[]";
+
+ static ARL_BASE *arl_base = NULL;
+
+ static unsigned long long unused;
+ static unsigned long long clean;
+ static unsigned long long dirty;
+ static unsigned long long metadata;
+ static unsigned long long unknown;
+
+ // check if it is time to update this metric
+ d->bcache_priority_stats_elapsed_usec += dt;
+ if(likely(d->bcache_priority_stats_elapsed_usec < d->bcache_priority_stats_update_every_usec)) return;
+ d->bcache_priority_stats_elapsed_usec = 0;
+
+ // initialize ARL
+ if(unlikely(!arl_base)) {
+ arl_base = arl_create("bcache/priority_stats", NULL, 60);
+ arl_expect(arl_base, "Unused", &unused);
+ arl_expect(arl_base, "Clean", &clean);
+ arl_expect(arl_base, "Dirty", &dirty);
+ arl_expect(arl_base, "Metadata", &metadata);
+ }
+
+ ff = procfile_reopen(ff, d->bcache_filename_priority_stats, separators, PROCFILE_FLAG_DEFAULT);
+ if(likely(ff)) ff = procfile_readall(ff);
+ if(unlikely(!ff)) {
+ separators = " \t:%[]";
+ return;
+ }
+
+ // do not reset the separators on every iteration
+ separators = NULL;
+
+ arl_begin(arl_base);
+ unused = clean = dirty = metadata = unknown = 0;
+
+ size_t lines = procfile_lines(ff), l;
+
+ for(l = 0; l < lines ;l++) {
+ size_t words = procfile_linewords(ff, l);
+ if(unlikely(words < 2)) {
+ if(unlikely(words)) error("Cannot read '%s' line %zu. Expected 2 params, read %zu.", d->bcache_filename_priority_stats, l, words);
+ continue;
+ }
+
+ if(unlikely(arl_check(arl_base,
+ procfile_lineword(ff, l, 0),
+ procfile_lineword(ff, l, 1)))) break;
+ }
+
+ unknown = 100 - unused - clean - dirty - metadata;
+
+ // create / update the cache allocations chart
+ {
+ if(unlikely(!d->st_bcache_cache_allocations)) {
+ d->st_bcache_cache_allocations = rrdset_create_localhost(
+ "disk_bcache_cache_alloc"
+ , d->device
+ , d->disk
+ , family
+ , "disk.bcache_cache_alloc"
+ , "BCache Cache Allocations"
+ , "percentage"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_BCACHE_CACHE_ALLOC
+ , update_every
+ , RRDSET_TYPE_STACKED
+ );
+
+ d->rd_bcache_cache_allocations_unused = rrddim_add(d->st_bcache_cache_allocations, "unused", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
+ d->rd_bcache_cache_allocations_dirty = rrddim_add(d->st_bcache_cache_allocations, "dirty", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
+ d->rd_bcache_cache_allocations_clean = rrddim_add(d->st_bcache_cache_allocations, "clean", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
+ d->rd_bcache_cache_allocations_metadata = rrddim_add(d->st_bcache_cache_allocations, "metadata", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
+ d->rd_bcache_cache_allocations_unknown = rrddim_add(d->st_bcache_cache_allocations, "undefined", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
+
+ d->bcache_priority_stats_update_every_usec = update_every * USEC_PER_SEC;
+ }
+ else rrdset_next(d->st_bcache_cache_allocations);
+
+ rrddim_set_by_pointer(d->st_bcache_cache_allocations, d->rd_bcache_cache_allocations_unused, unused);
+ rrddim_set_by_pointer(d->st_bcache_cache_allocations, d->rd_bcache_cache_allocations_dirty, dirty);
+ rrddim_set_by_pointer(d->st_bcache_cache_allocations, d->rd_bcache_cache_allocations_clean, clean);
+ rrddim_set_by_pointer(d->st_bcache_cache_allocations, d->rd_bcache_cache_allocations_metadata, metadata);
+ rrddim_set_by_pointer(d->st_bcache_cache_allocations, d->rd_bcache_cache_allocations_unknown, unknown);
+ rrdset_done(d->st_bcache_cache_allocations);
+ }
+}
+
static inline int is_major_enabled(int major) {
static int8_t *major_configs = NULL;
static size_t major_size = 0;
@@ -191,67 +305,101 @@ static inline int is_major_enabled(int major) {
if(major_configs[major] == -1) {
char buffer[CONFIG_MAX_NAME + 1];
snprintfz(buffer, CONFIG_MAX_NAME, "performance metrics for disks with major %d", major);
- major_configs[major] = (char)config_get_boolean(CONFIG_SECTION_DISKSTATS, buffer, 1);
+ major_configs[major] = (char)config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, buffer, 1);
}
return (int)major_configs[major];
}
-static inline int get_disk_name_from_path(const char *path, char *result, size_t result_size, unsigned long major, unsigned long minor, char *disk) {
- char filename[FILENAME_MAX + 1];
- int found = 0;
+static inline int get_disk_name_from_path(const char *path, char *result, size_t result_size, unsigned long major, unsigned long minor, char *disk, char *prefix, int depth) {
+ //info("DEVICE-MAPPER ('%s', %lu:%lu): examining directory '%s' (allowed depth %d).", disk, major, minor, path, depth);
- result_size--;
+ int found = 0;
DIR *dir = opendir(path);
if (!dir) {
- error("DEVICE-MAPPER ('%s', %lu:%lu): Cannot open directory '%s'. Disabling device-mapper support.", disk, major, minor, path);
- goto cleanup;
+ error("DEVICE-MAPPER ('%s', %lu:%lu): Cannot open directory '%s'.", disk, major, minor, path);
+ goto failed;
}
struct dirent *de = NULL;
while ((de = readdir(dir))) {
- if(de->d_type != DT_LNK) continue;
+ if(de->d_type == DT_DIR) {
+ if((de->d_name[0] == '.' && de->d_name[1] == '\0') || (de->d_name[0] == '.' && de->d_name[1] == '.' && de->d_name[2] == '\0'))
+ continue;
- snprintfz(filename, FILENAME_MAX, "%s/%s", path, de->d_name);
- ssize_t len = readlink(filename, result, result_size);
- if(len <= 0) {
- error("DEVICE-MAPPER ('%s', %lu:%lu): Cannot read link '%s'.", disk, major, minor, filename);
- continue;
- }
+ if(depth <= 0) {
+ error("DEVICE-MAPPER ('%s', %lu:%lu): Depth limit reached for path '%s/%s'. Ignoring path.", disk, major, minor, path, de->d_name);
+ break;
+ }
+ else {
+ char *path_nested = NULL;
+ char *prefix_nested = NULL;
- result[len] = '\0';
- if(result[0] != '/')
- snprintfz(filename, FILENAME_MAX, "%s/%s", path, result);
- else
- strncpyz(filename, result, FILENAME_MAX);
+ {
+ char buffer[FILENAME_MAX + 1];
+ snprintfz(buffer, FILENAME_MAX, "%s/%s", path, de->d_name);
+ path_nested = strdupz(buffer);
- struct stat sb;
- if(stat(filename, &sb) == -1) {
- error("DEVICE-MAPPER ('%s', %lu:%lu): Cannot stat() file '%s'.", disk, major, minor, filename);
- continue;
- }
+ snprintfz(buffer, FILENAME_MAX, "%s%s%s", (prefix)?prefix:"", (prefix)?"_":"", de->d_name);
+ prefix_nested = strdupz(buffer);
+ }
- if((sb.st_mode & S_IFMT) != S_IFBLK) {
- // info("DEVICE-MAPPER ('%s', %lu:%lu): file '%s' is not a block device.", disk, major, minor, filename);
- continue;
- }
+ found = get_disk_name_from_path(path_nested, result, result_size, major, minor, disk, prefix_nested, depth - 1);
+ freez(path_nested);
+ freez(prefix_nested);
- if(major(sb.st_rdev) != major || minor(sb.st_rdev) != minor) {
- // info("DEVICE-MAPPER ('%s', %lu:%lu): filename '%s' does not match %lu:%lu.", disk, major, minor, filename, (unsigned long)major(sb.st_rdev), (unsigned long)minor(sb.st_rdev));
- continue;
+ if(found) break;
+ }
}
+ else if(de->d_type == DT_LNK || de->d_type == DT_BLK) {
+ char filename[FILENAME_MAX + 1];
+
+ if(de->d_type == DT_LNK) {
+ snprintfz(filename, FILENAME_MAX, "%s/%s", path, de->d_name);
+ ssize_t len = readlink(filename, result, result_size - 1);
+ if(len <= 0) {
+ error("DEVICE-MAPPER ('%s', %lu:%lu): Cannot read link '%s'.", disk, major, minor, filename);
+ continue;
+ }
+
+ result[len] = '\0';
+ if(result[0] != '/')
+ snprintfz(filename, FILENAME_MAX, "%s/%s", path, result);
+ else
+ strncpyz(filename, result, FILENAME_MAX);
+ }
+ else {
+ snprintfz(filename, FILENAME_MAX, "%s/%s", path, de->d_name);
+ }
+
+ struct stat sb;
+ if(stat(filename, &sb) == -1) {
+ error("DEVICE-MAPPER ('%s', %lu:%lu): Cannot stat() file '%s'.", disk, major, minor, filename);
+ continue;
+ }
+
+ if((sb.st_mode & S_IFMT) != S_IFBLK) {
+ //info("DEVICE-MAPPER ('%s', %lu:%lu): file '%s' is not a block device.", disk, major, minor, filename);
+ continue;
+ }
+
+ if(major(sb.st_rdev) != major || minor(sb.st_rdev) != minor) {
+ //info("DEVICE-MAPPER ('%s', %lu:%lu): filename '%s' does not match %lu:%lu.", disk, major, minor, filename, (unsigned long)major(sb.st_rdev), (unsigned long)minor(sb.st_rdev));
+ continue;
+ }
- // info("DEVICE-MAPPER ('%s', %lu:%lu): filename '%s' matches.", disk, major, minor, filename);
+ //info("DEVICE-MAPPER ('%s', %lu:%lu): filename '%s' matches.", disk, major, minor, filename);
- strncpy(result, de->d_name, result_size);
- found = 1;
- break;
+ snprintfz(result, result_size - 1, "%s%s%s", (prefix)?prefix:"", (prefix)?"_":"", de->d_name);
+ found = 1;
+ break;
+ }
}
closedir(dir);
-cleanup:
+failed:
if(!found)
result[0] = '\0';
@@ -262,10 +410,11 @@ cleanup:
static inline char *get_disk_name(unsigned long major, unsigned long minor, char *disk) {
char result[FILENAME_MAX + 1] = "";
- if(!path_to_device_mapper || !*path_to_device_mapper || !get_disk_name_from_path(path_to_device_mapper, result, FILENAME_MAX + 1, major, minor, disk))
- if(!path_to_device_label || !*path_to_device_label || !get_disk_name_from_path(path_to_device_label, result, FILENAME_MAX + 1, major, minor, disk))
- if(name_disks_by_id != CONFIG_BOOLEAN_YES || !path_to_device_id || !*path_to_device_id || !get_disk_name_from_path(path_to_device_id, result, FILENAME_MAX + 1, major, minor, disk))
- strncpy(result, disk, FILENAME_MAX);
+ if(!path_to_device_mapper || !*path_to_device_mapper || !get_disk_name_from_path(path_to_device_mapper, result, FILENAME_MAX + 1, major, minor, disk, NULL, 0))
+ if(!path_to_device_label || !*path_to_device_label || !get_disk_name_from_path(path_to_device_label, result, FILENAME_MAX + 1, major, minor, disk, NULL, 0))
+ if(!path_to_veritas_volume_groups || !*path_to_veritas_volume_groups || !get_disk_name_from_path(path_to_veritas_volume_groups, result, FILENAME_MAX + 1, major, minor, disk, "vx", 2))
+ if(name_disks_by_id != CONFIG_BOOLEAN_YES || !path_to_device_id || !*path_to_device_id || !get_disk_name_from_path(path_to_device_id, result, FILENAME_MAX + 1, major, minor, disk, NULL, 0))
+ strncpy(result, disk, FILENAME_MAX);
if(!result[0])
strncpy(result, disk, FILENAME_MAX);
@@ -281,7 +430,7 @@ static void get_disk_config(struct disk *d) {
def_enable = CONFIG_BOOLEAN_NO;
char var_name[4096 + 1];
- snprintfz(var_name, 4096, "plugin:proc:/proc/diskstats:%s", d->disk);
+ snprintfz(var_name, 4096, CONFIG_SECTION_PLUGIN_PROC_DISKSTATS ":%s", d->disk);
def_enable = config_get_boolean_ondemand(var_name, "enable", def_enable);
if(unlikely(def_enable == CONFIG_BOOLEAN_NO)) {
@@ -532,6 +681,24 @@ static struct disk *get_disk(unsigned long major, unsigned long minor, char *dis
else
error("bcache file '%s' cannot be read.", buffer2);
+ snprintfz(buffer2, FILENAME_MAX, "%s/cache/cache0/priority_stats", buffer); // only one cache is supported by bcache
+ if(access(buffer2, R_OK) == 0)
+ d->bcache_filename_priority_stats = strdupz(buffer2);
+ else
+ error("bcache file '%s' cannot be read.", buffer2);
+
+ snprintfz(buffer2, FILENAME_MAX, "%s/cache/internal/cache_read_races", buffer);
+ if(access(buffer2, R_OK) == 0)
+ d->bcache_filename_cache_read_races = strdupz(buffer2);
+ else
+ error("bcache file '%s' cannot be read.", buffer2);
+
+ snprintfz(buffer2, FILENAME_MAX, "%s/cache/cache0/io_errors", buffer);
+ if(access(buffer2, R_OK) == 0)
+ d->bcache_filename_cache_io_errors = strdupz(buffer2);
+ else
+ error("bcache file '%s' cannot be read.", buffer2);
+
snprintfz(buffer2, FILENAME_MAX, "%s/dirty_data", buffer);
if(access(buffer2, R_OK) == 0)
d->bcache_filename_dirty_data = strdupz(buffer2);
@@ -615,55 +782,59 @@ int do_proc_diskstats(int update_every, usec_t dt) {
if(unlikely(!globals_initialized)) {
globals_initialized = 1;
- global_enable_new_disks_detected_at_runtime = config_get_boolean(CONFIG_SECTION_DISKSTATS, "enable new disks detected at runtime", global_enable_new_disks_detected_at_runtime);
- global_enable_performance_for_physical_disks = config_get_boolean_ondemand(CONFIG_SECTION_DISKSTATS, "performance metrics for physical disks", global_enable_performance_for_physical_disks);
- global_enable_performance_for_virtual_disks = config_get_boolean_ondemand(CONFIG_SECTION_DISKSTATS, "performance metrics for virtual disks", global_enable_performance_for_virtual_disks);
- global_enable_performance_for_partitions = config_get_boolean_ondemand(CONFIG_SECTION_DISKSTATS, "performance metrics for partitions", global_enable_performance_for_partitions);
-
- global_do_io = config_get_boolean_ondemand(CONFIG_SECTION_DISKSTATS, "bandwidth for all disks", global_do_io);
- global_do_ops = config_get_boolean_ondemand(CONFIG_SECTION_DISKSTATS, "operations for all disks", global_do_ops);
- global_do_mops = config_get_boolean_ondemand(CONFIG_SECTION_DISKSTATS, "merged operations for all disks", global_do_mops);
- global_do_iotime = config_get_boolean_ondemand(CONFIG_SECTION_DISKSTATS, "i/o time for all disks", global_do_iotime);
- global_do_qops = config_get_boolean_ondemand(CONFIG_SECTION_DISKSTATS, "queued operations for all disks", global_do_qops);
- global_do_util = config_get_boolean_ondemand(CONFIG_SECTION_DISKSTATS, "utilization percentage for all disks", global_do_util);
- global_do_backlog = config_get_boolean_ondemand(CONFIG_SECTION_DISKSTATS, "backlog for all disks", global_do_backlog);
- global_do_bcache = config_get_boolean_ondemand(CONFIG_SECTION_DISKSTATS, "bcache for all disks", global_do_bcache);
-
- global_cleanup_removed_disks = config_get_boolean(CONFIG_SECTION_DISKSTATS, "remove charts of removed disks" , global_cleanup_removed_disks);
+ global_enable_new_disks_detected_at_runtime = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "enable new disks detected at runtime", global_enable_new_disks_detected_at_runtime);
+ global_enable_performance_for_physical_disks = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "performance metrics for physical disks", global_enable_performance_for_physical_disks);
+ global_enable_performance_for_virtual_disks = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "performance metrics for virtual disks", global_enable_performance_for_virtual_disks);
+ global_enable_performance_for_partitions = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "performance metrics for partitions", global_enable_performance_for_partitions);
+
+ global_do_io = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "bandwidth for all disks", global_do_io);
+ global_do_ops = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "operations for all disks", global_do_ops);
+ global_do_mops = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "merged operations for all disks", global_do_mops);
+ global_do_iotime = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "i/o time for all disks", global_do_iotime);
+ global_do_qops = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "queued operations for all disks", global_do_qops);
+ global_do_util = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "utilization percentage for all disks", global_do_util);
+ global_do_backlog = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "backlog for all disks", global_do_backlog);
+ global_do_bcache = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "bcache for all disks", global_do_bcache);
+ global_bcache_priority_stats_update_every = (int)config_get_number(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "bcache priority stats update every", global_bcache_priority_stats_update_every);
+
+ global_cleanup_removed_disks = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "remove charts of removed disks" , global_cleanup_removed_disks);
char buffer[FILENAME_MAX + 1];
snprintfz(buffer, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/sys/block/%s");
- path_to_sys_block_device = config_get(CONFIG_SECTION_DISKSTATS, "path to get block device", buffer);
+ path_to_sys_block_device = config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "path to get block device", buffer);
snprintfz(buffer, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/sys/block/%s/bcache");
- path_to_sys_block_device_bcache = config_get(CONFIG_SECTION_DISKSTATS, "path to get block device bcache", buffer);
+ path_to_sys_block_device_bcache = config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "path to get block device bcache", buffer);
snprintfz(buffer, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/sys/devices/virtual/block/%s");
- path_to_sys_devices_virtual_block_device = config_get(CONFIG_SECTION_DISKSTATS, "path to get virtual block device", buffer);
+ path_to_sys_devices_virtual_block_device = config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "path to get virtual block device", buffer);
snprintfz(buffer, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/sys/dev/block/%lu:%lu/%s");
- path_to_sys_dev_block_major_minor_string = config_get(CONFIG_SECTION_DISKSTATS, "path to get block device infos", buffer);
+ path_to_sys_dev_block_major_minor_string = config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "path to get block device infos", buffer);
//snprintfz(buffer, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/sys/block/%s/queue/hw_sector_size");
- //path_to_get_hw_sector_size = config_get(CONFIG_SECTION_DISKSTATS, "path to get h/w sector size", buffer);
+ //path_to_get_hw_sector_size = config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "path to get h/w sector size", buffer);
//snprintfz(buffer, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/sys/dev/block/%lu:%lu/subsystem/%s/../queue/hw_sector_size");
- //path_to_get_hw_sector_size_partitions = config_get(CONFIG_SECTION_DISKSTATS, "path to get h/w sector size for partitions", buffer);
+ //path_to_get_hw_sector_size_partitions = config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "path to get h/w sector size for partitions", buffer);
snprintfz(buffer, FILENAME_MAX, "%s/dev/mapper", netdata_configured_host_prefix);
- path_to_device_mapper = config_get(CONFIG_SECTION_DISKSTATS, "path to device mapper", buffer);
+ path_to_device_mapper = config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "path to device mapper", buffer);
snprintfz(buffer, FILENAME_MAX, "%s/dev/disk/by-label", netdata_configured_host_prefix);
- path_to_device_label = config_get(CONFIG_SECTION_DISKSTATS, "path to /dev/disk/by-label", buffer);
+ path_to_device_label = config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "path to /dev/disk/by-label", buffer);
snprintfz(buffer, FILENAME_MAX, "%s/dev/disk/by-id", netdata_configured_host_prefix);
- path_to_device_id = config_get(CONFIG_SECTION_DISKSTATS, "path to /dev/disk/by-id", buffer);
+ path_to_device_id = config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "path to /dev/disk/by-id", buffer);
- name_disks_by_id = config_get_boolean(CONFIG_SECTION_DISKSTATS, "name disks by id", name_disks_by_id);
+ snprintfz(buffer, FILENAME_MAX, "%s/dev/vx/dsk", netdata_configured_host_prefix);
+ path_to_veritas_volume_groups = config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "path to /dev/vx/dsk", buffer);
+
+ name_disks_by_id = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "name disks by id", name_disks_by_id);
excluded_disks = simple_pattern_create(
- config_get(CONFIG_SECTION_DISKSTATS, "exclude disks", DEFAULT_EXCLUDED_DISKS)
+ config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "exclude disks", DEFAULT_EXCLUDED_DISKS)
, NULL
, SIMPLE_PATTERN_EXACT
);
@@ -674,7 +845,7 @@ int do_proc_diskstats(int update_every, usec_t dt) {
if(unlikely(!ff)) {
char filename[FILENAME_MAX + 1];
snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/diskstats");
- ff = procfile_open(config_get(CONFIG_SECTION_DISKSTATS, "filename to monitor", filename), " \t", PROCFILE_FLAG_DEFAULT);
+ ff = procfile_open(config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "filename to monitor", filename), " \t", PROCFILE_FLAG_DEFAULT);
}
if(unlikely(!ff)) return 0;
@@ -790,9 +961,9 @@ int do_proc_diskstats(int update_every, usec_t dt) {
, "disk.io"
, "Disk I/O Bandwidth"
, "kilobytes/s"
- , "proc"
- , "diskstats"
- , 2000
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_DISK_IO
, update_every
, RRDSET_TYPE_AREA
);
@@ -821,9 +992,9 @@ int do_proc_diskstats(int update_every, usec_t dt) {
, "disk.ops"
, "Disk Completed I/O Operations"
, "operations/s"
- , "proc"
- , "diskstats"
- , 2001
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_DISK_OPS
, update_every
, RRDSET_TYPE_LINE
);
@@ -854,9 +1025,9 @@ int do_proc_diskstats(int update_every, usec_t dt) {
, "disk.qops"
, "Disk Current I/O Operations"
, "operations"
- , "proc"
- , "diskstats"
- , 2002
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_DISK_QOPS
, update_every
, RRDSET_TYPE_LINE
);
@@ -885,9 +1056,9 @@ int do_proc_diskstats(int update_every, usec_t dt) {
, "disk.backlog"
, "Disk Backlog"
, "backlog (ms)"
- , "proc"
- , "diskstats"
- , 2003
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_DISK_BACKLOG
, update_every
, RRDSET_TYPE_AREA
);
@@ -916,9 +1087,9 @@ int do_proc_diskstats(int update_every, usec_t dt) {
, "disk.util"
, "Disk Utilization Time"
, "% of time working"
- , "proc"
- , "diskstats"
- , 2004
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_DISK_UTIL
, update_every
, RRDSET_TYPE_AREA
);
@@ -947,9 +1118,9 @@ int do_proc_diskstats(int update_every, usec_t dt) {
, "disk.mops"
, "Disk Merged Operations"
, "merged operations/s"
- , "proc"
- , "diskstats"
- , 2021
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_DISK_MOPS
, update_every
, RRDSET_TYPE_LINE
);
@@ -980,9 +1151,9 @@ int do_proc_diskstats(int update_every, usec_t dt) {
, "disk.iotime"
, "Disk Total I/O Time"
, "milliseconds/s"
- , "proc"
- , "diskstats"
- , 2022
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_DISK_IOTIME
, update_every
, RRDSET_TYPE_LINE
);
@@ -1016,9 +1187,9 @@ int do_proc_diskstats(int update_every, usec_t dt) {
, "disk.await"
, "Average Completed I/O Operation Time"
, "ms per operation"
- , "proc"
- , "diskstats"
- , 2005
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_DISK_AWAIT
, update_every
, RRDSET_TYPE_LINE
);
@@ -1047,9 +1218,9 @@ int do_proc_diskstats(int update_every, usec_t dt) {
, "disk.avgsz"
, "Average Completed I/O Operation Bandwidth"
, "kilobytes per operation"
- , "proc"
- , "diskstats"
- , 2006
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_DISK_AVGSZ
, update_every
, RRDSET_TYPE_AREA
);
@@ -1078,9 +1249,9 @@ int do_proc_diskstats(int update_every, usec_t dt) {
, "disk.svctm"
, "Average Service Time"
, "ms per operation"
- , "proc"
- , "diskstats"
- , 2007
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_DISK_SVCTM
, update_every
, RRDSET_TYPE_LINE
);
@@ -1112,6 +1283,8 @@ int do_proc_diskstats(int update_every, usec_t dt) {
stats_total_cache_hit_ratio = 0,
cache_available_percent = 0,
cache_readaheads = 0,
+ cache_read_races = 0,
+ cache_io_errors = 0,
cache_congested = 0,
dirty_data = 0,
writeback_rate = 0;
@@ -1160,11 +1333,18 @@ int do_proc_diskstats(int update_every, usec_t dt) {
if(d->bcache_filename_stats_total_cache_readaheads)
cache_readaheads = bcache_read_number_with_units(d->bcache_filename_stats_total_cache_readaheads);
+ if(d->bcache_filename_cache_read_races)
+ read_single_number_file(d->bcache_filename_cache_read_races, &cache_read_races);
+
+ if(d->bcache_filename_cache_io_errors)
+ read_single_number_file(d->bcache_filename_cache_io_errors, &cache_io_errors);
+
+ if(d->bcache_filename_priority_stats && global_bcache_priority_stats_update_every >= 1)
+ bcache_read_priority_stats(d, family, global_bcache_priority_stats_update_every, dt);
// update the charts
{
-
if(unlikely(!d->st_bcache_hit_ratio)) {
d->st_bcache_hit_ratio = rrdset_create_localhost(
"disk_bcache_hit_ratio"
@@ -1174,9 +1354,9 @@ int do_proc_diskstats(int update_every, usec_t dt) {
, "disk.bcache_hit_ratio"
, "BCache Cache Hit Ratio"
, "percentage"
- , "proc"
- , "diskstats"
- , 2120
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_BCACHE_HIT_RATIO
, update_every
, RRDSET_TYPE_LINE
);
@@ -1206,9 +1386,9 @@ int do_proc_diskstats(int update_every, usec_t dt) {
, "disk.bcache_rates"
, "BCache Rates"
, "KB/s"
- , "proc"
- , "diskstats"
- , 2121
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_BCACHE_RATES
, update_every
, RRDSET_TYPE_AREA
);
@@ -1233,9 +1413,9 @@ int do_proc_diskstats(int update_every, usec_t dt) {
, "disk.bcache_size"
, "BCache Cache Sizes"
, "MB"
- , "proc"
- , "diskstats"
- , 2122
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_BCACHE_SIZE
, update_every
, RRDSET_TYPE_AREA
);
@@ -1258,9 +1438,9 @@ int do_proc_diskstats(int update_every, usec_t dt) {
, "disk.bcache_usage"
, "BCache Cache Usage"
, "percent"
- , "proc"
- , "diskstats"
- , 2123
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_BCACHE_USAGE
, update_every
, RRDSET_TYPE_AREA
);
@@ -1273,6 +1453,34 @@ int do_proc_diskstats(int update_every, usec_t dt) {
rrdset_done(d->st_bcache_usage);
}
+ {
+
+ if(unlikely(!d->st_bcache_cache_read_races)) {
+ d->st_bcache_cache_read_races = rrdset_create_localhost(
+ "disk_bcache_cache_read_races"
+ , d->device
+ , d->disk
+ , family
+ , "disk.bcache_cache_read_races"
+ , "BCache Cache Read Races"
+ , "operations/s"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_BCACHE_CACHE_READ_RACES
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+
+ d->rd_bcache_cache_read_races = rrddim_add(d->st_bcache_cache_read_races, "races", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ d->rd_bcache_cache_io_errors = rrddim_add(d->st_bcache_cache_read_races, "errors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ }
+ else rrdset_next(d->st_bcache_cache_read_races);
+
+ rrddim_set_by_pointer(d->st_bcache_cache_read_races, d->rd_bcache_cache_read_races, cache_read_races);
+ rrddim_set_by_pointer(d->st_bcache_cache_read_races, d->rd_bcache_cache_io_errors, cache_io_errors);
+ rrdset_done(d->st_bcache_cache_read_races);
+ }
+
if(d->do_bcache == CONFIG_BOOLEAN_YES || (d->do_bcache == CONFIG_BOOLEAN_AUTO && (stats_total_cache_hits != 0 || stats_total_cache_misses != 0 || stats_total_cache_miss_collisions != 0))) {
if(unlikely(!d->st_bcache)) {
@@ -1284,9 +1492,9 @@ int do_proc_diskstats(int update_every, usec_t dt) {
, "disk.bcache"
, "BCache Cache I/O Operations"
, "operations/s"
- , "proc"
- , "diskstats"
- , 2124
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_BCACHE_OPS
, update_every
, RRDSET_TYPE_LINE
);
@@ -1318,9 +1526,9 @@ int do_proc_diskstats(int update_every, usec_t dt) {
, "disk.bcache_bypass"
, "BCache Cache Bypass I/O Operations"
, "operations/s"
- , "proc"
- , "diskstats"
- , 2125
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_BCACHE_BYPASS
, update_every
, RRDSET_TYPE_LINE
);
@@ -1356,9 +1564,9 @@ int do_proc_diskstats(int update_every, usec_t dt) {
, NULL
, "Disk I/O"
, "kilobytes/s"
- , "proc"
- , "diskstats"
- , 150
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
+ , NETDATA_CHART_PRIO_SYSTEM_IO
, update_every
, RRDSET_TYPE_AREA
);
@@ -1421,6 +1629,9 @@ int do_proc_diskstats(int update_every, usec_t dt) {
freez(t->bcache_filename_stats_total_cache_bypass_hits);
freez(t->bcache_filename_stats_total_cache_bypass_misses);
freez(t->bcache_filename_stats_total_cache_readaheads);
+ freez(t->bcache_filename_cache_read_races);
+ freez(t->bcache_filename_cache_io_errors);
+ freez(t->bcache_filename_priority_stats);
freez(t->disk);
freez(t->device);
diff --git a/src/proc_interrupts.c b/collectors/proc.plugin/proc_interrupts.c
index 867f39eb2..73b117179 100644
--- a/src/proc_interrupts.c
+++ b/collectors/proc.plugin/proc_interrupts.c
@@ -1,4 +1,9 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
+
+#define PLUGIN_PROC_MODULE_INTERRUPTS_NAME "/proc/interrupts"
+#define CONFIG_SECTION_PLUGIN_PROC_INTERRUPTS "plugin:" PLUGIN_PROC_CONFIG_NAME ":" PLUGIN_PROC_MODULE_INTERRUPTS_NAME
#define MAX_INTERRUPT_NAME 50
@@ -51,16 +56,16 @@ static inline struct interrupt *get_interrupts_array(size_t lines, int cpus) {
int do_proc_interrupts(int update_every, usec_t dt) {
(void)dt;
static procfile *ff = NULL;
- static int cpus = -1, do_per_core = -1;
+ static int cpus = -1, do_per_core = CONFIG_BOOLEAN_INVALID;
struct interrupt *irrs = NULL;
- if(unlikely(do_per_core == -1))
- do_per_core = config_get_boolean("plugin:proc:/proc/interrupts", "interrupts per core", 1);
+ if(unlikely(do_per_core == CONFIG_BOOLEAN_INVALID))
+ do_per_core = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_INTERRUPTS, "interrupts per core", CONFIG_BOOLEAN_AUTO);
if(unlikely(!ff)) {
char filename[FILENAME_MAX + 1];
snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/interrupts");
- ff = procfile_open(config_get("plugin:proc:/proc/interrupts", "filename to monitor", filename), " \t", PROCFILE_FLAG_DEFAULT);
+ ff = procfile_open(config_get(CONFIG_SECTION_PLUGIN_PROC_INTERRUPTS, "filename to monitor", filename), " \t", PROCFILE_FLAG_DEFAULT);
}
if(unlikely(!ff))
return 1;
@@ -109,8 +114,8 @@ int do_proc_interrupts(int update_every, usec_t dt) {
if(unlikely(!irr->id || !irr->id[0])) continue;
size_t idlen = strlen(irr->id);
- if(unlikely(idlen && irr->id[idlen - 1] == ':'))
- irr->id[idlen - 1] = '\0';
+ if(irr->id[idlen - 1] == ':')
+ irr->id[--idlen] = '\0';
int c;
for(c = 0; c < cpus ;c++) {
@@ -125,7 +130,6 @@ int do_proc_interrupts(int update_every, usec_t dt) {
if(unlikely(isdigit(irr->id[0]) && (uint32_t)(cpus + 2) < words)) {
strncpyz(irr->name, procfile_lineword(ff, l, words - 1), MAX_INTERRUPT_NAME);
size_t nlen = strlen(irr->name);
- idlen = strlen(irr->id);
if(likely(nlen + 1 + idlen <= MAX_INTERRUPT_NAME)) {
irr->name[nlen] = '_';
strncpyz(&irr->name[nlen + 1], irr->id, MAX_INTERRUPT_NAME - nlen - 1);
@@ -154,9 +158,9 @@ int do_proc_interrupts(int update_every, usec_t dt) {
, NULL
, "System interrupts"
, "interrupts/s"
- , "proc"
- , "interrupts"
- , 1000
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_INTERRUPTS_NAME
+ , NETDATA_CHART_PRIO_SYSTEM_INTERRUPTS
, update_every
, RRDSET_TYPE_STACKED
);
@@ -165,34 +169,30 @@ int do_proc_interrupts(int update_every, usec_t dt) {
for(l = 0; l < lines ;l++) {
struct interrupt *irr = irrindex(irrs, l, cpus);
- if(unlikely(!irr->used)) continue;
-
- // some interrupt may have changed without changing the total number of lines
- // if the same number of interrupts have been added and removed between two
- // calls of this function.
- if(unlikely(!irr->rd || strncmp(irr->rd->name, irr->name, MAX_INTERRUPT_NAME) != 0)) {
- irr->rd = rrddim_find(st_system_interrupts, irr->id);
-
- if(unlikely(!irr->rd))
+ if(irr->used && irr->total) {
+ // some interrupt may have changed without changing the total number of lines
+ // if the same number of interrupts have been added and removed between two
+ // calls of this function.
+ if(unlikely(!irr->rd || strncmp(irr->rd->name, irr->name, MAX_INTERRUPT_NAME) != 0)) {
irr->rd = rrddim_add(st_system_interrupts, irr->id, irr->name, 1, 1, RRD_ALGORITHM_INCREMENTAL);
- else
rrddim_set_name(st_system_interrupts, irr->rd, irr->name);
- // also reset per cpu RRDDIMs to avoid repeating strncmp() in the per core loop
- if(likely(do_per_core)) {
- int c;
- for (c = 0; c < cpus ;c++) irr->cpu[c].rd = NULL;
+ // also reset per cpu RRDDIMs to avoid repeating strncmp() in the per core loop
+ if(likely(do_per_core != CONFIG_BOOLEAN_NO)) {
+ int c;
+ for(c = 0; c < cpus; c++) irr->cpu[c].rd = NULL;
+ }
}
- }
- rrddim_set_by_pointer(st_system_interrupts, irr->rd, irr->total);
+ rrddim_set_by_pointer(st_system_interrupts, irr->rd, irr->total);
+ }
}
rrdset_done(st_system_interrupts);
// --------------------------------------------------------------------
- if(likely(do_per_core)) {
+ if(likely(do_per_core != CONFIG_BOOLEAN_NO)) {
static RRDSET **core_st = NULL;
static int old_cpus = 0;
@@ -219,9 +219,9 @@ int do_proc_interrupts(int update_every, usec_t dt) {
, "cpu.interrupts"
, title
, "interrupts/s"
- , "proc"
- , "interrupts"
- , 1100 + c
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_INTERRUPTS_NAME
+ , NETDATA_CHART_PRIO_INTERRUPTS_PER_CORE + c
, update_every
, RRDSET_TYPE_STACKED
);
@@ -230,19 +230,14 @@ int do_proc_interrupts(int update_every, usec_t dt) {
for(l = 0; l < lines ;l++) {
struct interrupt *irr = irrindex(irrs, l, cpus);
-
- if(unlikely(!irr->used)) continue;
-
- if(unlikely(!irr->cpu[c].rd)) {
- irr->cpu[c].rd = rrddim_find(core_st[c], irr->id);
-
- if(unlikely(!irr->cpu[c].rd))
+ if(irr->used && (do_per_core == CONFIG_BOOLEAN_YES || irr->cpu[c].value)) {
+ if(unlikely(!irr->cpu[c].rd)) {
irr->cpu[c].rd = rrddim_add(core_st[c], irr->id, irr->name, 1, 1, RRD_ALGORITHM_INCREMENTAL);
- else
rrddim_set_name(core_st[c], irr->cpu[c].rd, irr->name);
- }
+ }
- rrddim_set_by_pointer(core_st[c], irr->cpu[c].rd, irr->cpu[c].value);
+ rrddim_set_by_pointer(core_st[c], irr->cpu[c].rd, irr->cpu[c].value);
+ }
}
rrdset_done(core_st[c]);
diff --git a/src/proc_loadavg.c b/collectors/proc.plugin/proc_loadavg.c
index 868f7d50a..db95b1689 100644
--- a/src/proc_loadavg.c
+++ b/collectors/proc.plugin/proc_loadavg.c
@@ -1,4 +1,9 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
+
+#define PLUGIN_PROC_MODULE_LOADAVG_NAME "/proc/loadavg"
+#define CONFIG_SECTION_PLUGIN_PROC_LOADAVG "plugin:" PLUGIN_PROC_CONFIG_NAME ":" PLUGIN_PROC_MODULE_LOADAVG_NAME
// linux calculates this once every 5 seconds
#define MIN_LOADAVG_UPDATE_EVERY 5
@@ -12,7 +17,7 @@ int do_proc_loadavg(int update_every, usec_t dt) {
char filename[FILENAME_MAX + 1];
snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/loadavg");
- ff = procfile_open(config_get("plugin:proc:/proc/loadavg", "filename to monitor", filename), " \t,:|/", PROCFILE_FLAG_DEFAULT);
+ ff = procfile_open(config_get(CONFIG_SECTION_PLUGIN_PROC_LOADAVG, "filename to monitor", filename), " \t,:|/", PROCFILE_FLAG_DEFAULT);
if(unlikely(!ff))
return 1;
}
@@ -22,8 +27,8 @@ int do_proc_loadavg(int update_every, usec_t dt) {
return 0; // we return 0, so that we will retry to open it next time
if(unlikely(do_loadavg == -1)) {
- do_loadavg = config_get_boolean("plugin:proc:/proc/loadavg", "enable load average", 1);
- do_all_processes = config_get_boolean("plugin:proc:/proc/loadavg", "enable total processes", 1);
+ do_loadavg = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_LOADAVG, "enable load average", 1);
+ do_all_processes = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_LOADAVG, "enable total processes", 1);
}
if(unlikely(procfile_lines(ff) < 1)) {
@@ -60,9 +65,9 @@ int do_proc_loadavg(int update_every, usec_t dt) {
, NULL
, "System Load Average"
, "load"
- , "proc"
- , "loadavg"
- , 100
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_LOADAVG_NAME
+ , NETDATA_CHART_PRIO_SYSTEM_LOAD
, (update_every < MIN_LOADAVG_UPDATE_EVERY) ? MIN_LOADAVG_UPDATE_EVERY : update_every
, RRDSET_TYPE_LINE
);
@@ -100,9 +105,9 @@ int do_proc_loadavg(int update_every, usec_t dt) {
, NULL
, "System Active Processes"
, "processes"
- , "proc"
- , "loadavg"
- , 750
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_LOADAVG_NAME
+ , NETDATA_CHART_PRIO_SYSTEM_ACTIVE_PROCESSES
, update_every
, RRDSET_TYPE_LINE
);
diff --git a/src/proc_meminfo.c b/collectors/proc.plugin/proc_meminfo.c
index 3915bf0e9..f77159ebd 100644
--- a/src/proc_meminfo.c
+++ b/collectors/proc.plugin/proc_meminfo.c
@@ -1,4 +1,9 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
+
+#define PLUGIN_PROC_MODULE_MEMINFO_NAME "/proc/meminfo"
+#define CONFIG_SECTION_PLUGIN_PROC_MEMINFO "plugin:" PLUGIN_PROC_CONFIG_NAME ":" PLUGIN_PROC_MODULE_MEMINFO_NAME
int do_proc_meminfo(int update_every, usec_t dt) {
(void)dt;
@@ -56,15 +61,15 @@ int do_proc_meminfo(int update_every, usec_t dt) {
HardwareCorrupted = 0;
if(unlikely(!arl_base)) {
- do_ram = config_get_boolean("plugin:proc:/proc/meminfo", "system ram", 1);
- do_swap = config_get_boolean_ondemand("plugin:proc:/proc/meminfo", "system swap", CONFIG_BOOLEAN_AUTO);
- do_hwcorrupt = config_get_boolean_ondemand("plugin:proc:/proc/meminfo", "hardware corrupted ECC", CONFIG_BOOLEAN_AUTO);
- do_committed = config_get_boolean("plugin:proc:/proc/meminfo", "committed memory", 1);
- do_writeback = config_get_boolean("plugin:proc:/proc/meminfo", "writeback memory", 1);
- do_kernel = config_get_boolean("plugin:proc:/proc/meminfo", "kernel memory", 1);
- do_slab = config_get_boolean("plugin:proc:/proc/meminfo", "slab memory", 1);
- do_hugepages = config_get_boolean_ondemand("plugin:proc:/proc/meminfo", "hugepages", CONFIG_BOOLEAN_AUTO);
- do_transparent_hugepages = config_get_boolean_ondemand("plugin:proc:/proc/meminfo", "transparent hugepages", CONFIG_BOOLEAN_AUTO);
+ do_ram = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_MEMINFO, "system ram", 1);
+ do_swap = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_MEMINFO, "system swap", CONFIG_BOOLEAN_AUTO);
+ do_hwcorrupt = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_MEMINFO, "hardware corrupted ECC", CONFIG_BOOLEAN_AUTO);
+ do_committed = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_MEMINFO, "committed memory", 1);
+ do_writeback = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_MEMINFO, "writeback memory", 1);
+ do_kernel = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_MEMINFO, "kernel memory", 1);
+ do_slab = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_MEMINFO, "slab memory", 1);
+ do_hugepages = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_MEMINFO, "hugepages", CONFIG_BOOLEAN_AUTO);
+ do_transparent_hugepages = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_MEMINFO, "transparent hugepages", CONFIG_BOOLEAN_AUTO);
arl_base = arl_create("meminfo", NULL, 60);
arl_expect(arl_base, "MemTotal", &MemTotal);
@@ -116,7 +121,7 @@ int do_proc_meminfo(int update_every, usec_t dt) {
if(unlikely(!ff)) {
char filename[FILENAME_MAX + 1];
snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/meminfo");
- ff = procfile_open(config_get("plugin:proc:/proc/meminfo", "filename to monitor", filename), " \t:", PROCFILE_FLAG_DEFAULT);
+ ff = procfile_open(config_get(CONFIG_SECTION_PLUGIN_PROC_MEMINFO, "filename to monitor", filename), " \t:", PROCFILE_FLAG_DEFAULT);
if(unlikely(!ff))
return 1;
}
@@ -158,9 +163,9 @@ int do_proc_meminfo(int update_every, usec_t dt) {
, NULL
, "System RAM"
, "MB"
- , "proc"
- , "meminfo"
- , 200
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_MEMINFO_NAME
+ , NETDATA_CHART_PRIO_SYSTEM_RAM
, update_every
, RRDSET_TYPE_STACKED
);
@@ -193,8 +198,8 @@ int do_proc_meminfo(int update_every, usec_t dt) {
, NULL
, "Available RAM for applications"
, "MB"
- , "proc"
- , "meminfo"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_MEMINFO_NAME
, NETDATA_CHART_PRIO_MEM_SYSTEM_AVAILABLE
, update_every
, RRDSET_TYPE_AREA
@@ -229,9 +234,9 @@ int do_proc_meminfo(int update_every, usec_t dt) {
, NULL
, "System Swap"
, "MB"
- , "proc"
- , "meminfo"
- , 201
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_MEMINFO_NAME
+ , NETDATA_CHART_PRIO_SYSTEM_SWAP
, update_every
, RRDSET_TYPE_STACKED
);
@@ -266,8 +271,8 @@ int do_proc_meminfo(int update_every, usec_t dt) {
, NULL
, "Corrupted Memory, detected by ECC"
, "MB"
- , "proc"
- , "meminfo"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_MEMINFO_NAME
, NETDATA_CHART_PRIO_MEM_HW
, update_every
, RRDSET_TYPE_LINE
@@ -299,8 +304,8 @@ int do_proc_meminfo(int update_every, usec_t dt) {
, NULL
, "Committed (Allocated) Memory"
, "MB"
- , "proc"
- , "meminfo"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_MEMINFO_NAME
, NETDATA_CHART_PRIO_MEM_SYSTEM_COMMITTED
, update_every
, RRDSET_TYPE_AREA
@@ -332,8 +337,8 @@ int do_proc_meminfo(int update_every, usec_t dt) {
, NULL
, "Writeback Memory"
, "MB"
- , "proc"
- , "meminfo"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_MEMINFO_NAME
, NETDATA_CHART_PRIO_MEM_KERNEL
, update_every
, RRDSET_TYPE_LINE
@@ -372,8 +377,8 @@ int do_proc_meminfo(int update_every, usec_t dt) {
, NULL
, "Memory Used by Kernel"
, "MB"
- , "proc"
- , "meminfo"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_MEMINFO_NAME
, NETDATA_CHART_PRIO_MEM_KERNEL + 1
, update_every
, RRDSET_TYPE_STACKED
@@ -411,8 +416,8 @@ int do_proc_meminfo(int update_every, usec_t dt) {
, NULL
, "Reclaimable Kernel Memory"
, "MB"
- , "proc"
- , "meminfo"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_MEMINFO_NAME
, NETDATA_CHART_PRIO_MEM_SLAB
, update_every
, RRDSET_TYPE_STACKED
@@ -448,8 +453,8 @@ int do_proc_meminfo(int update_every, usec_t dt) {
, NULL
, "Dedicated HugePages Memory"
, "MB"
- , "proc"
- , "meminfo"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_MEMINFO_NAME
, NETDATA_CHART_PRIO_MEM_HUGEPAGES + 1
, update_every
, RRDSET_TYPE_STACKED
@@ -489,8 +494,8 @@ int do_proc_meminfo(int update_every, usec_t dt) {
, NULL
, "Transparent HugePages Memory"
, "MB"
- , "proc"
- , "meminfo"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_MEMINFO_NAME
, NETDATA_CHART_PRIO_MEM_HUGEPAGES
, update_every
, RRDSET_TYPE_STACKED
diff --git a/src/proc_net_dev.c b/collectors/proc.plugin/proc_net_dev.c
index 341b9e0ca..97cbc060a 100644
--- a/src/proc_net_dev.c
+++ b/collectors/proc.plugin/proc_net_dev.c
@@ -1,4 +1,9 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
+
+#define PLUGIN_PROC_MODULE_NETDEV_NAME "/proc/net/dev"
+#define CONFIG_SECTION_PLUGIN_PROC_NETDEV "plugin:" PLUGIN_PROC_CONFIG_NAME ":" PLUGIN_PROC_MODULE_NETDEV_NAME
// ----------------------------------------------------------------------------
// netdev list
@@ -61,6 +66,7 @@ static struct netdev {
kernel_uint_t tcollisions;
kernel_uint_t tcarrier;
kernel_uint_t tcompressed;
+ kernel_uint_t speed_max;
// charts
RRDSET *st_bandwidth;
@@ -296,7 +302,7 @@ static inline void netdev_rename_cgroup(struct netdev *d, struct netdev_rename *
snprintfz(buffer, RRD_ID_LENGTH_MAX, "net %s", r->container_device);
d->chart_family = strdupz(buffer);
- d->priority = 43000;
+ d->priority = NETDATA_CHART_PRIO_CGROUP_NET_IFACE;
d->flipped = 1;
}
@@ -405,7 +411,7 @@ static struct netdev *get_netdev(const char *name) {
d->chart_id_net_packets = strdupz(d->name);
d->chart_family = strdupz(d->name);
- d->priority = 7000;
+ d->priority = NETDATA_CHART_PRIO_FIRST_NET_IFACE;
netdev_rename_lock(d);
@@ -430,30 +436,31 @@ int do_proc_net_dev(int update_every, usec_t dt) {
static int enable_new_interfaces = -1;
static int do_bandwidth = -1, do_packets = -1, do_errors = -1, do_drops = -1, do_fifo = -1, do_compressed = -1, do_events = -1;
static char *path_to_sys_devices_virtual_net = NULL;
+ static char *path_to_sys_net_speed = NULL;
if(unlikely(enable_new_interfaces == -1)) {
char filename[FILENAME_MAX + 1];
snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/sys/devices/virtual/net/%s");
- path_to_sys_devices_virtual_net = config_get("plugin:proc:/proc/net/dev", "path to get virtual interfaces", filename);
+ path_to_sys_devices_virtual_net = config_get(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "path to get virtual interfaces", filename);
- enable_new_interfaces = config_get_boolean_ondemand("plugin:proc:/proc/net/dev", "enable new interfaces detected at runtime", CONFIG_BOOLEAN_AUTO);
+ enable_new_interfaces = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "enable new interfaces detected at runtime", CONFIG_BOOLEAN_AUTO);
- do_bandwidth = config_get_boolean_ondemand("plugin:proc:/proc/net/dev", "bandwidth for all interfaces", CONFIG_BOOLEAN_AUTO);
- do_packets = config_get_boolean_ondemand("plugin:proc:/proc/net/dev", "packets for all interfaces", CONFIG_BOOLEAN_AUTO);
- do_errors = config_get_boolean_ondemand("plugin:proc:/proc/net/dev", "errors for all interfaces", CONFIG_BOOLEAN_AUTO);
- do_drops = config_get_boolean_ondemand("plugin:proc:/proc/net/dev", "drops for all interfaces", CONFIG_BOOLEAN_AUTO);
- do_fifo = config_get_boolean_ondemand("plugin:proc:/proc/net/dev", "fifo for all interfaces", CONFIG_BOOLEAN_AUTO);
- do_compressed = config_get_boolean_ondemand("plugin:proc:/proc/net/dev", "compressed packets for all interfaces", CONFIG_BOOLEAN_AUTO);
- do_events = config_get_boolean_ondemand("plugin:proc:/proc/net/dev", "frames, collisions, carrier counters for all interfaces", CONFIG_BOOLEAN_AUTO);
+ do_bandwidth = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "bandwidth for all interfaces", CONFIG_BOOLEAN_AUTO);
+ do_packets = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "packets for all interfaces", CONFIG_BOOLEAN_AUTO);
+ do_errors = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "errors for all interfaces", CONFIG_BOOLEAN_AUTO);
+ do_drops = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "drops for all interfaces", CONFIG_BOOLEAN_AUTO);
+ do_fifo = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "fifo for all interfaces", CONFIG_BOOLEAN_AUTO);
+ do_compressed = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "compressed packets for all interfaces", CONFIG_BOOLEAN_AUTO);
+ do_events = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "frames, collisions, carrier counters for all interfaces", CONFIG_BOOLEAN_AUTO);
- disabled_list = simple_pattern_create(config_get("plugin:proc:/proc/net/dev", "disable by default interfaces matching", "lo fireqos* *-ifb"), NULL, SIMPLE_PATTERN_EXACT);
+ disabled_list = simple_pattern_create(config_get(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "disable by default interfaces matching", "lo fireqos* *-ifb"), NULL, SIMPLE_PATTERN_EXACT);
}
if(unlikely(!ff)) {
char filename[FILENAME_MAX + 1];
- snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/net/dev");
- ff = procfile_open(config_get("plugin:proc:/proc/net/dev", "filename to monitor", filename), " \t,:|", PROCFILE_FLAG_DEFAULT);
+ snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, (*netdata_configured_host_prefix)?"/proc/1/net/dev":"/proc/net/dev");
+ ff = procfile_open(config_get(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "filename to monitor", filename), " \t,:|", PROCFILE_FLAG_DEFAULT);
if(unlikely(!ff)) return 1;
}
@@ -498,6 +505,14 @@ int do_proc_net_dev(int update_every, usec_t dt) {
else
d->virtual = 0;
+ // set nic speed if present
+ if(likely(!d->virtual)) {
+ snprintfz(buffer, FILENAME_MAX, "%s/sys/class/net/%s/speed", netdata_configured_host_prefix, d->name);
+ path_to_sys_net_speed = config_get(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "path to get net device speed", buffer);
+ int ret = read_single_number_file(path_to_sys_net_speed, (unsigned long long*)&d->speed_max);
+ if(ret) error("Cannot read '%s'.", path_to_sys_net_speed);
+ }
+
snprintfz(buffer, FILENAME_MAX, "plugin:proc:/proc/net/dev:%s", d->name);
d->enabled = config_get_boolean_ondemand(buffer, "enabled", d->enabled);
d->virtual = config_get_boolean(buffer, "virtual", d->virtual);
@@ -575,13 +590,16 @@ int do_proc_net_dev(int update_every, usec_t dt) {
, "net.net"
, "Bandwidth"
, "kilobits/s"
- , "proc"
- , "net/dev"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETDEV_NAME
, d->priority
, update_every
, RRDSET_TYPE_AREA
);
+ RRDSETVAR *nic_speed_max = rrdsetvar_custom_chart_variable_create(d->st_bandwidth, "nic_speed_max");
+ if(nic_speed_max) rrdsetvar_custom_chart_variable_set(nic_speed_max, (calculated_number)d->speed_max);
+
d->rd_rbytes = rrddim_add(d->st_bandwidth, "received", NULL, 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
d->rd_tbytes = rrddim_add(d->st_bandwidth, "sent", NULL, -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
@@ -616,8 +634,8 @@ int do_proc_net_dev(int update_every, usec_t dt) {
, "net.packets"
, "Packets"
, "packets/s"
- , "proc"
- , "net/dev"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETDEV_NAME
, d->priority + 1
, update_every
, RRDSET_TYPE_LINE
@@ -661,8 +679,8 @@ int do_proc_net_dev(int update_every, usec_t dt) {
, "net.errors"
, "Interface Errors"
, "errors/s"
- , "proc"
- , "net/dev"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETDEV_NAME
, d->priority + 2
, update_every
, RRDSET_TYPE_LINE
@@ -704,8 +722,8 @@ int do_proc_net_dev(int update_every, usec_t dt) {
, "net.drops"
, "Interface Drops"
, "drops/s"
- , "proc"
- , "net/dev"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETDEV_NAME
, d->priority + 3
, update_every
, RRDSET_TYPE_LINE
@@ -747,8 +765,8 @@ int do_proc_net_dev(int update_every, usec_t dt) {
, "net.fifo"
, "Interface FIFO Buffer Errors"
, "errors"
- , "proc"
- , "net/dev"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETDEV_NAME
, d->priority + 4
, update_every
, RRDSET_TYPE_LINE
@@ -790,8 +808,8 @@ int do_proc_net_dev(int update_every, usec_t dt) {
, "net.compressed"
, "Compressed Packets"
, "packets/s"
- , "proc"
- , "net/dev"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETDEV_NAME
, d->priority + 5
, update_every
, RRDSET_TYPE_LINE
@@ -833,8 +851,8 @@ int do_proc_net_dev(int update_every, usec_t dt) {
, "net.events"
, "Network Interface Events"
, "events/s"
- , "proc"
- , "net/dev"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETDEV_NAME
, d->priority + 6
, update_every
, RRDSET_TYPE_LINE
@@ -869,9 +887,9 @@ int do_proc_net_dev(int update_every, usec_t dt) {
, NULL
, "Physical Network Interfaces Aggregated Bandwidth"
, "kilobits/s"
- , "proc"
- , "net/dev"
- , 500
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETDEV_NAME
+ , NETDATA_CHART_PRIO_SYSTEM_NET
, update_every
, RRDSET_TYPE_AREA
);
diff --git a/src/proc_net_ip_vs_stats.c b/collectors/proc.plugin/proc_net_ip_vs_stats.c
index d76972f3c..43dcf2a88 100644
--- a/src/proc_net_ip_vs_stats.c
+++ b/collectors/proc.plugin/proc_net_ip_vs_stats.c
@@ -1,20 +1,24 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
-#define RRD_TYPE_NET_IPVS "ipvs"
+#include "plugin_proc.h"
+
+#define RRD_TYPE_NET_IPVS "ipvs"
+#define PLUGIN_PROC_MODULE_NET_IPVS_NAME "/proc/net/ip_vs_stats"
+#define CONFIG_SECTION_PLUGIN_PROC_NET_IPVS "plugin:" PLUGIN_PROC_CONFIG_NAME ":" PLUGIN_PROC_MODULE_NET_IPVS_NAME
int do_proc_net_ip_vs_stats(int update_every, usec_t dt) {
(void)dt;
static int do_bandwidth = -1, do_sockets = -1, do_packets = -1;
static procfile *ff = NULL;
- if(do_bandwidth == -1) do_bandwidth = config_get_boolean("plugin:proc:/proc/net/ip_vs_stats", "IPVS bandwidth", 1);
- if(do_sockets == -1) do_sockets = config_get_boolean("plugin:proc:/proc/net/ip_vs_stats", "IPVS connections", 1);
- if(do_packets == -1) do_packets = config_get_boolean("plugin:proc:/proc/net/ip_vs_stats", "IPVS packets", 1);
+ if(do_bandwidth == -1) do_bandwidth = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_NET_IPVS, "IPVS bandwidth", 1);
+ if(do_sockets == -1) do_sockets = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_NET_IPVS, "IPVS connections", 1);
+ if(do_packets == -1) do_packets = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_NET_IPVS, "IPVS packets", 1);
if(!ff) {
char filename[FILENAME_MAX + 1];
snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/net/ip_vs_stats");
- ff = procfile_open(config_get("plugin:proc:/proc/net/ip_vs_stats", "filename to monitor", filename), " \t,:|", PROCFILE_FLAG_DEFAULT);
+ ff = procfile_open(config_get(CONFIG_SECTION_PLUGIN_PROC_NET_IPVS, "filename to monitor", filename), " \t,:|", PROCFILE_FLAG_DEFAULT);
}
if(!ff) return 1;
@@ -50,9 +54,9 @@ int do_proc_net_ip_vs_stats(int update_every, usec_t dt) {
, NULL
, "IPVS New Connections"
, "connections/s"
- , "proc"
- , "net/ip_vs_stats"
- , 3101
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_IPVS_NAME
+ , NETDATA_CHART_PRIO_IPVS_SOCKETS
, update_every
, RRDSET_TYPE_LINE
);
@@ -78,9 +82,9 @@ int do_proc_net_ip_vs_stats(int update_every, usec_t dt) {
, NULL
, "IPVS Packets"
, "packets/s"
- , "proc"
- , "net/ip_vs_stats"
- , 3102
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_IPVS_NAME
+ , NETDATA_CHART_PRIO_IPVS_PACKETS
, update_every
, RRDSET_TYPE_LINE
);
@@ -108,9 +112,9 @@ int do_proc_net_ip_vs_stats(int update_every, usec_t dt) {
, NULL
, "IPVS Bandwidth"
, "kilobits/s"
- , "proc"
- , "net/ip_vs_stats"
- , 3100
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_IPVS_NAME
+ , NETDATA_CHART_PRIO_IPVS_NET
, update_every
, RRDSET_TYPE_AREA
);
diff --git a/src/proc_net_netstat.c b/collectors/proc.plugin/proc_net_netstat.c
index dd070e4c3..2dc3c59c0 100644
--- a/src/proc_net_netstat.c
+++ b/collectors/proc.plugin/proc_net_netstat.c
@@ -1,6 +1,12 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
-unsigned long long tcpext_TCPSynRetrans;
+#include "plugin_proc.h"
+
+#define RRD_TYPE_NET_NETSTAT "ip"
+#define PLUGIN_PROC_MODULE_NETSTAT_NAME "/proc/net/netstat"
+#define CONFIG_SECTION_PLUGIN_PROC_NETSTAT "plugin:" PLUGIN_PROC_CONFIG_NAME ":" PLUGIN_PROC_MODULE_NETSTAT_NAME
+
+unsigned long long tcpext_TCPSynRetrans = 0;
static void parse_line_pair(procfile *ff, ARL_BASE *base, size_t header_line, size_t values_line) {
size_t hwords = procfile_linewords(ff, header_line);
@@ -23,7 +29,7 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
static int do_bandwidth = -1, do_inerrors = -1, do_mcast = -1, do_bcast = -1, do_mcast_p = -1, do_bcast_p = -1, do_ecn = -1, \
do_tcpext_reorder = -1, do_tcpext_syscookies = -1, do_tcpext_ofo = -1, do_tcpext_connaborts = -1, do_tcpext_memory = -1,
- do_tcpext_listen = -1;
+ do_tcpext_syn_queue = -1, do_tcpext_accept_queue = -1;
static uint32_t hash_ipext = 0, hash_tcpext = 0;
static procfile *ff = NULL;
@@ -32,61 +38,61 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
static ARL_BASE *arl_ipext = NULL;
// --------------------------------------------------------------------
- // IPv4
+ // IP
- // IPv4 bandwidth
+ // IP bandwidth
static unsigned long long ipext_InOctets = 0;
static unsigned long long ipext_OutOctets = 0;
- // IPv4 input errors
+ // IP input errors
static unsigned long long ipext_InNoRoutes = 0;
static unsigned long long ipext_InTruncatedPkts = 0;
static unsigned long long ipext_InCsumErrors = 0;
- // IPv4 multicast bandwidth
+ // IP multicast bandwidth
static unsigned long long ipext_InMcastOctets = 0;
static unsigned long long ipext_OutMcastOctets = 0;
- // IPv4 multicast packets
+ // IP multicast packets
static unsigned long long ipext_InMcastPkts = 0;
static unsigned long long ipext_OutMcastPkts = 0;
- // IPv4 broadcast bandwidth
+ // IP broadcast bandwidth
static unsigned long long ipext_InBcastOctets = 0;
static unsigned long long ipext_OutBcastOctets = 0;
- // IPv4 broadcast packets
+ // IP broadcast packets
static unsigned long long ipext_InBcastPkts = 0;
static unsigned long long ipext_OutBcastPkts = 0;
- // IPv4 ECN
+ // IP ECN
static unsigned long long ipext_InNoECTPkts = 0;
static unsigned long long ipext_InECT1Pkts = 0;
static unsigned long long ipext_InECT0Pkts = 0;
static unsigned long long ipext_InCEPkts = 0;
// --------------------------------------------------------------------
- // IPv4 TCP
+ // IP TCP
- // IPv4 TCP Reordering
+ // IP TCP Reordering
static unsigned long long tcpext_TCPRenoReorder = 0;
static unsigned long long tcpext_TCPFACKReorder = 0;
static unsigned long long tcpext_TCPSACKReorder = 0;
static unsigned long long tcpext_TCPTSReorder = 0;
- // IPv4 TCP SYN Cookies
+ // IP TCP SYN Cookies
static unsigned long long tcpext_SyncookiesSent = 0;
static unsigned long long tcpext_SyncookiesRecv = 0;
static unsigned long long tcpext_SyncookiesFailed = 0;
- // IPv4 TCP Out Of Order Queue
+ // IP TCP Out Of Order Queue
// http://www.spinics.net/lists/netdev/msg204696.html
static unsigned long long tcpext_TCPOFOQueue = 0; // Number of packets queued in OFO queue
static unsigned long long tcpext_TCPOFODrop = 0; // Number of packets meant to be queued in OFO but dropped because socket rcvbuf limit hit.
static unsigned long long tcpext_TCPOFOMerge = 0; // Number of packets in OFO that were merged with other packets.
static unsigned long long tcpext_OfoPruned = 0; // packets dropped from out-of-order queue because of socket buffer overrun
- // IPv4 TCP connection resets
+ // IP TCP connection resets
// https://github.com/ecki/net-tools/blob/bd8bceaed2311651710331a7f8990c3e31be9840/statistics.c
static unsigned long long tcpext_TCPAbortOnData = 0; // connections reset due to unexpected data
static unsigned long long tcpext_TCPAbortOnClose = 0; // connections reset due to early user close
@@ -99,9 +105,12 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
static unsigned long long tcpext_ListenOverflows = 0; // times the listen queue of a socket overflowed
static unsigned long long tcpext_ListenDrops = 0; // SYNs to LISTEN sockets ignored
- // IPv4 TCP memory pressures
+ // IP TCP memory pressures
static unsigned long long tcpext_TCPMemoryPressures = 0;
+ static unsigned long long tcpext_TCPReqQFullDrop = 0;
+ static unsigned long long tcpext_TCPReqQFullDoCookies = 0;
+
// shared: tcpext_TCPSynRetrans
@@ -109,26 +118,28 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
hash_ipext = simple_hash("IpExt");
hash_tcpext = simple_hash("TcpExt");
- do_bandwidth = config_get_boolean_ondemand("plugin:proc:/proc/net/netstat", "bandwidth", CONFIG_BOOLEAN_AUTO);
- do_inerrors = config_get_boolean_ondemand("plugin:proc:/proc/net/netstat", "input errors", CONFIG_BOOLEAN_AUTO);
- do_mcast = config_get_boolean_ondemand("plugin:proc:/proc/net/netstat", "multicast bandwidth", CONFIG_BOOLEAN_AUTO);
- do_bcast = config_get_boolean_ondemand("plugin:proc:/proc/net/netstat", "broadcast bandwidth", CONFIG_BOOLEAN_AUTO);
- do_mcast_p = config_get_boolean_ondemand("plugin:proc:/proc/net/netstat", "multicast packets", CONFIG_BOOLEAN_AUTO);
- do_bcast_p = config_get_boolean_ondemand("plugin:proc:/proc/net/netstat", "broadcast packets", CONFIG_BOOLEAN_AUTO);
- do_ecn = config_get_boolean_ondemand("plugin:proc:/proc/net/netstat", "ECN packets", CONFIG_BOOLEAN_AUTO);
-
- do_tcpext_reorder = config_get_boolean_ondemand("plugin:proc:/proc/net/netstat", "TCP reorders", CONFIG_BOOLEAN_AUTO);
- do_tcpext_syscookies = config_get_boolean_ondemand("plugin:proc:/proc/net/netstat", "TCP SYN cookies", CONFIG_BOOLEAN_AUTO);
- do_tcpext_ofo = config_get_boolean_ondemand("plugin:proc:/proc/net/netstat", "TCP out-of-order queue", CONFIG_BOOLEAN_AUTO);
- do_tcpext_connaborts = config_get_boolean_ondemand("plugin:proc:/proc/net/netstat", "TCP connection aborts", CONFIG_BOOLEAN_AUTO);
- do_tcpext_memory = config_get_boolean_ondemand("plugin:proc:/proc/net/netstat", "TCP memory pressures", CONFIG_BOOLEAN_AUTO);
- do_tcpext_listen = config_get_boolean_ondemand("plugin:proc:/proc/net/netstat", "TCP listen issues", CONFIG_BOOLEAN_AUTO);
+ do_bandwidth = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "bandwidth", CONFIG_BOOLEAN_AUTO);
+ do_inerrors = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "input errors", CONFIG_BOOLEAN_AUTO);
+ do_mcast = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "multicast bandwidth", CONFIG_BOOLEAN_AUTO);
+ do_bcast = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "broadcast bandwidth", CONFIG_BOOLEAN_AUTO);
+ do_mcast_p = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "multicast packets", CONFIG_BOOLEAN_AUTO);
+ do_bcast_p = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "broadcast packets", CONFIG_BOOLEAN_AUTO);
+ do_ecn = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "ECN packets", CONFIG_BOOLEAN_AUTO);
+
+ do_tcpext_reorder = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "TCP reorders", CONFIG_BOOLEAN_AUTO);
+ do_tcpext_syscookies = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "TCP SYN cookies", CONFIG_BOOLEAN_AUTO);
+ do_tcpext_ofo = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "TCP out-of-order queue", CONFIG_BOOLEAN_AUTO);
+ do_tcpext_connaborts = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "TCP connection aborts", CONFIG_BOOLEAN_AUTO);
+ do_tcpext_memory = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "TCP memory pressures", CONFIG_BOOLEAN_AUTO);
+
+ do_tcpext_syn_queue = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "TCP SYN queue", CONFIG_BOOLEAN_AUTO);
+ do_tcpext_accept_queue = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "TCP accept queue", CONFIG_BOOLEAN_AUTO);
arl_ipext = arl_create("netstat/ipext", NULL, 60);
arl_tcpext = arl_create("netstat/tcpext", NULL, 60);
// --------------------------------------------------------------------
- // IPv4
+ // IP
if(do_bandwidth != CONFIG_BOOLEAN_NO) {
arl_expect(arl_ipext, "InOctets", &ipext_InOctets);
@@ -169,7 +180,7 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
}
// --------------------------------------------------------------------
- // IPv4 TCP
+ // IP TCP
if(do_tcpext_reorder != CONFIG_BOOLEAN_NO) {
arl_expect(arl_tcpext, "TCPFACKReorder", &tcpext_TCPFACKReorder);
@@ -204,11 +215,16 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
arl_expect(arl_tcpext, "TCPMemoryPressures", &tcpext_TCPMemoryPressures);
}
- if(do_tcpext_listen != CONFIG_BOOLEAN_NO) {
+ if(do_tcpext_accept_queue != CONFIG_BOOLEAN_NO) {
arl_expect(arl_tcpext, "ListenOverflows", &tcpext_ListenOverflows);
arl_expect(arl_tcpext, "ListenDrops", &tcpext_ListenDrops);
}
+ if(do_tcpext_syn_queue != CONFIG_BOOLEAN_NO) {
+ arl_expect(arl_tcpext, "TCPReqQFullDrop", &tcpext_TCPReqQFullDrop);
+ arl_expect(arl_tcpext, "TCPReqQFullDoCookies", &tcpext_TCPReqQFullDoCookies);
+ }
+
// shared metrics
arl_expect(arl_tcpext, "TCPSynRetrans", &tcpext_TCPSynRetrans);
}
@@ -216,7 +232,7 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
if(unlikely(!ff)) {
char filename[FILENAME_MAX + 1];
snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/net/netstat");
- ff = procfile_open(config_get("plugin:proc:/proc/net/netstat", "filename to monitor", filename), " \t:", PROCFILE_FLAG_DEFAULT);
+ ff = procfile_open(config_get(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "filename to monitor", filename), " \t:", PROCFILE_FLAG_DEFAULT);
if(unlikely(!ff)) return 1;
}
@@ -248,111 +264,111 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
if(do_bandwidth == CONFIG_BOOLEAN_YES || (do_bandwidth == CONFIG_BOOLEAN_AUTO && (ipext_InOctets || ipext_OutOctets))) {
do_bandwidth = CONFIG_BOOLEAN_YES;
- static RRDSET *st_system_ipv4 = NULL;
+ static RRDSET *st_system_ip = NULL;
static RRDDIM *rd_in = NULL, *rd_out = NULL;
- if(unlikely(!st_system_ipv4)) {
- st_system_ipv4 = rrdset_create_localhost(
+ if(unlikely(!st_system_ip)) {
+ st_system_ip = rrdset_create_localhost(
"system"
- , "ipv4"
+ , RRD_TYPE_NET_NETSTAT
, NULL
, "network"
, NULL
- , "IPv4 Bandwidth"
+ , "IP Bandwidth"
, "kilobits/s"
- , "proc"
- , "net/netstat"
- , 501
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETSTAT_NAME
+ , NETDATA_CHART_PRIO_SYSTEM_IP
, update_every
, RRDSET_TYPE_AREA
);
- rd_in = rrddim_add(st_system_ipv4, "InOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
- rd_out = rrddim_add(st_system_ipv4, "OutOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
+ rd_in = rrddim_add(st_system_ip, "InOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
+ rd_out = rrddim_add(st_system_ip, "OutOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
}
else
- rrdset_next(st_system_ipv4);
+ rrdset_next(st_system_ip);
- rrddim_set_by_pointer(st_system_ipv4, rd_in, ipext_InOctets);
- rrddim_set_by_pointer(st_system_ipv4, rd_out, ipext_OutOctets);
+ rrddim_set_by_pointer(st_system_ip, rd_in, ipext_InOctets);
+ rrddim_set_by_pointer(st_system_ip, rd_out, ipext_OutOctets);
- rrdset_done(st_system_ipv4);
+ rrdset_done(st_system_ip);
}
// --------------------------------------------------------------------
if(do_inerrors == CONFIG_BOOLEAN_YES || (do_inerrors == CONFIG_BOOLEAN_AUTO && (ipext_InNoRoutes || ipext_InTruncatedPkts))) {
do_inerrors = CONFIG_BOOLEAN_YES;
- static RRDSET *st_ipv4_inerrors = NULL;
+ static RRDSET *st_ip_inerrors = NULL;
static RRDDIM *rd_noroutes = NULL, *rd_truncated = NULL, *rd_checksum = NULL;
- if(unlikely(!st_ipv4_inerrors)) {
- st_ipv4_inerrors = rrdset_create_localhost(
- "ipv4"
+ if(unlikely(!st_ip_inerrors)) {
+ st_ip_inerrors = rrdset_create_localhost(
+ RRD_TYPE_NET_NETSTAT
, "inerrors"
, NULL
, "errors"
, NULL
- , "IPv4 Input Errors"
+ , "IP Input Errors"
, "packets/s"
- , "proc"
- , "net/netstat"
- , 4000
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETSTAT_NAME
+ , NETDATA_CHART_PRIO_IP_ERRORS
, update_every
, RRDSET_TYPE_LINE
);
- rrdset_flag_set(st_ipv4_inerrors, RRDSET_FLAG_DETAIL);
+ rrdset_flag_set(st_ip_inerrors, RRDSET_FLAG_DETAIL);
- rd_noroutes = rrddim_add(st_ipv4_inerrors, "InNoRoutes", "noroutes", 1, 1, RRD_ALGORITHM_INCREMENTAL);
- rd_truncated = rrddim_add(st_ipv4_inerrors, "InTruncatedPkts", "truncated", 1, 1, RRD_ALGORITHM_INCREMENTAL);
- rd_checksum = rrddim_add(st_ipv4_inerrors, "InCsumErrors", "checksum", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_noroutes = rrddim_add(st_ip_inerrors, "InNoRoutes", "noroutes", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_truncated = rrddim_add(st_ip_inerrors, "InTruncatedPkts", "truncated", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_checksum = rrddim_add(st_ip_inerrors, "InCsumErrors", "checksum", 1, 1, RRD_ALGORITHM_INCREMENTAL);
}
else
- rrdset_next(st_ipv4_inerrors);
+ rrdset_next(st_ip_inerrors);
- rrddim_set_by_pointer(st_ipv4_inerrors, rd_noroutes, ipext_InNoRoutes);
- rrddim_set_by_pointer(st_ipv4_inerrors, rd_truncated, ipext_InTruncatedPkts);
- rrddim_set_by_pointer(st_ipv4_inerrors, rd_checksum, ipext_InCsumErrors);
+ rrddim_set_by_pointer(st_ip_inerrors, rd_noroutes, ipext_InNoRoutes);
+ rrddim_set_by_pointer(st_ip_inerrors, rd_truncated, ipext_InTruncatedPkts);
+ rrddim_set_by_pointer(st_ip_inerrors, rd_checksum, ipext_InCsumErrors);
- rrdset_done(st_ipv4_inerrors);
+ rrdset_done(st_ip_inerrors);
}
// --------------------------------------------------------------------
if(do_mcast == CONFIG_BOOLEAN_YES || (do_mcast == CONFIG_BOOLEAN_AUTO && (ipext_InMcastOctets || ipext_OutMcastOctets))) {
do_mcast = CONFIG_BOOLEAN_YES;
- static RRDSET *st_ipv4_mcast = NULL;
+ static RRDSET *st_ip_mcast = NULL;
static RRDDIM *rd_in = NULL, *rd_out = NULL;
- if(unlikely(!st_ipv4_mcast)) {
- st_ipv4_mcast = rrdset_create_localhost(
- "ipv4"
+ if(unlikely(!st_ip_mcast)) {
+ st_ip_mcast = rrdset_create_localhost(
+ RRD_TYPE_NET_NETSTAT
, "mcast"
, NULL
, "multicast"
, NULL
- , "IPv4 Multicast Bandwidth"
+ , "IP Multicast Bandwidth"
, "kilobits/s"
- , "proc"
- , "net/netstat"
- , 9000
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETSTAT_NAME
+ , NETDATA_CHART_PRIO_IP_MCAST
, update_every
, RRDSET_TYPE_AREA
);
- rrdset_flag_set(st_ipv4_mcast, RRDSET_FLAG_DETAIL);
+ rrdset_flag_set(st_ip_mcast, RRDSET_FLAG_DETAIL);
- rd_in = rrddim_add(st_ipv4_mcast, "InMcastOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
- rd_out = rrddim_add(st_ipv4_mcast, "OutMcastOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
+ rd_in = rrddim_add(st_ip_mcast, "InMcastOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
+ rd_out = rrddim_add(st_ip_mcast, "OutMcastOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
}
else
- rrdset_next(st_ipv4_mcast);
+ rrdset_next(st_ip_mcast);
- rrddim_set_by_pointer(st_ipv4_mcast, rd_in, ipext_InMcastOctets);
- rrddim_set_by_pointer(st_ipv4_mcast, rd_out, ipext_OutMcastOctets);
+ rrddim_set_by_pointer(st_ip_mcast, rd_in, ipext_InMcastOctets);
+ rrddim_set_by_pointer(st_ip_mcast, rd_out, ipext_OutMcastOctets);
- rrdset_done(st_ipv4_mcast);
+ rrdset_done(st_ip_mcast);
}
// --------------------------------------------------------------------
@@ -360,37 +376,37 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
if(do_bcast == CONFIG_BOOLEAN_YES || (do_bcast == CONFIG_BOOLEAN_AUTO && (ipext_InBcastOctets || ipext_OutBcastOctets))) {
do_bcast = CONFIG_BOOLEAN_YES;
- static RRDSET *st_ipv4_bcast = NULL;
+ static RRDSET *st_ip_bcast = NULL;
static RRDDIM *rd_in = NULL, *rd_out = NULL;
- if(unlikely(!st_ipv4_bcast)) {
- st_ipv4_bcast = rrdset_create_localhost(
- "ipv4"
+ if(unlikely(!st_ip_bcast)) {
+ st_ip_bcast = rrdset_create_localhost(
+ RRD_TYPE_NET_NETSTAT
, "bcast"
, NULL
, "broadcast"
, NULL
- , "IPv4 Broadcast Bandwidth"
+ , "IP Broadcast Bandwidth"
, "kilobits/s"
- , "proc"
- , "net/netstat"
- , 8000
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETSTAT_NAME
+ , NETDATA_CHART_PRIO_IP_BCAST
, update_every
, RRDSET_TYPE_AREA
);
- rrdset_flag_set(st_ipv4_bcast, RRDSET_FLAG_DETAIL);
+ rrdset_flag_set(st_ip_bcast, RRDSET_FLAG_DETAIL);
- rd_in = rrddim_add(st_ipv4_bcast, "InBcastOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
- rd_out = rrddim_add(st_ipv4_bcast, "OutBcastOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
+ rd_in = rrddim_add(st_ip_bcast, "InBcastOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
+ rd_out = rrddim_add(st_ip_bcast, "OutBcastOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
}
else
- rrdset_next(st_ipv4_bcast);
+ rrdset_next(st_ip_bcast);
- rrddim_set_by_pointer(st_ipv4_bcast, rd_in, ipext_InBcastOctets);
- rrddim_set_by_pointer(st_ipv4_bcast, rd_out, ipext_OutBcastOctets);
+ rrddim_set_by_pointer(st_ip_bcast, rd_in, ipext_InBcastOctets);
+ rrddim_set_by_pointer(st_ip_bcast, rd_out, ipext_OutBcastOctets);
- rrdset_done(st_ipv4_bcast);
+ rrdset_done(st_ip_bcast);
}
// --------------------------------------------------------------------
@@ -398,36 +414,36 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
if(do_mcast_p == CONFIG_BOOLEAN_YES || (do_mcast_p == CONFIG_BOOLEAN_AUTO && (ipext_InMcastPkts || ipext_OutMcastPkts))) {
do_mcast_p = CONFIG_BOOLEAN_YES;
- static RRDSET *st_ipv4_mcastpkts = NULL;
+ static RRDSET *st_ip_mcastpkts = NULL;
static RRDDIM *rd_in = NULL, *rd_out = NULL;
- if(unlikely(!st_ipv4_mcastpkts)) {
- st_ipv4_mcastpkts = rrdset_create_localhost(
- "ipv4"
+ if(unlikely(!st_ip_mcastpkts)) {
+ st_ip_mcastpkts = rrdset_create_localhost(
+ RRD_TYPE_NET_NETSTAT
, "mcastpkts"
, NULL
, "multicast"
, NULL
- , "IPv4 Multicast Packets"
+ , "IP Multicast Packets"
, "packets/s"
- , "proc"
- , "net/netstat"
- , 8600
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETSTAT_NAME
+ , NETDATA_CHART_PRIO_IP_MCAST_PACKETS
, update_every
, RRDSET_TYPE_LINE
);
- rrdset_flag_set(st_ipv4_mcastpkts, RRDSET_FLAG_DETAIL);
+ rrdset_flag_set(st_ip_mcastpkts, RRDSET_FLAG_DETAIL);
- rd_in = rrddim_add(st_ipv4_mcastpkts, "InMcastPkts", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
- rd_out = rrddim_add(st_ipv4_mcastpkts, "OutMcastPkts", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_in = rrddim_add(st_ip_mcastpkts, "InMcastPkts", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_out = rrddim_add(st_ip_mcastpkts, "OutMcastPkts", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
}
- else rrdset_next(st_ipv4_mcastpkts);
+ else rrdset_next(st_ip_mcastpkts);
- rrddim_set_by_pointer(st_ipv4_mcastpkts, rd_in, ipext_InMcastPkts);
- rrddim_set_by_pointer(st_ipv4_mcastpkts, rd_out, ipext_OutMcastPkts);
+ rrddim_set_by_pointer(st_ip_mcastpkts, rd_in, ipext_InMcastPkts);
+ rrddim_set_by_pointer(st_ip_mcastpkts, rd_out, ipext_OutMcastPkts);
- rrdset_done(st_ipv4_mcastpkts);
+ rrdset_done(st_ip_mcastpkts);
}
// --------------------------------------------------------------------
@@ -435,37 +451,37 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
if(do_bcast_p == CONFIG_BOOLEAN_YES || (do_bcast_p == CONFIG_BOOLEAN_AUTO && (ipext_InBcastPkts || ipext_OutBcastPkts))) {
do_bcast_p = CONFIG_BOOLEAN_YES;
- static RRDSET *st_ipv4_bcastpkts = NULL;
+ static RRDSET *st_ip_bcastpkts = NULL;
static RRDDIM *rd_in = NULL, *rd_out = NULL;
- if(unlikely(!st_ipv4_bcastpkts)) {
- st_ipv4_bcastpkts = rrdset_create_localhost(
- "ipv4"
+ if(unlikely(!st_ip_bcastpkts)) {
+ st_ip_bcastpkts = rrdset_create_localhost(
+ RRD_TYPE_NET_NETSTAT
, "bcastpkts"
, NULL
, "broadcast"
, NULL
- , "IPv4 Broadcast Packets"
+ , "IP Broadcast Packets"
, "packets/s"
- , "proc"
- , "net/netstat"
- , 8500
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETSTAT_NAME
+ , NETDATA_CHART_PRIO_IP_BCAST_PACKETS
, update_every
, RRDSET_TYPE_LINE
);
- rrdset_flag_set(st_ipv4_bcastpkts, RRDSET_FLAG_DETAIL);
+ rrdset_flag_set(st_ip_bcastpkts, RRDSET_FLAG_DETAIL);
- rd_in = rrddim_add(st_ipv4_bcastpkts, "InBcastPkts", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
- rd_out = rrddim_add(st_ipv4_bcastpkts, "OutBcastPkts", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_in = rrddim_add(st_ip_bcastpkts, "InBcastPkts", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_out = rrddim_add(st_ip_bcastpkts, "OutBcastPkts", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
}
else
- rrdset_next(st_ipv4_bcastpkts);
+ rrdset_next(st_ip_bcastpkts);
- rrddim_set_by_pointer(st_ipv4_bcastpkts, rd_in, ipext_InBcastPkts);
- rrddim_set_by_pointer(st_ipv4_bcastpkts, rd_out, ipext_OutBcastPkts);
+ rrddim_set_by_pointer(st_ip_bcastpkts, rd_in, ipext_InBcastPkts);
+ rrddim_set_by_pointer(st_ip_bcastpkts, rd_out, ipext_OutBcastPkts);
- rrdset_done(st_ipv4_bcastpkts);
+ rrdset_done(st_ip_bcastpkts);
}
// --------------------------------------------------------------------
@@ -478,16 +494,16 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
if(unlikely(!st_ecnpkts)) {
st_ecnpkts = rrdset_create_localhost(
- "ipv4"
+ RRD_TYPE_NET_NETSTAT
, "ecnpkts"
, NULL
, "ecn"
, NULL
- , "IPv4 ECN Statistics"
+ , "IP ECN Statistics"
, "packets/s"
- , "proc"
- , "net/netstat"
- , 8700
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETSTAT_NAME
+ , NETDATA_CHART_PRIO_IP_ECN
, update_every
, RRDSET_TYPE_LINE
);
@@ -530,16 +546,16 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
if(unlikely(!st_tcpmemorypressures)) {
st_tcpmemorypressures = rrdset_create_localhost(
- "ipv4"
+ RRD_TYPE_NET_NETSTAT
, "tcpmemorypressures"
, NULL
, "tcp"
, NULL
, "TCP Memory Pressures"
, "events/s"
- , "proc"
- , "net/netstat"
- , 3000
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETSTAT_NAME
+ , NETDATA_CHART_PRIO_IP_TCP_MEM
, update_every
, RRDSET_TYPE_LINE
);
@@ -564,16 +580,16 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
if(unlikely(!st_tcpconnaborts)) {
st_tcpconnaborts = rrdset_create_localhost(
- "ipv4"
+ RRD_TYPE_NET_NETSTAT
, "tcpconnaborts"
, NULL
, "tcp"
, NULL
, "TCP Connection Aborts"
, "connections/s"
- , "proc"
- , "net/netstat"
- , 3010
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETSTAT_NAME
+ , NETDATA_CHART_PRIO_IP_TCP_CONNABORTS
, update_every
, RRDSET_TYPE_LINE
);
@@ -608,16 +624,16 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
if(unlikely(!st_tcpreorders)) {
st_tcpreorders = rrdset_create_localhost(
- "ipv4"
+ RRD_TYPE_NET_NETSTAT
, "tcpreorders"
, NULL
, "tcp"
, NULL
, "TCP Reordered Packets by Detection Method"
, "packets/s"
- , "proc"
- , "net/netstat"
- , 3020
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETSTAT_NAME
+ , NETDATA_CHART_PRIO_IP_TCP_REORDERS
, update_every
, RRDSET_TYPE_LINE
);
@@ -643,40 +659,40 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
if(do_tcpext_ofo == CONFIG_BOOLEAN_YES || (do_tcpext_ofo == CONFIG_BOOLEAN_AUTO && (tcpext_TCPOFOQueue || tcpext_TCPOFODrop || tcpext_TCPOFOMerge))) {
do_tcpext_ofo = CONFIG_BOOLEAN_YES;
- static RRDSET *st_ipv4_tcpofo = NULL;
+ static RRDSET *st_ip_tcpofo = NULL;
static RRDDIM *rd_inqueue = NULL, *rd_dropped = NULL, *rd_merged = NULL, *rd_pruned = NULL;
- if(unlikely(!st_ipv4_tcpofo)) {
+ if(unlikely(!st_ip_tcpofo)) {
- st_ipv4_tcpofo = rrdset_create_localhost(
- "ipv4"
+ st_ip_tcpofo = rrdset_create_localhost(
+ RRD_TYPE_NET_NETSTAT
, "tcpofo"
, NULL
, "tcp"
, NULL
, "TCP Out-Of-Order Queue"
, "packets/s"
- , "proc"
- , "net/netstat"
- , 3050
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETSTAT_NAME
+ , NETDATA_CHART_PRIO_IP_TCP_OFO
, update_every
, RRDSET_TYPE_LINE
);
- rd_inqueue = rrddim_add(st_ipv4_tcpofo, "TCPOFOQueue", "inqueue", 1, 1, RRD_ALGORITHM_INCREMENTAL);
- rd_dropped = rrddim_add(st_ipv4_tcpofo, "TCPOFODrop", "dropped", -1, 1, RRD_ALGORITHM_INCREMENTAL);
- rd_merged = rrddim_add(st_ipv4_tcpofo, "TCPOFOMerge", "merged", 1, 1, RRD_ALGORITHM_INCREMENTAL);
- rd_pruned = rrddim_add(st_ipv4_tcpofo, "OfoPruned", "pruned", -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_inqueue = rrddim_add(st_ip_tcpofo, "TCPOFOQueue", "inqueue", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_dropped = rrddim_add(st_ip_tcpofo, "TCPOFODrop", "dropped", -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_merged = rrddim_add(st_ip_tcpofo, "TCPOFOMerge", "merged", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_pruned = rrddim_add(st_ip_tcpofo, "OfoPruned", "pruned", -1, 1, RRD_ALGORITHM_INCREMENTAL);
}
else
- rrdset_next(st_ipv4_tcpofo);
+ rrdset_next(st_ip_tcpofo);
- rrddim_set_by_pointer(st_ipv4_tcpofo, rd_inqueue, tcpext_TCPOFOQueue);
- rrddim_set_by_pointer(st_ipv4_tcpofo, rd_dropped, tcpext_TCPOFODrop);
- rrddim_set_by_pointer(st_ipv4_tcpofo, rd_merged, tcpext_TCPOFOMerge);
- rrddim_set_by_pointer(st_ipv4_tcpofo, rd_pruned, tcpext_OfoPruned);
+ rrddim_set_by_pointer(st_ip_tcpofo, rd_inqueue, tcpext_TCPOFOQueue);
+ rrddim_set_by_pointer(st_ip_tcpofo, rd_dropped, tcpext_TCPOFODrop);
+ rrddim_set_by_pointer(st_ip_tcpofo, rd_merged, tcpext_TCPOFOMerge);
+ rrddim_set_by_pointer(st_ip_tcpofo, rd_pruned, tcpext_OfoPruned);
- rrdset_done(st_ipv4_tcpofo);
+ rrdset_done(st_ip_tcpofo);
}
// --------------------------------------------------------------------
@@ -690,16 +706,16 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
if(unlikely(!st_syncookies)) {
st_syncookies = rrdset_create_localhost(
- "ipv4"
+ RRD_TYPE_NET_NETSTAT
, "tcpsyncookies"
, NULL
, "tcp"
, NULL
, "TCP SYN Cookies"
, "packets/s"
- , "proc"
- , "net/netstat"
- , 3100
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETSTAT_NAME
+ , NETDATA_CHART_PRIO_IP_TCP_SYNCOOKIES
, update_every
, RRDSET_TYPE_LINE
);
@@ -720,40 +736,81 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if(do_tcpext_listen == CONFIG_BOOLEAN_YES || (do_tcpext_listen == CONFIG_BOOLEAN_AUTO && (tcpext_ListenOverflows || tcpext_ListenDrops))) {
- do_tcpext_listen = CONFIG_BOOLEAN_YES;
+ if(do_tcpext_syn_queue == CONFIG_BOOLEAN_YES || (do_tcpext_syn_queue == CONFIG_BOOLEAN_AUTO && (tcpext_TCPReqQFullDrop || tcpext_TCPReqQFullDoCookies))) {
+ do_tcpext_syn_queue = CONFIG_BOOLEAN_YES;
- static RRDSET *st_listen = NULL;
- static RRDDIM *rd_overflows = NULL, *rd_drops = NULL;
+ static RRDSET *st_syn_queue = NULL;
+ static RRDDIM
+ *rd_TCPReqQFullDrop = NULL,
+ *rd_TCPReqQFullDoCookies = NULL;
- if(unlikely(!st_listen)) {
+ if(unlikely(!st_syn_queue)) {
- st_listen = rrdset_create_localhost(
- "ipv4"
- , "tcplistenissues"
+ st_syn_queue = rrdset_create_localhost(
+ RRD_TYPE_NET_NETSTAT
+ , "tcp_syn_queue"
, NULL
, "tcp"
, NULL
- , "TCP Listen Socket Issues"
+ , "TCP SYN Queue Issues"
, "packets/s"
- , "proc"
- , "net/netstat"
- , 3015
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETSTAT_NAME
+ , NETDATA_CHART_PRIO_IP_TCP_SYN_QUEUE
, update_every
, RRDSET_TYPE_LINE
);
- rd_overflows = rrddim_add(st_listen, "ListenOverflows", "overflows", 1, 1, RRD_ALGORITHM_INCREMENTAL);
- rd_drops = rrddim_add(st_listen, "ListenDrops", "drops", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_TCPReqQFullDrop = rrddim_add(st_syn_queue, "TCPReqQFullDrop", "drops", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_TCPReqQFullDoCookies = rrddim_add(st_syn_queue, "TCPReqQFullDoCookies", "cookies", 1, 1, RRD_ALGORITHM_INCREMENTAL);
}
else
- rrdset_next(st_listen);
+ rrdset_next(st_syn_queue);
- rrddim_set_by_pointer(st_listen, rd_overflows, tcpext_ListenOverflows);
- rrddim_set_by_pointer(st_listen, rd_drops, tcpext_ListenDrops);
+ rrddim_set_by_pointer(st_syn_queue, rd_TCPReqQFullDrop, tcpext_TCPReqQFullDrop);
+ rrddim_set_by_pointer(st_syn_queue, rd_TCPReqQFullDoCookies, tcpext_TCPReqQFullDoCookies);
- rrdset_done(st_listen);
+ rrdset_done(st_syn_queue);
}
+
+ // --------------------------------------------------------------------
+
+ if(do_tcpext_accept_queue == CONFIG_BOOLEAN_YES || (do_tcpext_accept_queue == CONFIG_BOOLEAN_AUTO && (tcpext_ListenOverflows || tcpext_ListenDrops))) {
+ do_tcpext_accept_queue = CONFIG_BOOLEAN_YES;
+
+ static RRDSET *st_accept_queue = NULL;
+ static RRDDIM *rd_overflows = NULL,
+ *rd_drops = NULL;
+
+ if(unlikely(!st_accept_queue)) {
+
+ st_accept_queue = rrdset_create_localhost(
+ RRD_TYPE_NET_NETSTAT
+ , "tcp_accept_queue"
+ , NULL
+ , "tcp"
+ , NULL
+ , "TCP Accept Queue Issues"
+ , "packets/s"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NETSTAT_NAME
+ , NETDATA_CHART_PRIO_IP_TCP_ACCEPT_QUEUE
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+
+ rd_overflows = rrddim_add(st_accept_queue, "ListenOverflows", "overflows", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_drops = rrddim_add(st_accept_queue, "ListenDrops", "drops", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ }
+ else
+ rrdset_next(st_accept_queue);
+
+ rrddim_set_by_pointer(st_accept_queue, rd_overflows, tcpext_ListenOverflows);
+ rrddim_set_by_pointer(st_accept_queue, rd_drops, tcpext_ListenDrops);
+
+ rrdset_done(st_accept_queue);
+ }
+
}
}
diff --git a/src/proc_net_rpc_nfs.c b/collectors/proc.plugin/proc_net_rpc_nfs.c
index a4c778cba..f5702859c 100644
--- a/src/proc_net_rpc_nfs.c
+++ b/collectors/proc.plugin/proc_net_rpc_nfs.c
@@ -1,4 +1,9 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
+
+#define PLUGIN_PROC_MODULE_NFS_NAME "/proc/net/rpc/nfs"
+#define CONFIG_SECTION_PLUGIN_PROC_NFS "plugin:" PLUGIN_PROC_CONFIG_NAME ":" PLUGIN_PROC_MODULE_NFS_NAME
struct nfs_procs {
char name[30];
@@ -143,18 +148,18 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
if(!ff) {
char filename[FILENAME_MAX + 1];
snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/net/rpc/nfs");
- ff = procfile_open(config_get("plugin:proc:/proc/net/rpc/nfs", "filename to monitor", filename), " \t", PROCFILE_FLAG_DEFAULT);
+ ff = procfile_open(config_get(CONFIG_SECTION_PLUGIN_PROC_NFS, "filename to monitor", filename), " \t", PROCFILE_FLAG_DEFAULT);
}
if(!ff) return 1;
ff = procfile_readall(ff);
if(!ff) return 0; // we return 0, so that we will retry to open it next time
- if(do_net == -1) do_net = config_get_boolean("plugin:proc:/proc/net/rpc/nfs", "network", 1);
- if(do_rpc == -1) do_rpc = config_get_boolean("plugin:proc:/proc/net/rpc/nfs", "rpc", 1);
- if(do_proc2 == -1) do_proc2 = config_get_boolean("plugin:proc:/proc/net/rpc/nfs", "NFS v2 procedures", 1);
- if(do_proc3 == -1) do_proc3 = config_get_boolean("plugin:proc:/proc/net/rpc/nfs", "NFS v3 procedures", 1);
- if(do_proc4 == -1) do_proc4 = config_get_boolean("plugin:proc:/proc/net/rpc/nfs", "NFS v4 procedures", 1);
+ if(do_net == -1) do_net = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_NFS, "network", 1);
+ if(do_rpc == -1) do_rpc = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_NFS, "rpc", 1);
+ if(do_proc2 == -1) do_proc2 = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_NFS, "NFS v2 procedures", 1);
+ if(do_proc3 == -1) do_proc3 = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_NFS, "NFS v3 procedures", 1);
+ if(do_proc4 == -1) do_proc4 = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_NFS, "NFS v4 procedures", 1);
// if they are enabled, reset them to 1
// later we do them =2 to avoid doing strcmp() for all lines
@@ -286,9 +291,9 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
, NULL
, "NFS Client Network"
, "operations/s"
- , "proc"
- , "net/rpc/nfs"
- , 2207
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NFS_NAME
+ , NETDATA_CHART_PRIO_NFS_NET
, update_every
, RRDSET_TYPE_STACKED
);
@@ -326,9 +331,9 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
, NULL
, "NFS Client Remote Procedure Calls Statistics"
, "calls/s"
- , "proc"
- , "net/rpc/nfs"
- , 2208
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NFS_NAME
+ , NETDATA_CHART_PRIO_NFS_RPC
, update_every
, RRDSET_TYPE_LINE
);
@@ -359,9 +364,9 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
, NULL
, "NFS v2 Client Remote Procedure Calls"
, "calls/s"
- , "proc"
- , "net/rpc/nfs"
- , 2209
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NFS_NAME
+ , NETDATA_CHART_PRIO_NFS_PROC2
, update_every
, RRDSET_TYPE_STACKED
);
@@ -392,9 +397,9 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
, NULL
, "NFS v3 Client Remote Procedure Calls"
, "calls/s"
- , "proc"
- , "net/rpc/nfs"
- , 2210
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NFS_NAME
+ , NETDATA_CHART_PRIO_NFS_PROC3
, update_every
, RRDSET_TYPE_STACKED
);
@@ -425,9 +430,9 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
, NULL
, "NFS v4 Client Remote Procedure Calls"
, "calls/s"
- , "proc"
- , "net/rpc/nfs"
- , 2211
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NFS_NAME
+ , NETDATA_CHART_PRIO_NFS_PROC4
, update_every
, RRDSET_TYPE_STACKED
);
diff --git a/src/proc_net_rpc_nfsd.c b/collectors/proc.plugin/proc_net_rpc_nfsd.c
index 8aca31aed..20b87e9dd 100644
--- a/src/proc_net_rpc_nfsd.c
+++ b/collectors/proc.plugin/proc_net_rpc_nfsd.c
@@ -1,4 +1,8 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
+
+#define PLUGIN_PROC_MODULE_NFSD_NAME "/proc/net/rpc/nfsd"
struct nfsd_procs {
char name[30];
@@ -515,9 +519,9 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
, NULL
, "NFS Server Read Cache"
, "reads/s"
- , "proc"
- , "net/rpc/nfsd"
- , 2100
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NFSD_NAME
+ , NETDATA_CHART_PRIO_NFSD_READCACHE
, update_every
, RRDSET_TYPE_STACKED
);
@@ -553,9 +557,9 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
, NULL
, "NFS Server File Handles"
, "handles/s"
- , "proc"
- , "net/rpc/nfsd"
- , 2101
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NFSD_NAME
+ , NETDATA_CHART_PRIO_NFSD_FILEHANDLES
, update_every
, RRDSET_TYPE_LINE
);
@@ -593,9 +597,9 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
, NULL
, "NFS Server I/O"
, "kilobytes/s"
- , "proc"
- , "net/rpc/nfsd"
- , 2102
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NFSD_NAME
+ , NETDATA_CHART_PRIO_NFSD_IO
, update_every
, RRDSET_TYPE_AREA
);
@@ -626,9 +630,9 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
, NULL
, "NFS Server Threads"
, "threads"
- , "proc"
- , "net/rpc/nfsd"
- , 2103
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NFSD_NAME
+ , NETDATA_CHART_PRIO_NFSD_THREADS
, update_every
, RRDSET_TYPE_LINE
);
@@ -654,9 +658,9 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
, NULL
, "NFS Server Threads Full Count"
, "ops/s"
- , "proc"
- , "net/rpc/nfsd"
- , 2104
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NFSD_NAME
+ , NETDATA_CHART_PRIO_NFSD_THREADS_FULLCNT
, update_every
, RRDSET_TYPE_LINE
);
@@ -691,9 +695,9 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
, NULL
, "NFS Server Threads Usage Histogram"
, "percentage"
- , "proc"
- , "net/rpc/nfsd"
- , 2105
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NFSD_NAME
+ , NETDATA_CHART_PRIO_NFSD_THREADS_HISTOGRAM
, update_every
, RRDSET_TYPE_LINE
);
@@ -750,9 +754,9 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
, NULL
, "NFS Server Read Ahead Depth"
, "percentage"
- , "proc"
- , "net/rpc/nfsd"
- , 2105
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NFSD_NAME
+ , NETDATA_CHART_PRIO_NFSD_READAHEAD
, update_every
, RRDSET_TYPE_STACKED
);
@@ -804,9 +808,9 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
, NULL
, "NFS Server Network Statistics"
, "packets/s"
- , "proc"
- , "net/rpc/nfsd"
- , 2107
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NFSD_NAME
+ , NETDATA_CHART_PRIO_NFSD_NET
, update_every
, RRDSET_TYPE_STACKED
);
@@ -843,9 +847,9 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
, NULL
, "NFS Server Remote Procedure Calls Statistics"
, "calls/s"
- , "proc"
- , "net/rpc/nfsd"
- , 2108
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NFSD_NAME
+ , NETDATA_CHART_PRIO_NFSD_RPC
, update_every
, RRDSET_TYPE_LINE
);
@@ -879,9 +883,9 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
, NULL
, "NFS v2 Server Remote Procedure Calls"
, "calls/s"
- , "proc"
- , "net/rpc/nfsd"
- , 2109
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NFSD_NAME
+ , NETDATA_CHART_PRIO_NFSD_PROC2
, update_every
, RRDSET_TYPE_STACKED
);
@@ -912,9 +916,9 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
, NULL
, "NFS v3 Server Remote Procedure Calls"
, "calls/s"
- , "proc"
- , "net/rpc/nfsd"
- , 2110
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NFSD_NAME
+ , NETDATA_CHART_PRIO_NFSD_PROC3
, update_every
, RRDSET_TYPE_STACKED
);
@@ -945,9 +949,9 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
, NULL
, "NFS v4 Server Remote Procedure Calls"
, "calls/s"
- , "proc"
- , "net/rpc/nfsd"
- , 2111
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NFSD_NAME
+ , NETDATA_CHART_PRIO_NFSD_PROC4
, update_every
, RRDSET_TYPE_STACKED
);
@@ -978,9 +982,9 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
, NULL
, "NFS v4 Server Operations"
, "operations/s"
- , "proc"
- , "net/rpc/nfsd"
- , 2112
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NFSD_NAME
+ , NETDATA_CHART_PRIO_NFSD_PROC4OPS
, update_every
, RRDSET_TYPE_STACKED
);
diff --git a/collectors/proc.plugin/proc_net_sctp_snmp.c b/collectors/proc.plugin/proc_net_sctp_snmp.c
new file mode 100644
index 000000000..bd1062e98
--- /dev/null
+++ b/collectors/proc.plugin/proc_net_sctp_snmp.c
@@ -0,0 +1,352 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
+#define PLUGIN_PROC_MODULE_NET_SCTP_SNMP_NAME "/proc/net/sctp/snmp"
+
+int do_proc_net_sctp_snmp(int update_every, usec_t dt) {
+ (void)dt;
+
+ static procfile *ff = NULL;
+
+ static int
+ do_associations = -1,
+ do_transitions = -1,
+ do_packet_errors = -1,
+ do_packets = -1,
+ do_fragmentation = -1,
+ do_chunk_types = -1;
+
+ static ARL_BASE *arl_base = NULL;
+
+ static unsigned long long SctpCurrEstab = 0ULL;
+ static unsigned long long SctpActiveEstabs = 0ULL;
+ static unsigned long long SctpPassiveEstabs = 0ULL;
+ static unsigned long long SctpAborteds = 0ULL;
+ static unsigned long long SctpShutdowns = 0ULL;
+ static unsigned long long SctpOutOfBlues = 0ULL;
+ static unsigned long long SctpChecksumErrors = 0ULL;
+ static unsigned long long SctpOutCtrlChunks = 0ULL;
+ static unsigned long long SctpOutOrderChunks = 0ULL;
+ static unsigned long long SctpOutUnorderChunks = 0ULL;
+ static unsigned long long SctpInCtrlChunks = 0ULL;
+ static unsigned long long SctpInOrderChunks = 0ULL;
+ static unsigned long long SctpInUnorderChunks = 0ULL;
+ static unsigned long long SctpFragUsrMsgs = 0ULL;
+ static unsigned long long SctpReasmUsrMsgs = 0ULL;
+ static unsigned long long SctpOutSCTPPacks = 0ULL;
+ static unsigned long long SctpInSCTPPacks = 0ULL;
+ static unsigned long long SctpT1InitExpireds = 0ULL;
+ static unsigned long long SctpT1CookieExpireds = 0ULL;
+ static unsigned long long SctpT2ShutdownExpireds = 0ULL;
+ static unsigned long long SctpT3RtxExpireds = 0ULL;
+ static unsigned long long SctpT4RtoExpireds = 0ULL;
+ static unsigned long long SctpT5ShutdownGuardExpireds = 0ULL;
+ static unsigned long long SctpDelaySackExpireds = 0ULL;
+ static unsigned long long SctpAutocloseExpireds = 0ULL;
+ static unsigned long long SctpT3Retransmits = 0ULL;
+ static unsigned long long SctpPmtudRetransmits = 0ULL;
+ static unsigned long long SctpFastRetransmits = 0ULL;
+ static unsigned long long SctpInPktSoftirq = 0ULL;
+ static unsigned long long SctpInPktBacklog = 0ULL;
+ static unsigned long long SctpInPktDiscards = 0ULL;
+ static unsigned long long SctpInDataChunkDiscards = 0ULL;
+
+ if(unlikely(!arl_base)) {
+ do_associations = config_get_boolean_ondemand("plugin:proc:/proc/net/sctp/snmp", "established associations", CONFIG_BOOLEAN_AUTO);
+ do_transitions = config_get_boolean_ondemand("plugin:proc:/proc/net/sctp/snmp", "association transitions", CONFIG_BOOLEAN_AUTO);
+ do_fragmentation = config_get_boolean_ondemand("plugin:proc:/proc/net/sctp/snmp", "fragmentation", CONFIG_BOOLEAN_AUTO);
+ do_packets = config_get_boolean_ondemand("plugin:proc:/proc/net/sctp/snmp", "packets", CONFIG_BOOLEAN_AUTO);
+ do_packet_errors = config_get_boolean_ondemand("plugin:proc:/proc/net/sctp/snmp", "packet errors", CONFIG_BOOLEAN_AUTO);
+ do_chunk_types = config_get_boolean_ondemand("plugin:proc:/proc/net/sctp/snmp", "chunk types", CONFIG_BOOLEAN_AUTO);
+
+ arl_base = arl_create("sctp", NULL, 60);
+ arl_expect(arl_base, "SctpCurrEstab", &SctpCurrEstab);
+ arl_expect(arl_base, "SctpActiveEstabs", &SctpActiveEstabs);
+ arl_expect(arl_base, "SctpPassiveEstabs", &SctpPassiveEstabs);
+ arl_expect(arl_base, "SctpAborteds", &SctpAborteds);
+ arl_expect(arl_base, "SctpShutdowns", &SctpShutdowns);
+ arl_expect(arl_base, "SctpOutOfBlues", &SctpOutOfBlues);
+ arl_expect(arl_base, "SctpChecksumErrors", &SctpChecksumErrors);
+ arl_expect(arl_base, "SctpOutCtrlChunks", &SctpOutCtrlChunks);
+ arl_expect(arl_base, "SctpOutOrderChunks", &SctpOutOrderChunks);
+ arl_expect(arl_base, "SctpOutUnorderChunks", &SctpOutUnorderChunks);
+ arl_expect(arl_base, "SctpInCtrlChunks", &SctpInCtrlChunks);
+ arl_expect(arl_base, "SctpInOrderChunks", &SctpInOrderChunks);
+ arl_expect(arl_base, "SctpInUnorderChunks", &SctpInUnorderChunks);
+ arl_expect(arl_base, "SctpFragUsrMsgs", &SctpFragUsrMsgs);
+ arl_expect(arl_base, "SctpReasmUsrMsgs", &SctpReasmUsrMsgs);
+ arl_expect(arl_base, "SctpOutSCTPPacks", &SctpOutSCTPPacks);
+ arl_expect(arl_base, "SctpInSCTPPacks", &SctpInSCTPPacks);
+ arl_expect(arl_base, "SctpT1InitExpireds", &SctpT1InitExpireds);
+ arl_expect(arl_base, "SctpT1CookieExpireds", &SctpT1CookieExpireds);
+ arl_expect(arl_base, "SctpT2ShutdownExpireds", &SctpT2ShutdownExpireds);
+ arl_expect(arl_base, "SctpT3RtxExpireds", &SctpT3RtxExpireds);
+ arl_expect(arl_base, "SctpT4RtoExpireds", &SctpT4RtoExpireds);
+ arl_expect(arl_base, "SctpT5ShutdownGuardExpireds", &SctpT5ShutdownGuardExpireds);
+ arl_expect(arl_base, "SctpDelaySackExpireds", &SctpDelaySackExpireds);
+ arl_expect(arl_base, "SctpAutocloseExpireds", &SctpAutocloseExpireds);
+ arl_expect(arl_base, "SctpT3Retransmits", &SctpT3Retransmits);
+ arl_expect(arl_base, "SctpPmtudRetransmits", &SctpPmtudRetransmits);
+ arl_expect(arl_base, "SctpFastRetransmits", &SctpFastRetransmits);
+ arl_expect(arl_base, "SctpInPktSoftirq", &SctpInPktSoftirq);
+ arl_expect(arl_base, "SctpInPktBacklog", &SctpInPktBacklog);
+ arl_expect(arl_base, "SctpInPktDiscards", &SctpInPktDiscards);
+ arl_expect(arl_base, "SctpInDataChunkDiscards", &SctpInDataChunkDiscards);
+ }
+
+ if(unlikely(!ff)) {
+ char filename[FILENAME_MAX + 1];
+ snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/net/sctp/snmp");
+ ff = procfile_open(config_get("plugin:proc:/proc/net/sctp/snmp", "filename to monitor", filename), " \t:", PROCFILE_FLAG_DEFAULT);
+ if(unlikely(!ff))
+ return 1;
+ }
+
+ ff = procfile_readall(ff);
+ if(unlikely(!ff))
+ return 0; // we return 0, so that we will retry to open it next time
+
+ size_t lines = procfile_lines(ff), l;
+
+ arl_begin(arl_base);
+
+ for(l = 0; l < lines ;l++) {
+ size_t words = procfile_linewords(ff, l);
+ if(unlikely(words < 2)) {
+ if(unlikely(words)) error("Cannot read /proc/net/sctp/snmp line %zu. Expected 2 params, read %zu.", l, words);
+ continue;
+ }
+
+ if(unlikely(arl_check(arl_base,
+ procfile_lineword(ff, l, 0),
+ procfile_lineword(ff, l, 1)))) break;
+ }
+
+ // --------------------------------------------------------------------
+
+ if(do_associations == CONFIG_BOOLEAN_YES || (do_associations == CONFIG_BOOLEAN_AUTO && SctpCurrEstab)) {
+ do_associations = CONFIG_BOOLEAN_YES;
+ static RRDSET *st = NULL;
+ static RRDDIM *rd_established = NULL;
+
+ if(unlikely(!st)) {
+ st = rrdset_create_localhost(
+ "sctp"
+ , "established"
+ , NULL
+ , "associations"
+ , NULL
+ , "SCTP current total number of established associations"
+ , "associations"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SCTP_SNMP_NAME
+ , NETDATA_CHART_PRIO_SCTP
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+
+ rd_established = rrddim_add(st, "SctpCurrEstab", "established", 1, 1, RRD_ALGORITHM_ABSOLUTE);
+ }
+ else rrdset_next(st);
+
+ rrddim_set_by_pointer(st, rd_established, SctpCurrEstab);
+ rrdset_done(st);
+ }
+
+ // --------------------------------------------------------------------
+
+ if(do_transitions == CONFIG_BOOLEAN_YES || (do_transitions == CONFIG_BOOLEAN_AUTO && (SctpActiveEstabs || SctpPassiveEstabs || SctpAborteds || SctpShutdowns))) {
+ do_transitions = CONFIG_BOOLEAN_YES;
+ static RRDSET *st = NULL;
+ static RRDDIM *rd_active = NULL,
+ *rd_passive = NULL,
+ *rd_aborted = NULL,
+ *rd_shutdown = NULL;
+
+ if(unlikely(!st)) {
+ st = rrdset_create_localhost(
+ "sctp"
+ , "transitions"
+ , NULL
+ , "transitions"
+ , NULL
+ , "SCTP Association Transitions"
+ , "transitions/s"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SCTP_SNMP_NAME
+ , NETDATA_CHART_PRIO_SCTP + 10
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+
+ rd_active = rrddim_add(st, "SctpActiveEstabs", "active", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_passive = rrddim_add(st, "SctpPassiveEstabs", "passive", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_aborted = rrddim_add(st, "SctpAborteds", "aborted", -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_shutdown = rrddim_add(st, "SctpShutdowns", "shutdown", -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ }
+ else rrdset_next(st);
+
+ rrddim_set_by_pointer(st, rd_active, SctpActiveEstabs);
+ rrddim_set_by_pointer(st, rd_passive, SctpPassiveEstabs);
+ rrddim_set_by_pointer(st, rd_aborted, SctpAborteds);
+ rrddim_set_by_pointer(st, rd_shutdown, SctpShutdowns);
+ rrdset_done(st);
+ }
+
+ // --------------------------------------------------------------------
+
+ if(do_packets == CONFIG_BOOLEAN_YES || (do_packets == CONFIG_BOOLEAN_AUTO && (SctpInSCTPPacks || SctpOutSCTPPacks))) {
+ do_packets = CONFIG_BOOLEAN_YES;
+ static RRDSET *st = NULL;
+ static RRDDIM *rd_received = NULL,
+ *rd_sent = NULL;
+
+ if(unlikely(!st)) {
+ st = rrdset_create_localhost(
+ "sctp"
+ , "packets"
+ , NULL
+ , "packets"
+ , NULL
+ , "SCTP Packets"
+ , "packets/s"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SCTP_SNMP_NAME
+ , NETDATA_CHART_PRIO_SCTP + 20
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+ rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
+
+ rd_received = rrddim_add(st, "SctpInSCTPPacks", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_sent = rrddim_add(st, "SctpOutSCTPPacks", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ }
+ else rrdset_next(st);
+
+ rrddim_set_by_pointer(st, rd_received, SctpInSCTPPacks);
+ rrddim_set_by_pointer(st, rd_sent, SctpOutSCTPPacks);
+ rrdset_done(st);
+ }
+
+ // --------------------------------------------------------------------
+
+ if(do_packet_errors == CONFIG_BOOLEAN_YES || (do_packet_errors == CONFIG_BOOLEAN_AUTO && (SctpOutOfBlues || SctpChecksumErrors))) {
+ do_packet_errors = CONFIG_BOOLEAN_YES;
+ static RRDSET *st = NULL;
+ static RRDDIM *rd_invalid = NULL,
+ *rd_csum = NULL;
+
+ if(unlikely(!st)) {
+ st = rrdset_create_localhost(
+ "sctp"
+ , "packet_errors"
+ , NULL
+ , "packets"
+ , NULL
+ , "SCTP Packet Errors"
+ , "packets/s"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SCTP_SNMP_NAME
+ , NETDATA_CHART_PRIO_SCTP + 30
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+ rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
+
+ rd_invalid = rrddim_add(st, "SctpOutOfBlues", "invalid", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_csum = rrddim_add(st, "SctpChecksumErrors", "checksum", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ }
+ else rrdset_next(st);
+
+ rrddim_set_by_pointer(st, rd_invalid, SctpOutOfBlues);
+ rrddim_set_by_pointer(st, rd_csum, SctpChecksumErrors);
+ rrdset_done(st);
+ }
+
+ // --------------------------------------------------------------------
+
+ if(do_fragmentation == CONFIG_BOOLEAN_YES || (do_fragmentation == CONFIG_BOOLEAN_AUTO && (SctpFragUsrMsgs || SctpReasmUsrMsgs))) {
+ do_fragmentation = CONFIG_BOOLEAN_YES;
+
+ static RRDSET *st = NULL;
+ static RRDDIM *rd_fragmented = NULL,
+ *rd_reassembled = NULL;
+
+ if(unlikely(!st)) {
+ st = rrdset_create_localhost(
+ "sctp"
+ , "fragmentation"
+ , NULL
+ , "fragmentation"
+ , NULL
+ , "SCTP Fragmentation"
+ , "packets/s"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SCTP_SNMP_NAME
+ , NETDATA_CHART_PRIO_SCTP + 40
+ , update_every
+ , RRDSET_TYPE_LINE);
+ rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
+
+ rd_reassembled = rrddim_add(st, "SctpReasmUsrMsgs", "reassembled", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_fragmented = rrddim_add(st, "SctpFragUsrMsgs", "fragmented", -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ }
+ else rrdset_next(st);
+
+ rrddim_set_by_pointer(st, rd_reassembled, SctpReasmUsrMsgs);
+ rrddim_set_by_pointer(st, rd_fragmented, SctpFragUsrMsgs);
+ rrdset_done(st);
+ }
+
+ // --------------------------------------------------------------------
+
+ if(do_chunk_types == CONFIG_BOOLEAN_YES || (do_chunk_types == CONFIG_BOOLEAN_AUTO
+ && (SctpInCtrlChunks || SctpInOrderChunks || SctpInUnorderChunks || SctpOutCtrlChunks || SctpOutOrderChunks || SctpOutUnorderChunks))) {
+ do_chunk_types = CONFIG_BOOLEAN_YES;
+ static RRDSET *st = NULL;
+ static RRDDIM
+ *rd_InCtrl = NULL,
+ *rd_InOrder = NULL,
+ *rd_InUnorder = NULL,
+ *rd_OutCtrl = NULL,
+ *rd_OutOrder = NULL,
+ *rd_OutUnorder = NULL;
+
+ if(unlikely(!st)) {
+ st = rrdset_create_localhost(
+ "sctp"
+ , "chunks"
+ , NULL
+ , "chunks"
+ , NULL
+ , "SCTP Chunk Types"
+ , "chunks/s"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SCTP_SNMP_NAME
+ , NETDATA_CHART_PRIO_SCTP + 50
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+ rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
+
+ rd_InCtrl = rrddim_add(st, "SctpInCtrlChunks", "InCtrl", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_InOrder = rrddim_add(st, "SctpInOrderChunks", "InOrder", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_InUnorder = rrddim_add(st, "SctpInUnorderChunks", "InUnorder", 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_OutCtrl = rrddim_add(st, "SctpOutCtrlChunks", "OutCtrl", -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_OutOrder = rrddim_add(st, "SctpOutOrderChunks", "OutOrder", -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_OutUnorder = rrddim_add(st, "SctpOutUnorderChunks", "OutUnorder", -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ }
+ else rrdset_next(st);
+
+ rrddim_set_by_pointer(st, rd_InCtrl, SctpInCtrlChunks);
+ rrddim_set_by_pointer(st, rd_InOrder, SctpInOrderChunks);
+ rrddim_set_by_pointer(st, rd_InUnorder, SctpInUnorderChunks);
+ rrddim_set_by_pointer(st, rd_OutCtrl, SctpOutCtrlChunks);
+ rrddim_set_by_pointer(st, rd_OutOrder, SctpOutOrderChunks);
+ rrddim_set_by_pointer(st, rd_OutUnorder, SctpOutUnorderChunks);
+ rrdset_done(st);
+ }
+
+ return 0;
+}
+
diff --git a/src/proc_net_snmp.c b/collectors/proc.plugin/proc_net_snmp.c
index 43c010c14..ffd368f6e 100644
--- a/src/proc_net_snmp.c
+++ b/collectors/proc.plugin/proc_net_snmp.c
@@ -1,6 +1,9 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
-#define RRD_TYPE_NET_SNMP "ipv4"
+#include "plugin_proc.h"
+#define PLUGIN_PROC_MODULE_NET_SNMP_NAME "/proc/net/snmp"
+
+#define RRD_TYPE_NET_SNMP "ipv4"
static struct proc_net_snmp {
// kernel_uint_t ip_Forwarding;
@@ -102,23 +105,22 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
*arl_udplite = NULL;
static RRDVAR *tcp_max_connections_var = NULL;
- static ssize_t last_max_connections = 0;
if(unlikely(!arl_ip)) {
- do_ip_packets = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 packets", 1);
- do_ip_fragsout = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 fragments sent", 1);
- do_ip_fragsin = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 fragments assembly", 1);
- do_ip_errors = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 errors", 1);
- do_tcp_sockets = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 TCP connections", 1);
- do_tcp_packets = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 TCP packets", 1);
- do_tcp_errors = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 TCP errors", 1);
- do_tcp_opens = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 TCP opens", 1);
- do_tcp_handshake = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 TCP handshake issues", 1);
- do_udp_packets = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 UDP packets", 1);
- do_udp_errors = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 UDP errors", 1);
- do_icmp_packets = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 ICMP packets", 1);
- do_icmpmsg = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 ICMP messages", 1);
- do_udplite_packets = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 UDPLite packets", 1);
+ do_ip_packets = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 packets", CONFIG_BOOLEAN_AUTO);
+ do_ip_fragsout = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 fragments sent", CONFIG_BOOLEAN_AUTO);
+ do_ip_fragsin = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 fragments assembly", CONFIG_BOOLEAN_AUTO);
+ do_ip_errors = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 errors", CONFIG_BOOLEAN_AUTO);
+ do_tcp_sockets = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 TCP connections", CONFIG_BOOLEAN_AUTO);
+ do_tcp_packets = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 TCP packets", CONFIG_BOOLEAN_AUTO);
+ do_tcp_errors = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 TCP errors", CONFIG_BOOLEAN_AUTO);
+ do_tcp_opens = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 TCP opens", CONFIG_BOOLEAN_AUTO);
+ do_tcp_handshake = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 TCP handshake issues", CONFIG_BOOLEAN_AUTO);
+ do_udp_packets = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 UDP packets", CONFIG_BOOLEAN_AUTO);
+ do_udp_errors = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 UDP errors", CONFIG_BOOLEAN_AUTO);
+ do_icmp_packets = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 ICMP packets", CONFIG_BOOLEAN_AUTO);
+ do_icmpmsg = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 ICMP messages", CONFIG_BOOLEAN_AUTO);
+ do_udplite_packets = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 UDPLite packets", CONFIG_BOOLEAN_AUTO);
hash_ip = simple_hash("Ip");
hash_tcp = simple_hash("Tcp");
@@ -181,7 +183,7 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
// arl_expect(arl_tcp, "RtoAlgorithm", &snmp_root.tcp_RtoAlgorithm);
// arl_expect(arl_tcp, "RtoMin", &snmp_root.tcp_RtoMin);
// arl_expect(arl_tcp, "RtoMax", &snmp_root.tcp_RtoMax);
- arl_expect(arl_tcp, "MaxConn", &snmp_root.tcp_MaxConn);
+ arl_expect_custom(arl_tcp, "MaxConn", arl_callback_ssize_t, &snmp_root.tcp_MaxConn);
arl_expect(arl_tcp, "ActiveOpens", &snmp_root.tcp_ActiveOpens);
arl_expect(arl_tcp, "PassiveOpens", &snmp_root.tcp_PassiveOpens);
arl_expect(arl_tcp, "AttemptFails", &snmp_root.tcp_AttemptFails);
@@ -256,7 +258,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if(do_ip_packets) {
+ if(do_ip_packets == CONFIG_BOOLEAN_YES || (do_ip_packets == CONFIG_BOOLEAN_AUTO && (snmp_root.ip_OutRequests || snmp_root.ip_InReceives || snmp_root.ip_ForwDatagrams || snmp_root.ip_InDelivers))) {
+ do_ip_packets = CONFIG_BOOLEAN_YES;
+
static RRDSET *st = NULL;
static RRDDIM *rd_InReceives = NULL,
*rd_OutRequests = NULL,
@@ -272,9 +276,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
, NULL
, "IPv4 Packets"
, "packets/s"
- , "proc"
- , "net/snmp"
- , 2450
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP_NAME
+ , NETDATA_CHART_PRIO_IPV4_PACKETS
, update_every
, RRDSET_TYPE_LINE
);
@@ -295,7 +299,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if(do_ip_fragsout) {
+ if(do_ip_fragsout == CONFIG_BOOLEAN_YES || (do_ip_fragsout == CONFIG_BOOLEAN_AUTO && (snmp_root.ip_FragOKs || snmp_root.ip_FragFails || snmp_root.ip_FragCreates))) {
+ do_ip_fragsout = CONFIG_BOOLEAN_YES;
+
static RRDSET *st = NULL;
static RRDDIM *rd_FragOKs = NULL,
*rd_FragFails = NULL,
@@ -310,9 +316,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
, NULL
, "IPv4 Fragments Sent"
, "packets/s"
- , "proc"
- , "net/snmp"
- , 3020
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP_NAME
+ , NETDATA_CHART_PRIO_IPV4_FRAGMENTS
, update_every
, RRDSET_TYPE_LINE
);
@@ -332,7 +338,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if(do_ip_fragsin) {
+ if(do_ip_fragsin == CONFIG_BOOLEAN_YES || (do_ip_fragsin == CONFIG_BOOLEAN_AUTO && (snmp_root.ip_ReasmOKs || snmp_root.ip_ReasmFails || snmp_root.ip_ReasmReqds))) {
+ do_ip_fragsin = CONFIG_BOOLEAN_YES;
+
static RRDSET *st = NULL;
static RRDDIM *rd_ReasmOKs = NULL,
*rd_ReasmFails = NULL,
@@ -347,9 +355,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
, NULL
, "IPv4 Fragments Reassembly"
, "packets/s"
- , "proc"
- , "net/snmp"
- , 3030
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP_NAME
+ , NETDATA_CHART_PRIO_IPV4_FRAGMENTS + 1
, update_every
, RRDSET_TYPE_LINE
);
@@ -369,7 +377,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if(do_ip_errors) {
+ if(do_ip_errors == CONFIG_BOOLEAN_YES || (do_ip_errors == CONFIG_BOOLEAN_AUTO && (snmp_root.ip_InDiscards || snmp_root.ip_OutDiscards || snmp_root.ip_InHdrErrors || snmp_root.ip_InAddrErrors || snmp_root.ip_InUnknownProtos || snmp_root.ip_OutNoRoutes))) {
+ do_ip_errors = CONFIG_BOOLEAN_YES;
+
static RRDSET *st = NULL;
static RRDDIM *rd_InDiscards = NULL,
*rd_OutDiscards = NULL,
@@ -387,9 +397,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
, NULL
, "IPv4 Errors"
, "packets/s"
- , "proc"
- , "net/snmp"
- , 2470
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP_NAME
+ , NETDATA_CHART_PRIO_IPV4_ERRORS
, update_every
, RRDSET_TYPE_LINE
);
@@ -437,7 +447,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if(do_icmp_packets) {
+ if(do_icmp_packets == CONFIG_BOOLEAN_YES || (do_icmp_packets == CONFIG_BOOLEAN_AUTO && (snmp_root.icmp_InMsgs || snmp_root.icmp_OutMsgs || snmp_root.icmp_InErrors || snmp_root.icmp_OutErrors || snmp_root.icmp_InCsumErrors))) {
+ do_icmp_packets = CONFIG_BOOLEAN_YES;
+
{
static RRDSET *st_packets = NULL;
static RRDDIM *rd_InMsgs = NULL,
@@ -452,9 +464,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
, NULL
, "IPv4 ICMP Packets"
, "packets/s"
- , "proc"
- , "net/snmp"
- , 2602
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP_NAME
+ , NETDATA_CHART_PRIO_IPV4_ICMP
, update_every
, RRDSET_TYPE_LINE
);
@@ -485,9 +497,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
, NULL
, "IPv4 ICMP Errors"
, "packets/s"
- , "proc"
- , "net/snmp"
- , 2603
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP_NAME
+ , NETDATA_CHART_PRIO_IPV4_ICMP + 1
, update_every
, RRDSET_TYPE_LINE
);
@@ -515,8 +527,8 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
}
words = procfile_linewords(ff, l);
- if(words < 3) {
- error("Cannot read /proc/net/snmp IcmpMsg line. Expected 3+ params, read %zu.", words);
+ if(words < 2) {
+ error("Cannot read /proc/net/snmp IcmpMsg line. Expected 2+ params, read %zu.", words);
continue;
}
@@ -528,7 +540,30 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if(do_icmpmsg) {
+ if(do_icmpmsg == CONFIG_BOOLEAN_YES || (do_icmpmsg == CONFIG_BOOLEAN_AUTO && (
+ snmp_root.icmpmsg_InEchoReps
+ || snmp_root.icmpmsg_OutEchoReps
+ || snmp_root.icmpmsg_InDestUnreachs
+ || snmp_root.icmpmsg_OutDestUnreachs
+ || snmp_root.icmpmsg_InRedirects
+ || snmp_root.icmpmsg_OutRedirects
+ || snmp_root.icmpmsg_InEchos
+ || snmp_root.icmpmsg_OutEchos
+ || snmp_root.icmpmsg_InRouterAdvert
+ || snmp_root.icmpmsg_OutRouterAdvert
+ || snmp_root.icmpmsg_InRouterSelect
+ || snmp_root.icmpmsg_OutRouterSelect
+ || snmp_root.icmpmsg_InTimeExcds
+ || snmp_root.icmpmsg_OutTimeExcds
+ || snmp_root.icmpmsg_InParmProbs
+ || snmp_root.icmpmsg_OutParmProbs
+ || snmp_root.icmpmsg_InTimestamps
+ || snmp_root.icmpmsg_OutTimestamps
+ || snmp_root.icmpmsg_InTimestampReps
+ || snmp_root.icmpmsg_OutTimestampReps
+ ))) {
+ do_icmpmsg = CONFIG_BOOLEAN_YES;
+
static RRDSET *st = NULL;
static RRDDIM *rd_InEchoReps = NULL,
*rd_OutEchoReps = NULL,
@@ -560,9 +595,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
, NULL
, "IPv4 ICMP Messages"
, "packets/s"
- , "proc"
- , "net/snmp"
- , 2604
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP_NAME
+ , NETDATA_CHART_PRIO_IPV4_ICMP + 2
, update_every
, RRDSET_TYPE_LINE
);
@@ -636,15 +671,15 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if(snmp_root.tcp_MaxConn != last_max_connections) {
- last_max_connections = snmp_root.tcp_MaxConn;
- rrdvar_custom_host_variable_set(localhost, tcp_max_connections_var, last_max_connections);
- }
+ // this is smart enough to update it, only when it is changed
+ rrdvar_custom_host_variable_set(localhost, tcp_max_connections_var, snmp_root.tcp_MaxConn);
// --------------------------------------------------------------------
// see http://net-snmp.sourceforge.net/docs/mibs/tcp.html
- if(do_tcp_sockets) {
+ if(do_tcp_sockets == CONFIG_BOOLEAN_YES || (do_tcp_sockets == CONFIG_BOOLEAN_AUTO && snmp_root.tcp_CurrEstab)) {
+ do_tcp_sockets = CONFIG_BOOLEAN_YES;
+
static RRDSET *st = NULL;
static RRDDIM *rd_CurrEstab = NULL;
@@ -657,9 +692,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
, NULL
, "IPv4 TCP Connections"
, "active connections"
- , "proc"
- , "net/snmp"
- , 2501
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP_NAME
+ , NETDATA_CHART_PRIO_IPV4_TCP
, update_every
, RRDSET_TYPE_LINE
);
@@ -674,7 +709,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if(do_tcp_packets) {
+ if(do_tcp_packets == CONFIG_BOOLEAN_YES || (do_tcp_packets == CONFIG_BOOLEAN_AUTO && (snmp_root.tcp_InSegs || snmp_root.tcp_OutSegs))) {
+ do_tcp_packets = CONFIG_BOOLEAN_YES;
+
static RRDSET *st = NULL;
static RRDDIM *rd_InSegs = NULL,
*rd_OutSegs = NULL;
@@ -688,9 +725,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
, NULL
, "IPv4 TCP Packets"
, "packets/s"
- , "proc"
- , "net/snmp"
- , 2510
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP_NAME
+ , NETDATA_CHART_PRIO_IPV4_TCP + 4
, update_every
, RRDSET_TYPE_LINE
);
@@ -707,7 +744,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if(do_tcp_errors) {
+ if(do_tcp_errors == CONFIG_BOOLEAN_YES || (do_tcp_errors == CONFIG_BOOLEAN_AUTO && (snmp_root.tcp_InErrs || snmp_root.tcp_InCsumErrors || snmp_root.tcp_RetransSegs))) {
+ do_tcp_errors = CONFIG_BOOLEAN_YES;
+
static RRDSET *st = NULL;
static RRDDIM *rd_InErrs = NULL,
*rd_InCsumErrors = NULL,
@@ -722,9 +761,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
, NULL
, "IPv4 TCP Errors"
, "packets/s"
- , "proc"
- , "net/snmp"
- , 2525
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP_NAME
+ , NETDATA_CHART_PRIO_IPV4_TCP + 20
, update_every
, RRDSET_TYPE_LINE
);
@@ -744,7 +783,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if(do_tcp_opens) {
+ if(do_tcp_opens == CONFIG_BOOLEAN_YES || (do_tcp_opens == CONFIG_BOOLEAN_AUTO && (snmp_root.tcp_ActiveOpens || snmp_root.tcp_PassiveOpens))) {
+ do_tcp_opens = CONFIG_BOOLEAN_YES;
+
static RRDSET *st = NULL;
static RRDDIM *rd_ActiveOpens = NULL,
*rd_PassiveOpens = NULL;
@@ -758,9 +799,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
, NULL
, "IPv4 TCP Opens"
, "connections/s"
- , "proc"
- , "net/snmp"
- , 2502
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP_NAME
+ , NETDATA_CHART_PRIO_IPV4_TCP + 5
, update_every
, RRDSET_TYPE_LINE
);
@@ -778,7 +819,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if(do_tcp_handshake) {
+ if(do_tcp_handshake == CONFIG_BOOLEAN_YES || (do_tcp_handshake == CONFIG_BOOLEAN_AUTO && (snmp_root.tcp_EstabResets || snmp_root.tcp_OutRsts || snmp_root.tcp_AttemptFails))) {
+ do_tcp_handshake = CONFIG_BOOLEAN_YES;
+
static RRDSET *st = NULL;
static RRDDIM *rd_EstabResets = NULL,
*rd_OutRsts = NULL,
@@ -794,25 +837,25 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
, NULL
, "IPv4 TCP Handshake Issues"
, "events/s"
- , "proc"
- , "net/snmp"
- , 2530
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP_NAME
+ , NETDATA_CHART_PRIO_IPV4_TCP + 30
, update_every
, RRDSET_TYPE_LINE
);
rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
- rd_EstabResets = rrddim_add(st, "EstabResets", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
- rd_OutRsts = rrddim_add(st, "OutRsts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
- rd_AttemptFails = rrddim_add(st, "AttemptFails", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
- rd_TCPSynRetrans = rrddim_add(st, "TCPSynRetrans", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_EstabResets = rrddim_add(st, "EstabResets", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_OutRsts = rrddim_add(st, "OutRsts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_AttemptFails = rrddim_add(st, "AttemptFails", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_TCPSynRetrans = rrddim_add(st, "TCPSynRetrans", "SynRetrans", 1, 1, RRD_ALGORITHM_INCREMENTAL);
}
else rrdset_next(st);
- rrddim_set_by_pointer(st, rd_EstabResets, (collected_number)snmp_root.tcp_EstabResets);
- rrddim_set_by_pointer(st, rd_OutRsts, (collected_number)snmp_root.tcp_OutRsts);
- rrddim_set_by_pointer(st, rd_AttemptFails, (collected_number)snmp_root.tcp_AttemptFails);
- rrddim_set_by_pointer(st, rd_TCPSynRetrans, tcpext_TCPSynRetrans);
+ rrddim_set_by_pointer(st, rd_EstabResets, (collected_number)snmp_root.tcp_EstabResets);
+ rrddim_set_by_pointer(st, rd_OutRsts, (collected_number)snmp_root.tcp_OutRsts);
+ rrddim_set_by_pointer(st, rd_AttemptFails, (collected_number)snmp_root.tcp_AttemptFails);
+ rrddim_set_by_pointer(st, rd_TCPSynRetrans, tcpext_TCPSynRetrans);
rrdset_done(st);
}
}
@@ -839,7 +882,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
// --------------------------------------------------------------------
// see http://net-snmp.sourceforge.net/docs/mibs/udp.html
- if(do_udp_packets) {
+ if(do_udp_packets == CONFIG_BOOLEAN_YES || (do_udp_packets == CONFIG_BOOLEAN_AUTO && (snmp_root.udp_InDatagrams || snmp_root.udp_OutDatagrams))) {
+ do_udp_packets = CONFIG_BOOLEAN_YES;
+
static RRDSET *st = NULL;
static RRDDIM *rd_InDatagrams = NULL,
*rd_OutDatagrams = NULL;
@@ -853,9 +898,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
, NULL
, "IPv4 UDP Packets"
, "packets/s"
- , "proc"
- , "net/snmp"
- , 2602
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP_NAME
+ , NETDATA_CHART_PRIO_IPV4_UDP
, update_every
, RRDSET_TYPE_LINE
);
@@ -872,7 +917,16 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if(do_udp_errors) {
+ if(do_udp_errors == CONFIG_BOOLEAN_YES || (do_udp_errors == CONFIG_BOOLEAN_AUTO && (
+ snmp_root.udp_InErrors
+ || snmp_root.udp_NoPorts
+ || snmp_root.udp_RcvbufErrors
+ || snmp_root.udp_SndbufErrors
+ || snmp_root.udp_InCsumErrors
+ || snmp_root.udp_IgnoredMulti
+ ))) {
+ do_udp_errors = CONFIG_BOOLEAN_YES;
+
static RRDSET *st = NULL;
static RRDDIM *rd_RcvbufErrors = NULL,
*rd_SndbufErrors = NULL,
@@ -890,9 +944,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
, NULL
, "IPv4 UDP Errors"
, "events/s"
- , "proc"
- , "net/snmp"
- , 2701
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP_NAME
+ , NETDATA_CHART_PRIO_IPV4_UDP + 10
, update_every
, RRDSET_TYPE_LINE
);
@@ -938,7 +992,18 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if(do_udplite_packets) {
+ if(do_udplite_packets == CONFIG_BOOLEAN_YES || (do_udplite_packets == CONFIG_BOOLEAN_AUTO && (
+ snmp_root.udplite_InDatagrams
+ || snmp_root.udplite_OutDatagrams
+ || snmp_root.udplite_NoPorts
+ || snmp_root.udplite_InErrors
+ || snmp_root.udplite_InCsumErrors
+ || snmp_root.udplite_RcvbufErrors
+ || snmp_root.udplite_SndbufErrors
+ || snmp_root.udplite_IgnoredMulti
+ ))) {
+ do_udplite_packets = CONFIG_BOOLEAN_YES;
+
{
static RRDSET *st = NULL;
static RRDDIM *rd_InDatagrams = NULL,
@@ -953,9 +1018,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
, NULL
, "IPv4 UDPLite Packets"
, "packets/s"
- , "proc"
- , "net/snmp"
- , 2603
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP_NAME
+ , NETDATA_CHART_PRIO_IPV4_UDPLITE
, update_every
, RRDSET_TYPE_LINE
);
@@ -988,9 +1053,9 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
, NULL
, "IPv4 UDPLite Errors"
, "packets/s"
- , "proc"
- , "net/snmp"
- , 2604
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP_NAME
+ , NETDATA_CHART_PRIO_IPV4_UDPLITE + 10
, update_every
, RRDSET_TYPE_LINE);
diff --git a/src/proc_net_snmp6.c b/collectors/proc.plugin/proc_net_snmp6.c
index bd71b391a..f0084aa26 100644
--- a/src/proc_net_snmp6.c
+++ b/collectors/proc.plugin/proc_net_snmp6.c
@@ -1,6 +1,9 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
#define RRD_TYPE_NET_SNMP6 "ipv6"
+#define PLUGIN_PROC_MODULE_NET_SNMP6_NAME "/proc/net/snmp6"
int do_proc_net_snmp6(int update_every, usec_t dt) {
(void)dt;
@@ -289,9 +292,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 Bandwidth"
, "kilobits/s"
- , "proc"
- , "net/snmp6"
- , 502
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_SYSTEM_IPV6
, update_every
, RRDSET_TYPE_AREA
);
@@ -325,9 +328,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 Packets"
, "packets/s"
- , "proc"
- , "net/snmp6"
- , 3000
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_PACKETS
, update_every
, RRDSET_TYPE_LINE
);
@@ -364,9 +367,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 Fragments Sent"
, "packets/s"
- , "proc"
- , "net/snmp6"
- , 3011
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_FRAGSOUT
, update_every
, RRDSET_TYPE_LINE
);
@@ -410,9 +413,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 Fragments Reassembly"
, "packets/s"
- , "proc"
- , "net/snmp6"
- , 3012
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_FRAGSIN
, update_every
, RRDSET_TYPE_LINE);
rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
@@ -465,9 +468,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 Errors"
, "packets/s"
- , "proc"
- , "net/snmp6"
- , 3002
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_ERRORS
, update_every
, RRDSET_TYPE_LINE
);
@@ -514,9 +517,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 UDP Packets"
, "packets/s"
- , "proc"
- , "net/snmp6"
- , 3601
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_UDP_PACKETS
, update_every
, RRDSET_TYPE_LINE
);
@@ -560,9 +563,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 UDP Errors"
, "events/s"
- , "proc"
- , "net/snmp6"
- , 3701
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_UDP_ERRORS
, update_every
, RRDSET_TYPE_LINE
);
@@ -603,9 +606,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 UDPlite Packets"
, "packets/s"
- , "proc"
- , "net/snmp6"
- , 3602
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_UDPLITE_PACKETS
, update_every
, RRDSET_TYPE_LINE
);
@@ -648,9 +651,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 UDP Lite Errors"
, "events/s"
- , "proc"
- , "net/snmp6"
- , 3701
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_UDPLITE_ERRORS
, update_every
, RRDSET_TYPE_LINE
);
@@ -689,9 +692,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 Multicast Bandwidth"
, "kilobits/s"
- , "proc"
- , "net/snmp6"
- , 9000
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_MCAST
, update_every
, RRDSET_TYPE_AREA
);
@@ -724,9 +727,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 Broadcast Bandwidth"
, "kilobits/s"
- , "proc"
- , "net/snmp6"
- , 8000
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_BCAST
, update_every
, RRDSET_TYPE_AREA
);
@@ -759,9 +762,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 Multicast Packets"
, "packets/s"
- , "proc"
- , "net/snmp6"
- , 9500
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_MCAST_PACKETS
, update_every
, RRDSET_TYPE_LINE
);
@@ -794,9 +797,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 ICMP Messages"
, "messages/s"
- , "proc"
- , "net/snmp6"
- , 10000
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_ICMP
, update_every
, RRDSET_TYPE_LINE
);
@@ -828,9 +831,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 ICMP Redirects"
, "redirects/s"
- , "proc"
- , "net/snmp6"
- , 10050
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_ICMP_REDIR
, update_every
, RRDSET_TYPE_LINE
);
@@ -884,9 +887,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 ICMP Errors"
, "errors/s"
- , "proc"
- , "net/snmp6"
- , 10100
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_ICMP_ERRORS
, update_every
, RRDSET_TYPE_LINE
);
@@ -944,9 +947,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 ICMP Echo"
, "messages/s"
- , "proc"
- , "net/snmp6"
- , 10200
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_ICMP_ECHOS
, update_every
, RRDSET_TYPE_LINE
);
@@ -994,9 +997,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 ICMP Group Membership"
, "messages/s"
- , "proc"
- , "net/snmp6"
- , 10300
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_ICMP_GROUPMEMB
, update_every
, RRDSET_TYPE_LINE);
@@ -1043,9 +1046,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 Router Messages"
, "messages/s"
- , "proc"
- , "net/snmp6"
- , 10400
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_ICMP_ROUTER
, update_every
, RRDSET_TYPE_LINE
);
@@ -1089,9 +1092,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 Neighbor Messages"
, "messages/s"
- , "proc"
- , "net/snmp6"
- , 10500
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_ICMP_NEIGHBOR
, update_every
, RRDSET_TYPE_LINE
);
@@ -1127,9 +1130,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 ICMP MLDv2 Reports"
, "reports/s"
- , "proc"
- , "net/snmp6"
- , 10600
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_ICMP_LDV2
, update_every
, RRDSET_TYPE_LINE
);
@@ -1181,9 +1184,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 ICMP Types"
, "messages/s"
- , "proc"
- , "net/snmp6"
- , 10700
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_ICMP_TYPES
, update_every
, RRDSET_TYPE_LINE
);
@@ -1239,9 +1242,9 @@ int do_proc_net_snmp6(int update_every, usec_t dt) {
, NULL
, "IPv6 ECT Packets"
, "packets/s"
- , "proc"
- , "net/snmp6"
- , 10800
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SNMP6_NAME
+ , NETDATA_CHART_PRIO_IPV6_ECT
, update_every
, RRDSET_TYPE_LINE
);
diff --git a/src/proc_net_sockstat.c b/collectors/proc.plugin/proc_net_sockstat.c
index db3070660..0c3b6e196 100644
--- a/src/proc_net_sockstat.c
+++ b/collectors/proc.plugin/proc_net_sockstat.c
@@ -1,4 +1,8 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
+
+#define PLUGIN_PROC_MODULE_NET_SOCKSTAT_NAME "/proc/net/sockstat"
static struct proc_net_sockstat {
kernel_uint_t sockets_used;
@@ -56,9 +60,9 @@ static int read_tcp_mem(void) {
// fprintf(stderr, "TCP MEM low = %llu, pressure = %llu, high = %llu\n", low, pressure, high);
- rrdvar_custom_host_variable_set(localhost, tcp_mem_low_threshold, low * sysconf(_SC_PAGESIZE) / 1024);
- rrdvar_custom_host_variable_set(localhost, tcp_mem_pressure_threshold, pressure * sysconf(_SC_PAGESIZE) / 1024);
- rrdvar_custom_host_variable_set(localhost, tcp_mem_high_threshold, high * sysconf(_SC_PAGESIZE) / 1024);
+ rrdvar_custom_host_variable_set(localhost, tcp_mem_low_threshold, low * sysconf(_SC_PAGESIZE) / 1024.0);
+ rrdvar_custom_host_variable_set(localhost, tcp_mem_pressure_threshold, pressure * sysconf(_SC_PAGESIZE) / 1024.0);
+ rrdvar_custom_host_variable_set(localhost, tcp_mem_high_threshold, high * sysconf(_SC_PAGESIZE) / 1024.0);
return 0;
}
@@ -229,9 +233,9 @@ int do_proc_net_sockstat(int update_every, usec_t dt) {
, NULL
, "IPv4 Sockets Used"
, "sockets"
- , "proc"
- , "net/sockstat"
- , 2400
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SOCKSTAT_NAME
+ , NETDATA_CHART_PRIO_IPV4_SOCKETS
, update_every
, RRDSET_TYPE_LINE
);
@@ -264,9 +268,9 @@ int do_proc_net_sockstat(int update_every, usec_t dt) {
, NULL
, "IPv4 TCP Sockets"
, "sockets"
- , "proc"
- , "net/sockstat"
- , 2500
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SOCKSTAT_NAME
+ , NETDATA_CHART_PRIO_IPV4_TCP_SOCKETS
, update_every
, RRDSET_TYPE_LINE
);
@@ -302,9 +306,9 @@ int do_proc_net_sockstat(int update_every, usec_t dt) {
, NULL
, "IPv4 TCP Sockets Memory"
, "KB"
- , "proc"
- , "net/sockstat"
- , 4000
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SOCKSTAT_NAME
+ , NETDATA_CHART_PRIO_IPV4_TCP_MEM
, update_every
, RRDSET_TYPE_AREA
);
@@ -334,9 +338,9 @@ int do_proc_net_sockstat(int update_every, usec_t dt) {
, NULL
, "IPv4 UDP Sockets"
, "sockets"
- , "proc"
- , "net/sockstat"
- , 2600
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SOCKSTAT_NAME
+ , NETDATA_CHART_PRIO_IPV4_UDP
, update_every
, RRDSET_TYPE_LINE
);
@@ -366,9 +370,9 @@ int do_proc_net_sockstat(int update_every, usec_t dt) {
, NULL
, "IPv4 UDP Sockets Memory"
, "KB"
- , "proc"
- , "net/sockstat"
- , 2603
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SOCKSTAT_NAME
+ , NETDATA_CHART_PRIO_IPV4_UDP_MEM
, update_every
, RRDSET_TYPE_AREA
);
@@ -398,9 +402,9 @@ int do_proc_net_sockstat(int update_every, usec_t dt) {
, NULL
, "IPv4 UDPLITE Sockets"
, "sockets"
- , "proc"
- , "net/sockstat"
- , 2602
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SOCKSTAT_NAME
+ , NETDATA_CHART_PRIO_IPV4_UDPLITE
, update_every
, RRDSET_TYPE_LINE
);
@@ -430,9 +434,9 @@ int do_proc_net_sockstat(int update_every, usec_t dt) {
, NULL
, "IPv4 RAW Sockets"
, "sockets"
- , "proc"
- , "net/sockstat"
- , 3010
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SOCKSTAT_NAME
+ , NETDATA_CHART_PRIO_IPV4_RAW
, update_every
, RRDSET_TYPE_LINE
);
@@ -462,9 +466,9 @@ int do_proc_net_sockstat(int update_every, usec_t dt) {
, NULL
, "IPv4 FRAG Sockets"
, "fragments"
- , "proc"
- , "net/sockstat"
- , 3010
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SOCKSTAT_NAME
+ , NETDATA_CHART_PRIO_IPV4_FRAGMENTS
, update_every
, RRDSET_TYPE_LINE
);
@@ -494,9 +498,9 @@ int do_proc_net_sockstat(int update_every, usec_t dt) {
, NULL
, "IPv4 FRAG Sockets Memory"
, "KB"
- , "proc"
- , "net/sockstat"
- , 3020
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SOCKSTAT_NAME
+ , NETDATA_CHART_PRIO_IPV4_FRAGMENTS_MEM
, update_every
, RRDSET_TYPE_AREA
);
diff --git a/src/proc_net_sockstat6.c b/collectors/proc.plugin/proc_net_sockstat6.c
index 97175ccf7..687b9bdeb 100644
--- a/src/proc_net_sockstat6.c
+++ b/collectors/proc.plugin/proc_net_sockstat6.c
@@ -1,4 +1,8 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
+
+#define PLUGIN_PROC_MODULE_NET_SOCKSTAT6_NAME "/proc/net/sockstat6"
static struct proc_net_sockstat6 {
kernel_uint_t tcp6_inuse;
@@ -122,9 +126,9 @@ int do_proc_net_sockstat6(int update_every, usec_t dt) {
, NULL
, "IPv6 TCP Sockets"
, "sockets"
- , "proc"
- , "net/sockstat6"
- , 3599
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SOCKSTAT6_NAME
+ , NETDATA_CHART_PRIO_IPV6_TCP
, update_every
, RRDSET_TYPE_LINE
);
@@ -154,9 +158,9 @@ int do_proc_net_sockstat6(int update_every, usec_t dt) {
, NULL
, "IPv6 UDP Sockets"
, "sockets"
- , "proc"
- , "net/sockstat6"
- , 3600
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SOCKSTAT6_NAME
+ , NETDATA_CHART_PRIO_IPV6_UDP
, update_every
, RRDSET_TYPE_LINE
);
@@ -186,9 +190,9 @@ int do_proc_net_sockstat6(int update_every, usec_t dt) {
, NULL
, "IPv6 UDPLITE Sockets"
, "sockets"
- , "proc"
- , "net/sockstat6"
- , 3601
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SOCKSTAT6_NAME
+ , NETDATA_CHART_PRIO_IPV6_UDPLITE
, update_every
, RRDSET_TYPE_LINE
);
@@ -218,9 +222,9 @@ int do_proc_net_sockstat6(int update_every, usec_t dt) {
, NULL
, "IPv6 RAW Sockets"
, "sockets"
- , "proc"
- , "net/sockstat6"
- , 3700
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SOCKSTAT6_NAME
+ , NETDATA_CHART_PRIO_IPV6_RAW
, update_every
, RRDSET_TYPE_LINE
);
@@ -250,9 +254,9 @@ int do_proc_net_sockstat6(int update_every, usec_t dt) {
, NULL
, "IPv6 FRAG Sockets"
, "fragments"
- , "proc"
- , "net/sockstat6"
- , 3010
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SOCKSTAT6_NAME
+ , NETDATA_CHART_PRIO_IPV6_FRAGMENTS
, update_every
, RRDSET_TYPE_LINE
);
diff --git a/src/proc_net_softnet_stat.c b/collectors/proc.plugin/proc_net_softnet_stat.c
index f3c117e16..7ec783e77 100644
--- a/src/proc_net_softnet_stat.c
+++ b/collectors/proc.plugin/proc_net_softnet_stat.c
@@ -1,4 +1,8 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
+
+#define PLUGIN_PROC_MODULE_NET_SOFTNET_NAME "/proc/net/softnet_stat"
static inline char *softnet_column_name(size_t column) {
switch(column) {
@@ -87,9 +91,9 @@ int do_proc_net_softnet_stat(int update_every, usec_t dt) {
, "system.softnet_stat"
, "System softnet_stat"
, "events/s"
- , "proc"
- , "net/softnet_stat"
- , 955
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SOFTNET_NAME
+ , NETDATA_CHART_PRIO_SYSTEM_SOFTNET_STAT
, update_every
, RRDSET_TYPE_LINE
);
@@ -123,9 +127,9 @@ int do_proc_net_softnet_stat(int update_every, usec_t dt) {
, "cpu.softnet_stat"
, title
, "events/s"
- , "proc"
- , "net/softnet_stat"
- , 4101 + l
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_NET_SOFTNET_NAME
+ , NETDATA_CHART_PRIO_SOFTNET_PER_CORE + l
, update_every
, RRDSET_TYPE_LINE
);
diff --git a/src/proc_net_stat_conntrack.c b/collectors/proc.plugin/proc_net_stat_conntrack.c
index 363fbc199..f5257c0a0 100644
--- a/src/proc_net_stat_conntrack.c
+++ b/collectors/proc.plugin/proc_net_stat_conntrack.c
@@ -1,7 +1,10 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
#define RRD_TYPE_NET_STAT_NETFILTER "netfilter"
#define RRD_TYPE_NET_STAT_CONNTRACK "conntrack"
+#define PLUGIN_PROC_MODULE_CONNTRACK_NAME "/proc/net/stat/nf_conntrack"
int do_proc_net_stat_conntrack(int update_every, usec_t dt) {
static procfile *ff = NULL;
@@ -140,9 +143,9 @@ int do_proc_net_stat_conntrack(int update_every, usec_t dt) {
, NULL
, "Connection Tracker Connections"
, "active connections"
- , "proc"
- , "net/stat/nf_conntrack"
- , 3000
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_CONNTRACK_NAME
+ , NETDATA_CHART_PRIO_NETFILTER_SOCKETS
, update_every
, RRDSET_TYPE_LINE
);
@@ -173,9 +176,9 @@ int do_proc_net_stat_conntrack(int update_every, usec_t dt) {
, NULL
, "Connection Tracker New Connections"
, "connections/s"
- , "proc"
- , "net/stat/nf_conntrack"
- , 3001
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_CONNTRACK_NAME
+ , NETDATA_CHART_PRIO_NETFILTER_NEW
, update_every
, RRDSET_TYPE_LINE
);
@@ -210,9 +213,9 @@ int do_proc_net_stat_conntrack(int update_every, usec_t dt) {
, NULL
, "Connection Tracker Changes"
, "changes/s"
- , "proc"
- , "net/stat/nf_conntrack"
- , 3002
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_CONNTRACK_NAME
+ , NETDATA_CHART_PRIO_NETFILTER_CHANGES
, update_every
, RRDSET_TYPE_LINE
);
@@ -247,9 +250,9 @@ int do_proc_net_stat_conntrack(int update_every, usec_t dt) {
, NULL
, "Connection Tracker Expectations"
, "expectations/s"
- , "proc"
- , "net/stat/nf_conntrack"
- , 3003
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_CONNTRACK_NAME
+ , NETDATA_CHART_PRIO_NETFILTER_EXPECT
, update_every
, RRDSET_TYPE_LINE
);
@@ -284,9 +287,9 @@ int do_proc_net_stat_conntrack(int update_every, usec_t dt) {
, NULL
, "Connection Tracker Searches"
, "searches/s"
- , "proc"
- , "net/stat/nf_conntrack"
- , 3010
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_CONNTRACK_NAME
+ , NETDATA_CHART_PRIO_NETFILTER_SEARCH
, update_every
, RRDSET_TYPE_LINE
);
@@ -322,9 +325,9 @@ int do_proc_net_stat_conntrack(int update_every, usec_t dt) {
, NULL
, "Connection Tracker Errors"
, "events/s"
- , "proc"
- , "net/stat/nf_conntrack"
- , 3005
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_CONNTRACK_NAME
+ , NETDATA_CHART_PRIO_NETFILTER_ERRORS
, update_every
, RRDSET_TYPE_LINE
);
diff --git a/src/proc_net_stat_synproxy.c b/collectors/proc.plugin/proc_net_stat_synproxy.c
index 0d6f6ee03..f0c1f47c1 100644
--- a/src/proc_net_stat_synproxy.c
+++ b/collectors/proc.plugin/proc_net_stat_synproxy.c
@@ -1,4 +1,8 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
+
+#define PLUGIN_PROC_MODULE_SYNPROXY_NAME "/proc/net/stat/synproxy"
#define RRD_TYPE_NET_STAT_NETFILTER "netfilter"
#define RRD_TYPE_NET_STAT_SYNPROXY "synproxy"
@@ -68,9 +72,9 @@ int do_proc_net_stat_synproxy(int update_every, usec_t dt) {
, NULL
, "SYNPROXY Entries Used"
, "entries"
- , "proc"
- , "net/stat/synproxy"
- , 3304
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_SYNPROXY_NAME
+ , NETDATA_CHART_PRIO_SYNPROXY_ENTRIES
, update_every
, RRDSET_TYPE_LINE
);
@@ -98,9 +102,9 @@ int do_proc_net_stat_synproxy(int update_every, usec_t dt) {
, NULL
, "SYNPROXY SYN Packets received"
, "SYN/s"
- , "proc"
- , "net/stat/synproxy"
- , 3301
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_SYNPROXY_NAME
+ , NETDATA_CHART_PRIO_SYNPROXY_SYN_RECEIVED
, update_every
, RRDSET_TYPE_LINE
);
@@ -128,9 +132,9 @@ int do_proc_net_stat_synproxy(int update_every, usec_t dt) {
, NULL
, "SYNPROXY Connections Reopened"
, "connections/s"
- , "proc"
- , "net/stat/synproxy"
- , 3303
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_SYNPROXY_NAME
+ , NETDATA_CHART_PRIO_SYNPROXY_CONN_OPEN
, update_every
, RRDSET_TYPE_LINE
);
@@ -158,9 +162,9 @@ int do_proc_net_stat_synproxy(int update_every, usec_t dt) {
, NULL
, "SYNPROXY TCP Cookies"
, "cookies/s"
- , "proc"
- , "net/stat/synproxy"
- , 3302
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_SYNPROXY_NAME
+ , NETDATA_CHART_PRIO_SYNPROXY_COOKIES
, update_every
, RRDSET_TYPE_LINE
);
diff --git a/src/proc_self_mountinfo.c b/collectors/proc.plugin/proc_self_mountinfo.c
index 4ccdddff1..3f17ccce2 100644
--- a/src/proc_self_mountinfo.c
+++ b/collectors/proc.plugin/proc_self_mountinfo.c
@@ -1,4 +1,6 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
// ----------------------------------------------------------------------------
// taken from gnulib/mountlist.c
diff --git a/src/proc_self_mountinfo.h b/collectors/proc.plugin/proc_self_mountinfo.h
index a8d337539..15d63c786 100644
--- a/src/proc_self_mountinfo.h
+++ b/collectors/proc.plugin/proc_self_mountinfo.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
#ifndef NETDATA_PROC_SELF_MOUNTINFO_H
#define NETDATA_PROC_SELF_MOUNTINFO_H 1
diff --git a/src/proc_softirqs.c b/collectors/proc.plugin/proc_softirqs.c
index cd7440b00..d68c69bb7 100644
--- a/src/proc_softirqs.c
+++ b/collectors/proc.plugin/proc_softirqs.c
@@ -1,4 +1,8 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
+
+#define PLUGIN_PROC_MODULE_SOFTIRQS_NAME "/proc/softirqs"
#define MAX_INTERRUPT_NAME 50
@@ -51,15 +55,16 @@ static inline struct interrupt *get_interrupts_array(size_t lines, int cpus) {
int do_proc_softirqs(int update_every, usec_t dt) {
(void)dt;
static procfile *ff = NULL;
- static int cpus = -1, do_per_core = -1;
+ static int cpus = -1, do_per_core = CONFIG_BOOLEAN_INVALID;
struct interrupt *irrs = NULL;
- if(unlikely(do_per_core == -1)) do_per_core = config_get_boolean("plugin:proc:/proc/softirqs", "interrupts per core", 1);
+ if(unlikely(do_per_core == CONFIG_BOOLEAN_INVALID))
+ do_per_core = config_get_boolean_ondemand("plugin:proc:/proc/softirqs", "interrupts per core", CONFIG_BOOLEAN_AUTO);
if(unlikely(!ff)) {
char filename[FILENAME_MAX + 1];
snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/softirqs");
- ff = procfile_open(config_get("plugin:proc:/proc/softirqs", "filename to monitor", filename), " \t", PROCFILE_FLAG_DEFAULT);
+ ff = procfile_open(config_get("plugin:proc:/proc/softirqs", "filename to monitor", filename), " \t:", PROCFILE_FLAG_DEFAULT);
if(unlikely(!ff)) return 1;
}
@@ -105,10 +110,6 @@ int do_proc_softirqs(int update_every, usec_t dt) {
irr->id = procfile_lineword(ff, l, 0);
if(unlikely(!irr->id || !irr->id[0])) continue;
- size_t idlen = strlen(irr->id);
- if(unlikely(idlen && irr->id[idlen - 1] == ':'))
- irr->id[idlen - 1] = '\0';
-
int c;
for(c = 0; c < cpus ;c++) {
if(likely((c + 1) < (int)words))
@@ -136,9 +137,9 @@ int do_proc_softirqs(int update_every, usec_t dt) {
, NULL
, "System softirqs"
, "softirqs/s"
- , "proc"
- , "softirqs"
- , 950
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_SOFTIRQS_NAME
+ , NETDATA_CHART_PRIO_SYSTEM_SOFTIRQS
, update_every
, RRDSET_TYPE_STACKED
);
@@ -148,34 +149,30 @@ int do_proc_softirqs(int update_every, usec_t dt) {
for(l = 0; l < lines ;l++) {
struct interrupt *irr = irrindex(irrs, l, cpus);
- if(unlikely(!irr->used)) continue;
-
- // some interrupt may have changed without changing the total number of lines
- // if the same number of interrupts have been added and removed between two
- // calls of this function.
- if(unlikely(!irr->rd || strncmp(irr->name, irr->rd->name, MAX_INTERRUPT_NAME) != 0)) {
- irr->rd = rrddim_find(st_system_softirqs, irr->id);
-
- if(unlikely(!irr->rd))
+ if(irr->used && irr->total) {
+ // some interrupt may have changed without changing the total number of lines
+ // if the same number of interrupts have been added and removed between two
+ // calls of this function.
+ if(unlikely(!irr->rd || strncmp(irr->name, irr->rd->name, MAX_INTERRUPT_NAME) != 0)) {
irr->rd = rrddim_add(st_system_softirqs, irr->id, irr->name, 1, 1, RRD_ALGORITHM_INCREMENTAL);
- else
rrddim_set_name(st_system_softirqs, irr->rd, irr->name);
- // also reset per cpu RRDDIMs to avoid repeating strncmp() in the per core loop
- if(likely(do_per_core)) {
- int c;
- for (c = 0; c < cpus ;c++) irr->cpu[c].rd = NULL;
+ // also reset per cpu RRDDIMs to avoid repeating strncmp() in the per core loop
+ if(likely(do_per_core != CONFIG_BOOLEAN_NO)) {
+ int c;
+ for(c = 0; c < cpus; c++) irr->cpu[c].rd = NULL;
+ }
}
- }
- rrddim_set_by_pointer(st_system_softirqs, irr->rd, irr->total);
+ rrddim_set_by_pointer(st_system_softirqs, irr->rd, irr->total);
+ }
}
rrdset_done(st_system_softirqs);
// --------------------------------------------------------------------
- if(do_per_core) {
+ if(do_per_core != CONFIG_BOOLEAN_NO) {
static RRDSET **core_st = NULL;
static int old_cpus = 0;
@@ -214,9 +211,9 @@ int do_proc_softirqs(int update_every, usec_t dt) {
, "cpu.softirqs"
, title
, "softirqs/s"
- , "proc"
- , "softirqs"
- , 3000 + c
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_SOFTIRQS_NAME
+ , NETDATA_CHART_PRIO_SOFTIRQS_PER_CORE + c
, update_every
, RRDSET_TYPE_STACKED
);
@@ -227,18 +224,14 @@ int do_proc_softirqs(int update_every, usec_t dt) {
for(l = 0; l < lines ;l++) {
struct interrupt *irr = irrindex(irrs, l, cpus);
- if(unlikely(!irr->used)) continue;
-
- if(unlikely(!irr->cpu[c].rd)) {
- irr->cpu[c].rd = rrddim_find(core_st[c], irr->id);
-
- if(unlikely(!irr->cpu[c].rd))
+ if(irr->used && (do_per_core == CONFIG_BOOLEAN_YES || irr->cpu[c].value)) {
+ if(unlikely(!irr->cpu[c].rd)) {
irr->cpu[c].rd = rrddim_add(core_st[c], irr->id, irr->name, 1, 1, RRD_ALGORITHM_INCREMENTAL);
- else
rrddim_set_name(core_st[c], irr->cpu[c].rd, irr->name);
- }
+ }
- rrddim_set_by_pointer(core_st[c], irr->cpu[c].rd, irr->cpu[c].value);
+ rrddim_set_by_pointer(core_st[c], irr->cpu[c].rd, irr->cpu[c].value);
+ }
}
rrdset_done(core_st[c]);
diff --git a/src/proc_spl_kstat_zfs.c b/collectors/proc.plugin/proc_spl_kstat_zfs.c
index 9d489d8e4..a96b236cb 100644
--- a/src/proc_spl_kstat_zfs.c
+++ b/collectors/proc.plugin/proc_spl_kstat_zfs.c
@@ -1,4 +1,6 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
#include "zfs_common.h"
#define ZFS_PROC_ARCSTATS "/proc/spl/kstat/zfs/arcstats"
@@ -146,8 +148,8 @@ int do_proc_spl_kstat_zfs_arcstats(int update_every, usec_t dt) {
if(unlikely(arcstats.l2exist == -1))
arcstats.l2exist = 0;
- generate_charts_arcstats("proc", update_every);
- generate_charts_arc_summary("proc", update_every);
+ generate_charts_arcstats(PLUGIN_PROC_NAME, ZFS_PROC_ARCSTATS, update_every);
+ generate_charts_arc_summary(PLUGIN_PROC_NAME, ZFS_PROC_ARCSTATS, update_every);
return 0;
}
diff --git a/src/proc_stat.c b/collectors/proc.plugin/proc_stat.c
index d1aefb73e..fb77df647 100644
--- a/src/proc_stat.c
+++ b/collectors/proc.plugin/proc_stat.c
@@ -1,7 +1,11 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
+
+#define PLUGIN_PROC_MODULE_STAT_NAME "/proc/stat"
struct per_core_single_number_file {
- char found:1;
+ unsigned char found:1;
const char *filename;
int fd;
collected_number value;
@@ -121,6 +125,8 @@ int do_proc_stat(int update_every, usec_t dt) {
static int do_cpu = -1, do_cpu_cores = -1, do_interrupts = -1, do_context = -1, do_forks = -1, do_processes = -1, do_core_throttle_count = -1, do_package_throttle_count = -1, do_scaling_cur_freq = -1;
static uint32_t hash_intr, hash_ctxt, hash_processes, hash_procs_running, hash_procs_blocked;
static char *core_throttle_count_filename = NULL, *package_throttle_count_filename = NULL, *scaling_cur_freq_filename = NULL;
+ static RRDVAR *cpus_var = NULL;
+ size_t cores_found = (size_t)processors;
if(unlikely(do_cpu == -1)) {
do_cpu = config_get_boolean("plugin:proc:/proc/stat", "cpu utilization", CONFIG_BOOLEAN_YES);
@@ -196,6 +202,7 @@ int do_proc_stat(int update_every, usec_t dt) {
}
size_t core = (row_key[3] == '\0') ? 0 : str2ul(&row_key[3]) + 1;
+ if(core > 0) cores_found = core;
if(likely((core == 0 && do_cpu) || (core > 0 && do_cpu_cores))) {
char *id;
@@ -236,17 +243,17 @@ int do_proc_stat(int update_every, usec_t dt) {
type = "system";
context = "system.cpu";
family = id;
- priority = 100;
+ priority = NETDATA_CHART_PRIO_SYSTEM_CPU;
}
else {
title = "Core utilization";
type = "cpu";
context = "cpu.cpu";
family = "utilization";
- priority = 1000;
+ priority = NETDATA_CHART_PRIO_CPU_PER_CORE;
- // FIXME: check for /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
- // FIXME: check for /sys/devices/system/cpu/cpu*/cpufreq/stats/time_in_state
+ // TODO: check for /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
+ // TODO: check for /sys/devices/system/cpu/cpu*/cpufreq/stats/time_in_state
char filename[FILENAME_MAX + 1];
struct stat stbuf;
@@ -287,9 +294,9 @@ int do_proc_stat(int update_every, usec_t dt) {
, context
, title
, "percentage"
- , "proc"
- , "stat"
- , priority
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_STAT_NAME
+ , priority + core
, update_every
, RRDSET_TYPE_STACKED
);
@@ -308,6 +315,9 @@ int do_proc_stat(int update_every, usec_t dt) {
cpu_chart->rd_iowait = rrddim_add(cpu_chart->st, "iowait", NULL, multiplier, divisor, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
cpu_chart->rd_idle = rrddim_add(cpu_chart->st, "idle", NULL, multiplier, divisor, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
rrddim_hide(cpu_chart->st, "idle");
+
+ if(unlikely(core == 0 && cpus_var == NULL))
+ cpus_var = rrdvar_custom_host_variable_create(localhost, "active_processors");
}
else rrdset_next(cpu_chart->st);
@@ -339,9 +349,9 @@ int do_proc_stat(int update_every, usec_t dt) {
, NULL
, "CPU Interrupts"
, "interrupts/s"
- , "proc"
- , "stat"
- , 900
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_STAT_NAME
+ , NETDATA_CHART_PRIO_SYSTEM_INTR
, update_every
, RRDSET_TYPE_LINE
);
@@ -371,9 +381,9 @@ int do_proc_stat(int update_every, usec_t dt) {
, NULL
, "CPU Context Switches"
, "context switches/s"
- , "proc"
- , "stat"
- , 800
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_STAT_NAME
+ , NETDATA_CHART_PRIO_SYSTEM_CTXT
, update_every
, RRDSET_TYPE_LINE
);
@@ -412,9 +422,9 @@ int do_proc_stat(int update_every, usec_t dt) {
, NULL
, "Started Processes"
, "processes/s"
- , "proc"
- , "stat"
- , 700
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_STAT_NAME
+ , NETDATA_CHART_PRIO_SYSTEM_FORKS
, update_every
, RRDSET_TYPE_LINE
);
@@ -444,9 +454,9 @@ int do_proc_stat(int update_every, usec_t dt) {
, NULL
, "System Processes"
, "processes"
- , "proc"
- , "stat"
- , 600
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_STAT_NAME
+ , NETDATA_CHART_PRIO_SYSTEM_PROCESSES
, update_every
, RRDSET_TYPE_LINE
);
@@ -478,9 +488,9 @@ int do_proc_stat(int update_every, usec_t dt) {
, "cpu.core_throttling"
, "Core Thermal Throttling Events"
, "events/s"
- , "proc"
- , "stat"
- , 5001
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_STAT_NAME
+ , NETDATA_CHART_PRIO_CORE_THROTTLING
, update_every
, RRDSET_TYPE_LINE
);
@@ -508,9 +518,9 @@ int do_proc_stat(int update_every, usec_t dt) {
, "cpu.package_throttling"
, "Package Thermal Throttling Events"
, "events/s"
- , "proc"
- , "stat"
- , 5002
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_STAT_NAME
+ , NETDATA_CHART_PRIO_PACKAGE_THROTTLING
, update_every
, RRDSET_TYPE_LINE
);
@@ -538,8 +548,8 @@ int do_proc_stat(int update_every, usec_t dt) {
, "cpu.scaling_cur_freq"
, "Per CPU Core, Current CPU Scaling Frequency"
, "MHz"
- , "proc"
- , "stat"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_STAT_NAME
, 5003
, update_every
, RRDSET_TYPE_LINE
@@ -553,5 +563,8 @@ int do_proc_stat(int update_every, usec_t dt) {
}
}
+ if(cpus_var)
+ rrdvar_custom_host_variable_set(localhost, cpus_var, cores_found);
+
return 0;
}
diff --git a/src/proc_sys_kernel_random_entropy_avail.c b/collectors/proc.plugin/proc_sys_kernel_random_entropy_avail.c
index ca4d7657c..20d2116ce 100644
--- a/src/proc_sys_kernel_random_entropy_avail.c
+++ b/collectors/proc.plugin/proc_sys_kernel_random_entropy_avail.c
@@ -1,4 +1,6 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
int do_proc_sys_kernel_random_entropy_avail(int update_every, usec_t dt) {
(void)dt;
@@ -29,9 +31,9 @@ int do_proc_sys_kernel_random_entropy_avail(int update_every, usec_t dt) {
, NULL
, "Available Entropy"
, "entropy"
- , "proc"
- , "sys/kernel/random/entropy_avail"
- , 1000
+ , PLUGIN_PROC_NAME
+ , "/proc/sys/kernel/random/entropy_avail"
+ , NETDATA_CHART_PRIO_SYSTEM_ENTROPY
, update_every
, RRDSET_TYPE_LINE
);
diff --git a/src/proc_uptime.c b/collectors/proc.plugin/proc_uptime.c
index 259de4760..142ae2d0c 100644
--- a/src/proc_uptime.c
+++ b/collectors/proc.plugin/proc_uptime.c
@@ -1,4 +1,6 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
static inline collected_number uptime_from_boottime(void) {
#ifdef CLOCK_BOOTTIME_IS_AVAILABLE
@@ -83,9 +85,9 @@ int do_proc_uptime(int update_every, usec_t dt) {
, NULL
, "System Uptime"
, "seconds"
- , "proc"
- , "uptime"
- , 1000
+ , PLUGIN_PROC_NAME
+ , "/proc/uptime"
+ , NETDATA_CHART_PRIO_SYSTEM_UPTIME
, update_every
, RRDSET_TYPE_LINE
);
diff --git a/src/proc_vmstat.c b/collectors/proc.plugin/proc_vmstat.c
index 52e88d888..f7c93c20a 100644
--- a/src/proc_vmstat.c
+++ b/collectors/proc.plugin/proc_vmstat.c
@@ -1,4 +1,8 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
+
+#define PLUGIN_PROC_MODULE_VMSTAT_NAME "/proc/vmstat"
int do_proc_vmstat(int update_every, usec_t dt) {
(void)dt;
@@ -102,9 +106,9 @@ int do_proc_vmstat(int update_every, usec_t dt) {
, NULL
, "Swap I/O"
, "kilobytes/s"
- , "proc"
- , "vmstat"
- , 250
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_VMSTAT_NAME
+ , NETDATA_CHART_PRIO_SYSTEM_SWAPIO
, update_every
, RRDSET_TYPE_AREA
);
@@ -134,9 +138,9 @@ int do_proc_vmstat(int update_every, usec_t dt) {
, NULL
, "Memory Paged from/to disk"
, "kilobytes/s"
- , "proc"
- , "vmstat"
- , 151
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_VMSTAT_NAME
+ , NETDATA_CHART_PRIO_SYSTEM_PGPGIO
, update_every
, RRDSET_TYPE_AREA
);
@@ -166,8 +170,8 @@ int do_proc_vmstat(int update_every, usec_t dt) {
, NULL
, "Memory Page Faults"
, "page faults/s"
- , "proc"
- , "vmstat"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_VMSTAT_NAME
, NETDATA_CHART_PRIO_MEM_SYSTEM_PGFAULTS
, update_every
, RRDSET_TYPE_LINE
@@ -211,8 +215,8 @@ int do_proc_vmstat(int update_every, usec_t dt) {
, NULL
, "NUMA events"
, "events/s"
- , "proc"
- , "vmstat"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_VMSTAT_NAME
, NETDATA_CHART_PRIO_MEM_NUMA
, update_every
, RRDSET_TYPE_LINE
diff --git a/src/sys_devices_system_edac_mc.c b/collectors/proc.plugin/sys_devices_system_edac_mc.c
index caa16192e..03cbfff83 100644
--- a/src/sys_devices_system_edac_mc.c
+++ b/collectors/proc.plugin/sys_devices_system_edac_mc.c
@@ -1,4 +1,6 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
struct mc {
char *name;
@@ -140,9 +142,9 @@ int do_proc_sys_devices_system_edac_mc(int update_every, usec_t dt) {
, NULL
, "ECC Memory Correctable Errors"
, "errors"
- , "proc"
+ , PLUGIN_PROC_NAME
, "/sys/devices/system/edac/mc"
- , NETDATA_CHART_PRIO_MEM_HW + 50
+ , NETDATA_CHART_PRIO_MEM_HW_ECC_CE
, update_every
, RRDSET_TYPE_LINE
);
@@ -178,9 +180,9 @@ int do_proc_sys_devices_system_edac_mc(int update_every, usec_t dt) {
, NULL
, "ECC Memory Uncorrectable Errors"
, "errors"
- , "proc"
+ , PLUGIN_PROC_NAME
, "/sys/devices/system/edac/mc"
- , NETDATA_CHART_PRIO_MEM_HW + 60
+ , NETDATA_CHART_PRIO_MEM_HW_ECC_UE
, update_every
, RRDSET_TYPE_LINE
);
diff --git a/src/sys_devices_system_node.c b/collectors/proc.plugin/sys_devices_system_node.c
index d04c8dc30..6e6d0acca 100644
--- a/src/sys_devices_system_node.c
+++ b/collectors/proc.plugin/sys_devices_system_node.c
@@ -1,4 +1,6 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
struct node {
char *name;
@@ -105,9 +107,9 @@ int do_proc_sys_devices_system_node(int update_every, usec_t dt) {
, NULL
, "NUMA events"
, "events/s"
- , "proc"
+ , PLUGIN_PROC_NAME
, "/sys/devices/system/node"
- , NETDATA_CHART_PRIO_MEM_NUMA + 10
+ , NETDATA_CHART_PRIO_MEM_NUMA_NODES
, update_every
, RRDSET_TYPE_LINE
);
diff --git a/src/sys_fs_btrfs.c b/collectors/proc.plugin/sys_fs_btrfs.c
index a8dfb5c91..ed980cea5 100644
--- a/src/sys_fs_btrfs.c
+++ b/collectors/proc.plugin/sys_fs_btrfs.c
@@ -1,4 +1,8 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
+
+#define PLUGIN_PROC_MODULE_BTRFS_NAME "/sys/fs/btrfs"
typedef struct btrfs_disk {
char *name;
@@ -171,12 +175,16 @@ static inline int find_btrfs_disks(BTRFS_NODE *node, const char *path) {
snprintfz(filename, FILENAME_MAX, "%s/%s/size", path, de->d_name);
d->size_filename = strdupz(filename);
- // for disks
- snprintfz(filename, FILENAME_MAX, "%s/%s/queue/hw_sector_size", path, de->d_name);
+ // for bcache
+ snprintfz(filename, FILENAME_MAX, "%s/%s/bcache/../queue/hw_sector_size", path, de->d_name);
struct stat sb;
- if(stat(filename, &sb) == -1)
- // for partitions
- snprintfz(filename, FILENAME_MAX, "%s/%s/../queue/hw_sector_size", path, de->d_name);
+ if(stat(filename, &sb) == -1) {
+ // for disks
+ snprintfz(filename, FILENAME_MAX, "%s/%s/queue/hw_sector_size", path, de->d_name);
+ if(stat(filename, &sb) == -1)
+ // for partitions
+ snprintfz(filename, FILENAME_MAX, "%s/%s/../queue/hw_sector_size", path, de->d_name);
+ }
d->hw_sector_size_filename = strdupz(filename);
@@ -538,7 +546,7 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
snprintf(id, RRD_ID_LENGTH_MAX, "disk_%s", node->id);
snprintf(name, RRD_ID_LENGTH_MAX, "disk_%s", node->label);
- snprintf(title, 200, "BTRFS Disk Allocation for %s", node->label);
+ snprintf(title, 200, "BTRFS Physical Disk Allocation for %s", node->label);
netdata_fix_chart_id(id);
netdata_fix_chart_name(name);
@@ -551,20 +559,20 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
, "btrfs.disk"
, title
, "MB"
- , "proc"
- , "sys/fs/btrfs"
- , 2300
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_BTRFS_NAME
+ , NETDATA_CHART_PRIO_BTRFS_DISK
, update_every
, RRDSET_TYPE_STACKED
);
- node->rd_allocation_disks_unallocated = rrddim_add(node->st_allocation_disks, "unallocated", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
- node->rd_allocation_disks_data_used = rrddim_add(node->st_allocation_disks, "data_used", "data used", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
- node->rd_allocation_disks_data_free = rrddim_add(node->st_allocation_disks, "data_free", "data free", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
- node->rd_allocation_disks_metadata_used = rrddim_add(node->st_allocation_disks, "meta_used", "meta used", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
+ node->rd_allocation_disks_unallocated = rrddim_add(node->st_allocation_disks, "unallocated", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
+ node->rd_allocation_disks_data_free = rrddim_add(node->st_allocation_disks, "data_free", "data free", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
+ node->rd_allocation_disks_data_used = rrddim_add(node->st_allocation_disks, "data_used", "data used", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
node->rd_allocation_disks_metadata_free = rrddim_add(node->st_allocation_disks, "meta_free", "meta free", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
- node->rd_allocation_disks_system_used = rrddim_add(node->st_allocation_disks, "sys_used", "sys used", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
- node->rd_allocation_disks_system_free = rrddim_add(node->st_allocation_disks, "sys_free", "sys free", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
+ node->rd_allocation_disks_metadata_used = rrddim_add(node->st_allocation_disks, "meta_used", "meta used", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
+ node->rd_allocation_disks_system_free = rrddim_add(node->st_allocation_disks, "sys_free", "sys free", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
+ node->rd_allocation_disks_system_used = rrddim_add(node->st_allocation_disks, "sys_used", "sys used", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
}
else rrdset_next(node->st_allocation_disks);
@@ -607,9 +615,9 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
, "btrfs.data"
, title
, "MB"
- , "proc"
- , "sys/fs/btrfs"
- , 2301
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_BTRFS_NAME
+ , NETDATA_CHART_PRIO_BTRFS_DATA
, update_every
, RRDSET_TYPE_STACKED
);
@@ -648,9 +656,9 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
, "btrfs.metadata"
, title
, "MB"
- , "proc"
- , "sys/fs/btrfs"
- , 2302
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_BTRFS_NAME
+ , NETDATA_CHART_PRIO_BTRFS_METADATA
, update_every
, RRDSET_TYPE_STACKED
);
@@ -691,9 +699,9 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
, "btrfs.system"
, title
, "MB"
- , "proc"
- , "sys/fs/btrfs"
- , 2303
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_BTRFS_NAME
+ , NETDATA_CHART_PRIO_BTRFS_SYSTEM
, update_every
, RRDSET_TYPE_STACKED
);
diff --git a/src/sys_kernel_mm_ksm.c b/collectors/proc.plugin/sys_kernel_mm_ksm.c
index 7ca1366b4..0f5c79c49 100644
--- a/src/sys_kernel_mm_ksm.c
+++ b/collectors/proc.plugin/sys_kernel_mm_ksm.c
@@ -1,4 +1,8 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "plugin_proc.h"
+
+#define PLUGIN_PROC_MODULE_KSM_NAME "/sys/kernel/mm/ksm"
typedef struct ksm_name_value {
char filename[FILENAME_MAX + 1];
@@ -102,8 +106,8 @@ int do_sys_kernel_mm_ksm(int update_every, usec_t dt) {
, NULL
, "Kernel Same Page Merging"
, "MB"
- , "proc"
- , "/sys/kernel/mm/ksm"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_KSM_NAME
, NETDATA_CHART_PRIO_MEM_KSM
, update_every
, RRDSET_TYPE_AREA
@@ -142,9 +146,9 @@ int do_sys_kernel_mm_ksm(int update_every, usec_t dt) {
, NULL
, "Kernel Same Page Merging Savings"
, "MB"
- , "proc"
- , "/sys/kernel/mm/ksm"
- , NETDATA_CHART_PRIO_MEM_KSM + 1
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_KSM_NAME
+ , NETDATA_CHART_PRIO_MEM_KSM_SAVINGS
, update_every
, RRDSET_TYPE_AREA
);
@@ -176,9 +180,9 @@ int do_sys_kernel_mm_ksm(int update_every, usec_t dt) {
, NULL
, "Kernel Same Page Merging Effectiveness"
, "percentage"
- , "proc"
- , "/sys/kernel/mm/ksm"
- , NETDATA_CHART_PRIO_MEM_KSM + 2
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_KSM_NAME
+ , NETDATA_CHART_PRIO_MEM_KSM_RATIOS
, update_every
, RRDSET_TYPE_LINE
);
diff --git a/src/zfs_common.c b/collectors/proc.plugin/zfs_common.c
index 05935dd0f..1aaceb908 100644
--- a/src/zfs_common.c
+++ b/collectors/proc.plugin/zfs_common.c
@@ -1,9 +1,10 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
#include "zfs_common.h"
struct arcstats arcstats = { 0 };
-void generate_charts_arcstats(const char *plugin, int update_every) {
+void generate_charts_arcstats(const char *plugin, const char *module, int update_every) {
// ARC reads
unsigned long long aread = arcstats.hits + arcstats.misses;
@@ -47,8 +48,8 @@ void generate_charts_arcstats(const char *plugin, int update_every) {
, "ZFS ARC Size"
, "MB"
, plugin
- , "zfs"
- , 2500
+ , module
+ , NETDATA_CHART_PRIO_ZFS_ARC_SIZE
, update_every
, RRDSET_TYPE_AREA
);
@@ -85,8 +86,8 @@ void generate_charts_arcstats(const char *plugin, int update_every) {
, "ZFS L2 ARC Size"
, "MB"
, plugin
- , "zfs"
- , 2500
+ , module
+ , NETDATA_CHART_PRIO_ZFS_L2_SIZE
, update_every
, RRDSET_TYPE_AREA
);
@@ -122,8 +123,8 @@ void generate_charts_arcstats(const char *plugin, int update_every) {
, "ZFS Reads"
, "reads/s"
, plugin
- , "zfs"
- , 2510
+ , module
+ , NETDATA_CHART_PRIO_ZFS_READS
, update_every
, RRDSET_TYPE_AREA
);
@@ -167,8 +168,8 @@ void generate_charts_arcstats(const char *plugin, int update_every) {
, "ZFS ARC L2 Read/Write Rate"
, "kilobytes/s"
, plugin
- , "zfs"
- , 2700
+ , module
+ , NETDATA_CHART_PRIO_ZFS_IO
, update_every
, RRDSET_TYPE_AREA
);
@@ -201,8 +202,8 @@ void generate_charts_arcstats(const char *plugin, int update_every) {
, "ZFS ARC Hits"
, "percentage"
, plugin
- , "zfs"
- , 2520
+ , module
+ , NETDATA_CHART_PRIO_ZFS_HITS
, update_every
, RRDSET_TYPE_STACKED
);
@@ -235,8 +236,8 @@ void generate_charts_arcstats(const char *plugin, int update_every) {
, "ZFS Demand Hits"
, "percentage"
, plugin
- , "zfs"
- , 2530
+ , module
+ , NETDATA_CHART_PRIO_ZFS_DHITS
, update_every
, RRDSET_TYPE_STACKED
);
@@ -269,8 +270,8 @@ void generate_charts_arcstats(const char *plugin, int update_every) {
, "ZFS Prefetch Hits"
, "percentage"
, plugin
- , "zfs"
- , 2540
+ , module
+ , NETDATA_CHART_PRIO_ZFS_PHITS
, update_every
, RRDSET_TYPE_STACKED
);
@@ -303,8 +304,8 @@ void generate_charts_arcstats(const char *plugin, int update_every) {
, "ZFS Metadata Hits"
, "percentage"
, plugin
- , "zfs"
- , 2550
+ , module
+ , NETDATA_CHART_PRIO_ZFS_MHITS
, update_every
, RRDSET_TYPE_STACKED
);
@@ -337,8 +338,8 @@ void generate_charts_arcstats(const char *plugin, int update_every) {
, "ZFS L2 Hits"
, "percentage"
, plugin
- , "zfs"
- , 2560
+ , module
+ , NETDATA_CHART_PRIO_ZFS_L2HITS
, update_every
, RRDSET_TYPE_STACKED
);
@@ -373,8 +374,8 @@ void generate_charts_arcstats(const char *plugin, int update_every) {
, "ZFS List Hits"
, "hits/s"
, plugin
- , "zfs"
- , 2600
+ , module
+ , NETDATA_CHART_PRIO_ZFS_LIST_HITS
, update_every
, RRDSET_TYPE_AREA
);
@@ -395,7 +396,7 @@ void generate_charts_arcstats(const char *plugin, int update_every) {
}
}
-void generate_charts_arc_summary(const char *plugin, int update_every) {
+void generate_charts_arc_summary(const char *plugin, const char *module, int update_every) {
unsigned long long arc_accesses_total = arcstats.hits + arcstats.misses;
unsigned long long real_hits = arcstats.mfu_hits + arcstats.mru_hits;
unsigned long long real_misses = arc_accesses_total - real_hits;
@@ -432,8 +433,8 @@ void generate_charts_arc_summary(const char *plugin, int update_every) {
, "ZFS ARC Size Breakdown"
, "percentage"
, plugin
- , "zfs"
- , 2520
+ , module
+ , NETDATA_CHART_PRIO_ZFS_ARC_SIZE_BREAKDOWN
, update_every
, RRDSET_TYPE_STACKED
);
@@ -471,8 +472,8 @@ void generate_charts_arc_summary(const char *plugin, int update_every) {
, "ZFS Memory Operations"
, "operations/s"
, plugin
- , "zfs"
- , 2523
+ , module
+ , NETDATA_CHART_PRIO_ZFS_MEMORY_OPS
, update_every
, RRDSET_TYPE_LINE
);
@@ -517,8 +518,8 @@ void generate_charts_arc_summary(const char *plugin, int update_every) {
, "ZFS Important Operations"
, "operations/s"
, plugin
- , "zfs"
- , 2522
+ , module
+ , NETDATA_CHART_PRIO_ZFS_IMPORTANT_OPS
, update_every
, RRDSET_TYPE_LINE
);
@@ -555,8 +556,8 @@ void generate_charts_arc_summary(const char *plugin, int update_every) {
, "ZFS Actual Cache Hits"
, "percentage"
, plugin
- , "zfs"
- , 2519
+ , module
+ , NETDATA_CHART_PRIO_ZFS_ACTUAL_HITS
, update_every
, RRDSET_TYPE_STACKED
);
@@ -589,8 +590,8 @@ void generate_charts_arc_summary(const char *plugin, int update_every) {
, "ZFS Data Demand Efficiency"
, "percentage"
, plugin
- , "zfs"
- , 2531
+ , module
+ , NETDATA_CHART_PRIO_ZFS_DEMAND_DATA_HITS
, update_every
, RRDSET_TYPE_STACKED
);
@@ -623,8 +624,8 @@ void generate_charts_arc_summary(const char *plugin, int update_every) {
, "ZFS Data Prefetch Efficiency"
, "percentage"
, plugin
- , "zfs"
- , 2532
+ , module
+ , NETDATA_CHART_PRIO_ZFS_PREFETCH_DATA_HITS
, update_every
, RRDSET_TYPE_STACKED
);
@@ -657,8 +658,8 @@ void generate_charts_arc_summary(const char *plugin, int update_every) {
, "ZFS ARC Hash Elements"
, "elements"
, plugin
- , "zfs"
- , 2800
+ , module
+ , NETDATA_CHART_PRIO_ZFS_HASH_ELEMENTS
, update_every
, RRDSET_TYPE_LINE
);
@@ -691,8 +692,8 @@ void generate_charts_arc_summary(const char *plugin, int update_every) {
, "ZFS ARC Hash Chains"
, "chains"
, plugin
- , "zfs"
- , 2810
+ , module
+ , NETDATA_CHART_PRIO_ZFS_HASH_CHAINS
, update_every
, RRDSET_TYPE_LINE
);
diff --git a/src/zfs_common.h b/collectors/proc.plugin/zfs_common.h
index 4494e70ca..fab54f59a 100644
--- a/src/zfs_common.h
+++ b/collectors/proc.plugin/zfs_common.h
@@ -1,5 +1,9 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
#ifndef NETDATA_ZFS_COMMON_H
-#define NETDATA_ZFS_COMMON_H
+#define NETDATA_ZFS_COMMON_H 1
+
+#include "../../daemon/common.h"
#define ZFS_FAMILY_SIZE "size"
#define ZFS_FAMILY_EFFICIENCY "efficiency"
@@ -105,7 +109,7 @@ struct arcstats {
int l2exist;
};
-void generate_charts_arcstats(const char *plugin, int update_every);
-void generate_charts_arc_summary(const char *plugin, int update_every);
+void generate_charts_arcstats(const char *plugin, const char *module, int update_every);
+void generate_charts_arc_summary(const char *plugin, const char *module, int update_every);
#endif //NETDATA_ZFS_COMMON_H