diff options
Diffstat (limited to '')
-rw-r--r-- | collectors/freebsd.plugin/Makefile.am | 5 | ||||
-rw-r--r-- | collectors/freebsd.plugin/Makefile.in | 457 | ||||
-rw-r--r-- | collectors/freebsd.plugin/freebsd_devstat.c (renamed from src/freebsd_devstat.c) | 40 | ||||
-rw-r--r-- | collectors/freebsd.plugin/freebsd_getifaddrs.c (renamed from src/freebsd_getifaddrs.c) | 156 | ||||
-rw-r--r-- | collectors/freebsd.plugin/freebsd_getmntinfo.c (renamed from src/freebsd_getmntinfo.c) | 12 | ||||
-rw-r--r-- | collectors/freebsd.plugin/freebsd_ipfw.c (renamed from src/freebsd_ipfw.c) | 24 | ||||
-rw-r--r-- | collectors/freebsd.plugin/freebsd_kstat_zfs.c (renamed from src/freebsd_kstat_zfs.c) | 10 | ||||
-rw-r--r-- | collectors/freebsd.plugin/freebsd_sysctl.c (renamed from src/freebsd_sysctl.c) | 191 | ||||
-rw-r--r-- | collectors/freebsd.plugin/plugin_freebsd.c (renamed from src/plugin_freebsd.c) | 6 | ||||
-rw-r--r-- | collectors/freebsd.plugin/plugin_freebsd.h | 74 |
10 files changed, 825 insertions, 150 deletions
diff --git a/collectors/freebsd.plugin/Makefile.am b/collectors/freebsd.plugin/Makefile.am new file mode 100644 index 000000000..e80ec702d --- /dev/null +++ b/collectors/freebsd.plugin/Makefile.am @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-3.0-or-later + +AUTOMAKE_OPTIONS = subdir-objects + +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in diff --git a/collectors/freebsd.plugin/Makefile.in b/collectors/freebsd.plugin/Makefile.in new file mode 100644 index 000000000..c88b3d755 --- /dev/null +++ b/collectors/freebsd.plugin/Makefile.in @@ -0,0 +1,457 @@ +# 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/freebsd.plugin +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am +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 +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 +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/freebsd.plugin/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu collectors/freebsd.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 +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/src/freebsd_devstat.c b/collectors/freebsd.plugin/freebsd_devstat.c index ed7466ead..10279aabc 100644 --- a/src/freebsd_devstat.c +++ b/collectors/freebsd.plugin/freebsd_devstat.c @@ -1,4 +1,6 @@ -#include "common.h" +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "plugin_freebsd.h" #include <sys/devicestat.h> @@ -359,9 +361,9 @@ int do_kern_devstat(int update_every, usec_t dt) { "disk.io", "Disk I/O Bandwidth", "kilobytes/s", - "freebsd", + "freebsd.plugin", "devstat", - 2000, + NETDATA_CHART_PRIO_DISK_IO, update_every, RRDSET_TYPE_AREA ); @@ -396,9 +398,9 @@ int do_kern_devstat(int update_every, usec_t dt) { "disk.ops", "Disk Completed I/O Operations", "operations/s", - "freebsd", + "freebsd.plugin", "devstat", - 2001, + NETDATA_CHART_PRIO_DISK_OPS, update_every, RRDSET_TYPE_LINE ); @@ -435,9 +437,9 @@ int do_kern_devstat(int update_every, usec_t dt) { "disk.qops", "Disk Current I/O Operations", "operations", - "freebsd", + "freebsd.plugin", "devstat", - 2002, + NETDATA_CHART_PRIO_DISK_QOPS, update_every, RRDSET_TYPE_LINE ); @@ -464,9 +466,9 @@ int do_kern_devstat(int update_every, usec_t dt) { "disk.util", "Disk Utilization Time", "% of time working", - "freebsd", + "freebsd.plugin", "devstat", - 2004, + NETDATA_CHART_PRIO_DISK_UTIL, update_every, RRDSET_TYPE_AREA ); @@ -497,9 +499,9 @@ int do_kern_devstat(int update_every, usec_t dt) { "disk.iotime", "Disk Total I/O Time", "milliseconds/s", - "freebsd", + "freebsd.plugin", "devstat", - 2022, + NETDATA_CHART_PRIO_DISK_IOTIME, update_every, RRDSET_TYPE_LINE ); @@ -545,9 +547,9 @@ int do_kern_devstat(int update_every, usec_t dt) { "disk.await", "Average Completed I/O Operation Time", "ms per operation", - "freebsd", + "freebsd.plugin", "devstat", - 2005, + NETDATA_CHART_PRIO_DISK_AWAIT, update_every, RRDSET_TYPE_LINE ); @@ -610,9 +612,9 @@ int do_kern_devstat(int update_every, usec_t dt) { "disk.avgsz", "Average Completed I/O Operation Bandwidth", "kilobytes per operation", - "freebsd", + "freebsd.plugin", "devstat", - 2006, + NETDATA_CHART_PRIO_DISK_AVGSZ, update_every, RRDSET_TYPE_AREA ); @@ -667,9 +669,9 @@ int do_kern_devstat(int update_every, usec_t dt) { "disk.svctm", "Average Service Time", "ms per operation", - "freebsd", + "freebsd.plugin", "devstat", - 2007, + NETDATA_CHART_PRIO_DISK_SVCTM, update_every, RRDSET_TYPE_LINE ); @@ -727,9 +729,9 @@ int do_kern_devstat(int update_every, usec_t dt) { NULL, "Disk I/O", "kilobytes/s", - "freebsd", + "freebsd.plugin", "devstat", - 150, + NETDATA_CHART_PRIO_SYSTEM_IO, update_every, RRDSET_TYPE_AREA ); diff --git a/src/freebsd_getifaddrs.c b/collectors/freebsd.plugin/freebsd_getifaddrs.c index 73f8f1824..e15845857 100644 --- a/src/freebsd_getifaddrs.c +++ b/collectors/freebsd.plugin/freebsd_getifaddrs.c @@ -1,4 +1,6 @@ -#include "common.h" +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "plugin_freebsd.h" #include <ifaddrs.h> @@ -141,19 +143,24 @@ static struct cgroup_network_interface *get_network_interface(const char *name) int do_getifaddrs(int update_every, usec_t dt) { (void)dt; -#define DELAULT_EXLUDED_INTERFACES "lo*" +#define DEFAULT_EXLUDED_INTERFACES "lo*" +#define DEFAULT_PHYSICAL_INTERFACES "igb* ix* cxl* em* ixl* ixlv* bge* ixgbe*" #define CONFIG_SECTION_GETIFADDRS "plugin:freebsd:getifaddrs" static int enable_new_interfaces = -1; - static int do_bandwidth_ipv4 = -1, do_bandwidth_ipv6 = -1, do_bandwidth = -1, do_packets = -1, + static int do_bandwidth_ipv4 = -1, do_bandwidth_ipv6 = -1, do_bandwidth = -1, do_packets = -1, do_bandwidth_net = -1, do_packets_net = -1, do_errors = -1, do_drops = -1, do_events = -1; - static SIMPLE_PATTERN *excluded_interfaces = NULL; + static SIMPLE_PATTERN *excluded_interfaces = NULL, *physical_interfaces = NULL; if (unlikely(enable_new_interfaces == -1)) { enable_new_interfaces = config_get_boolean_ondemand(CONFIG_SECTION_GETIFADDRS, "enable new interfaces detected at runtime", CONFIG_BOOLEAN_AUTO); - + + do_bandwidth_net = config_get_boolean_ondemand(CONFIG_SECTION_GETIFADDRS, "total bandwidth for physical interfaces", + CONFIG_BOOLEAN_AUTO); + do_packets_net = config_get_boolean_ondemand(CONFIG_SECTION_GETIFADDRS, "total packets for physical interfaces", + CONFIG_BOOLEAN_AUTO); do_bandwidth_ipv4 = config_get_boolean_ondemand(CONFIG_SECTION_GETIFADDRS, "total bandwidth for ipv4 interfaces", CONFIG_BOOLEAN_AUTO); do_bandwidth_ipv6 = config_get_boolean_ondemand(CONFIG_SECTION_GETIFADDRS, "total bandwidth for ipv6 interfaces", @@ -170,18 +177,27 @@ int do_getifaddrs(int update_every, usec_t dt) { CONFIG_BOOLEAN_AUTO); excluded_interfaces = simple_pattern_create( - config_get(CONFIG_SECTION_GETIFADDRS, "disable by default interfaces matching", DELAULT_EXLUDED_INTERFACES) + config_get(CONFIG_SECTION_GETIFADDRS, "disable by default interfaces matching", DEFAULT_EXLUDED_INTERFACES) + , NULL + , SIMPLE_PATTERN_EXACT + ); + physical_interfaces = simple_pattern_create( + config_get(CONFIG_SECTION_GETIFADDRS, "set physical interfaces for system.net", DEFAULT_PHYSICAL_INTERFACES) , NULL , SIMPLE_PATTERN_EXACT ); } - if (likely(do_bandwidth_ipv4 || do_bandwidth_ipv6 || do_bandwidth || do_packets || do_errors || + if (likely(do_bandwidth_ipv4 || do_bandwidth_ipv6 || do_bandwidth || do_packets || do_errors || do_bandwidth_net || do_packets_net || do_drops || do_events)) { struct ifaddrs *ifap; if (unlikely(getifaddrs(&ifap))) { error("FREEBSD: getifaddrs() failed"); + do_bandwidth_net = 0; + error("DISABLED: system.net chart"); + do_packets_net = 0; + error("DISABLED: system.packets chart"); do_bandwidth_ipv4 = 0; error("DISABLED: system.ipv4 chart"); do_bandwidth_ipv6 = 0; @@ -204,7 +220,103 @@ int do_getifaddrs(int update_every, usec_t dt) { struct iftot { u_long ift_ibytes; u_long ift_obytes; - } iftot = {0, 0}; + u_long ift_ipackets; + u_long ift_opackets; + u_long ift_imcasts; + u_long ift_omcasts; + } iftot = {0, 0, 0, 0, 0, 0}; + + // -------------------------------------------------------------------- + + if (likely(do_bandwidth_net)) { + + iftot.ift_ibytes = iftot.ift_obytes = 0; + for (ifa = ifap; ifa; ifa = ifa->ifa_next) { + if (ifa->ifa_addr->sa_family != AF_LINK) + continue; + if (!simple_pattern_matches(physical_interfaces, ifa->ifa_name)) + continue; + iftot.ift_ibytes += IFA_DATA(ibytes); + iftot.ift_obytes += IFA_DATA(obytes); + } + + static RRDSET *st = NULL; + static RRDDIM *rd_in = NULL, *rd_out = NULL; + + if (unlikely(!st)) { + st = rrdset_create_localhost("system", + "net", + NULL, + "network", + NULL, + "Network Traffic", + "kilobits/s", + "freebsd.plugin", + "getifaddrs", + NETDATA_CHART_PRIO_SYSTEM_NET, + update_every, + RRDSET_TYPE_AREA + ); + + rd_in = rrddim_add(st, "InOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL); + rd_out = rrddim_add(st, "OutOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL); + } else + rrdset_next(st); + + rrddim_set_by_pointer(st, rd_in, iftot.ift_ibytes); + rrddim_set_by_pointer(st, rd_out, iftot.ift_obytes); + rrdset_done(st); + } + + // -------------------------------------------------------------------- + + if (likely(do_packets_net)) { + + iftot.ift_ipackets = iftot.ift_opackets = iftot.ift_imcasts = iftot.ift_omcasts = 0; + for (ifa = ifap; ifa; ifa = ifa->ifa_next) { + if (ifa->ifa_addr->sa_family != AF_LINK) + continue; + if (!simple_pattern_matches(physical_interfaces, ifa->ifa_name)) + continue; + iftot.ift_ipackets += IFA_DATA(ipackets); + iftot.ift_opackets += IFA_DATA(opackets); + iftot.ift_imcasts += IFA_DATA(imcasts); + iftot.ift_omcasts += IFA_DATA(omcasts); + } + + static RRDSET *st = NULL; + static RRDDIM *rd_packets_in = NULL, *rd_packets_out = NULL, *rd_packets_m_in = NULL, *rd_packets_m_out = NULL; + + if (unlikely(!st)) { + st = rrdset_create_localhost("system", + "packets", + NULL, + "network", + NULL, + "Network Packets", + "packets/s", + "freebsd.plugin", + "getifaddrs", + NETDATA_CHART_PRIO_SYSTEM_PACKETS, + update_every, + RRDSET_TYPE_LINE + ); + + rrdset_flag_set(st, RRDSET_FLAG_DETAIL); + + rd_packets_in = rrddim_add(st, "received", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + rd_packets_out = rrddim_add(st, "sent", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); + rd_packets_m_in = rrddim_add(st, "multicast_received", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + rd_packets_m_out = rrddim_add(st, "multicast_sent", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); + } else + rrdset_next(st); + + rrddim_set_by_pointer(st, rd_packets_in, iftot.ift_ipackets); + rrddim_set_by_pointer(st, rd_packets_out, iftot.ift_opackets); + rrddim_set_by_pointer(st, rd_packets_m_in, iftot.ift_imcasts); + rrddim_set_by_pointer(st, rd_packets_m_out, iftot.ift_omcasts); + rrdset_done(st); + } // -------------------------------------------------------------------- @@ -228,9 +340,9 @@ int do_getifaddrs(int update_every, usec_t dt) { NULL, "IPv4 Bandwidth", "kilobits/s", - "freebsd", + "freebsd.plugin", "getifaddrs", - 500, + NETDATA_CHART_PRIO_SYSTEM_IPV4, update_every, RRDSET_TYPE_AREA ); @@ -267,9 +379,9 @@ int do_getifaddrs(int update_every, usec_t dt) { NULL, "IPv6 Bandwidth", "kilobits/s", - "freebsd", + "freebsd.plugin", "getifaddrs", - 500, + NETDATA_CHART_PRIO_SYSTEM_IPV6, update_every, RRDSET_TYPE_AREA ); @@ -337,9 +449,9 @@ int do_getifaddrs(int update_every, usec_t dt) { "net.net", "Bandwidth", "kilobits/s", - "freebsd", + "freebsd.plugin", "getifaddrs", - 7000, + NETDATA_CHART_PRIO_FIRST_NET_IFACE, update_every, RRDSET_TYPE_AREA ); @@ -366,9 +478,9 @@ int do_getifaddrs(int update_every, usec_t dt) { "net.packets", "Packets", "packets/s", - "freebsd", + "freebsd.plugin", "getifaddrs", - 7001, + NETDATA_CHART_PRIO_FIRST_NET_PACKETS, update_every, RRDSET_TYPE_LINE ); @@ -405,9 +517,9 @@ int do_getifaddrs(int update_every, usec_t dt) { "net.errors", "Interface Errors", "errors/s", - "freebsd", + "freebsd.plugin", "getifaddrs", - 7002, + NETDATA_CHART_PRIO_FIRST_NET_ERRORS, update_every, RRDSET_TYPE_LINE ); @@ -439,9 +551,9 @@ int do_getifaddrs(int update_every, usec_t dt) { "net.drops", "Interface Drops", "drops/s", - "freebsd", + "freebsd.plugin", "getifaddrs", - 7003, + NETDATA_CHART_PRIO_FIRST_NET_DROPS, update_every, RRDSET_TYPE_LINE ); @@ -474,9 +586,9 @@ int do_getifaddrs(int update_every, usec_t dt) { "net.events", "Network Interface Events", "events/s", - "freebsd", + "freebsd.plugin", "getifaddrs", - 7006, + NETDATA_CHART_PRIO_FIRST_NET_EVENTS, update_every, RRDSET_TYPE_LINE ); diff --git a/src/freebsd_getmntinfo.c b/collectors/freebsd.plugin/freebsd_getmntinfo.c index ea82b9fd1..c86f23166 100644 --- a/src/freebsd_getmntinfo.c +++ b/collectors/freebsd.plugin/freebsd_getmntinfo.c @@ -1,4 +1,6 @@ -#include "common.h" +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "plugin_freebsd.h" #include <sys/mount.h> @@ -225,9 +227,9 @@ int do_getmntinfo(int update_every, usec_t dt) { "disk.space", title, "GB", - "freebsd", + "freebsd.plugin", "getmntinfo", - 2023, + NETDATA_CHART_PRIO_DISKSPACE_SPACE, update_every, RRDSET_TYPE_STACKED ); @@ -264,9 +266,9 @@ int do_getmntinfo(int update_every, usec_t dt) { "disk.inodes", title, "Inodes", - "freebsd", + "freebsd.plugin", "getmntinfo", - 2024, + NETDATA_CHART_PRIO_DISKSPACE_INODES, update_every, RRDSET_TYPE_STACKED ); diff --git a/src/freebsd_ipfw.c b/collectors/freebsd.plugin/freebsd_ipfw.c index 81264b3f3..c256da8b3 100644 --- a/src/freebsd_ipfw.c +++ b/collectors/freebsd.plugin/freebsd_ipfw.c @@ -1,4 +1,6 @@ -#include "common.h" +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "plugin_freebsd.h" #include <netinet/ip_fw.h> @@ -162,9 +164,9 @@ int do_ipfw(int update_every, usec_t dt) { NULL, "Memory allocated by rules", "bytes", - "freebsd", + "freebsd.plugin", "ipfw", - 3005, + NETDATA_CHART_PRIO_IPFW_MEM, update_every, RRDSET_TYPE_STACKED ); @@ -195,9 +197,9 @@ int do_ipfw(int update_every, usec_t dt) { NULL, "Packets", "packets/s", - "freebsd", + "freebsd.plugin", "ipfw", - 3001, + NETDATA_CHART_PRIO_IPFW_PACKETS, update_every, RRDSET_TYPE_STACKED ); @@ -212,9 +214,9 @@ int do_ipfw(int update_every, usec_t dt) { NULL, "Bytes", "bytes/s", - "freebsd", + "freebsd.plugin", "ipfw", - 3002, + NETDATA_CHART_PRIO_IPFW_BYTES, update_every, RRDSET_TYPE_STACKED ); @@ -316,9 +318,9 @@ int do_ipfw(int update_every, usec_t dt) { NULL, "Active rules", "rules", - "freebsd", + "freebsd.plugin", "ipfw", - 3003, + NETDATA_CHART_PRIO_IPFW_ACTIVE, update_every, RRDSET_TYPE_STACKED ); @@ -333,9 +335,9 @@ int do_ipfw(int update_every, usec_t dt) { NULL, "Expired rules", "rules", - "freebsd", + "freebsd.plugin", "ipfw", - 3004, + NETDATA_CHART_PRIO_IPFW_EXPIRED, update_every, RRDSET_TYPE_STACKED ); diff --git a/src/freebsd_kstat_zfs.c b/collectors/freebsd.plugin/freebsd_kstat_zfs.c index 1bd48d4bf..93dfc320b 100644 --- a/src/freebsd_kstat_zfs.c +++ b/collectors/freebsd.plugin/freebsd_kstat_zfs.c @@ -1,5 +1,7 @@ -#include "common.h" -#include "zfs_common.h" +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "plugin_freebsd.h" +#include "collectors/proc.plugin/zfs_common.h" extern struct arcstats arcstats; @@ -207,8 +209,8 @@ int do_kstat_zfs_misc_arcstats(int update_every, usec_t dt) { // missing mib: GETSYSCTL_SIMPLE("kstat.zfs.misc.arcstats.arc_need_free", mibs.arc_need_free, arcstats.arc_need_free); // missing mib: GETSYSCTL_SIMPLE("kstat.zfs.misc.arcstats.arc_sys_free", mibs.arc_sys_free, arcstats.arc_sys_free); - generate_charts_arcstats("freebsd", update_every); - generate_charts_arc_summary("freebsd", update_every); + generate_charts_arcstats("freebsd", "zfs", update_every); + generate_charts_arc_summary("freebsd", "zfs", update_every); return 0; } diff --git a/src/freebsd_sysctl.c b/collectors/freebsd.plugin/freebsd_sysctl.c index 1e11255aa..da5a351de 100644 --- a/src/freebsd_sysctl.c +++ b/collectors/freebsd.plugin/freebsd_sysctl.c @@ -1,4 +1,6 @@ -#include "common.h" +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "plugin_freebsd.h" #include <sys/vmmeter.h> #include <vm/vm_param.h> @@ -84,6 +86,10 @@ typedef struct __vmmeter vmmeter_t; typedef struct vmmeter vmmeter_t; #endif +#if (__FreeBSD_version >= 1101516 && __FreeBSD_version < 1200000) || __FreeBSD_version >= 1200015 +#define NETDATA_COLLECT_LAUNDRY 1 +#endif + // -------------------------------------------------------------------------------------------------------------------- // FreeBSD plugin initialization @@ -141,9 +147,9 @@ int do_vm_loadavg(int update_every, usec_t dt){ NULL, "System Load Average", "load", - "freebsd", + "freebsd.plugin", "vm.loadavg", - 100, + NETDATA_CHART_PRIO_SYSTEM_LOAD, (update_every < MIN_LOADAVG_UPDATE_EVERY) ? MIN_LOADAVG_UPDATE_EVERY : update_every, RRDSET_TYPE_LINE ); @@ -210,9 +216,9 @@ int do_vm_vmtotal(int update_every, usec_t dt) { NULL, "System Active Processes", "processes", - "freebsd", + "freebsd.plugin", "vm.vmtotal", - 750, + NETDATA_CHART_PRIO_SYSTEM_ACTIVE_PROCESSES, update_every, RRDSET_TYPE_LINE ); @@ -239,9 +245,9 @@ int do_vm_vmtotal(int update_every, usec_t dt) { NULL, "System Processes", "processes", - "freebsd", + "freebsd.plugin", "vm.vmtotal", - 600, + NETDATA_CHART_PRIO_SYSTEM_PROCESSES, update_every, RRDSET_TYPE_LINE ); @@ -271,7 +277,7 @@ int do_vm_vmtotal(int update_every, usec_t dt) { NULL, "Committed (Allocated) Memory", "MB", - "freebsd", + "freebsd.plugin", "vm.vmtotal", NETDATA_CHART_PRIO_MEM_SYSTEM_COMMITTED, update_every, @@ -330,9 +336,10 @@ int do_kern_cp_time(int update_every, usec_t dt) { "system.cpu", "Total CPU utilization", "percentage", - "freebsd", + "freebsd.plugin", "kern.cp_time", - 100, update_every, + NETDATA_CHART_PRIO_SYSTEM_CPU, + update_every, RRDSET_TYPE_STACKED ); @@ -411,9 +418,9 @@ int do_kern_cp_times(int update_every, usec_t dt) { "cpu.cpu", "Core utilization", "percentage", - "freebsd", + "freebsd.plugin", "kern.cp_times", - 1000, + NETDATA_CHART_PRIO_CPU_PER_CORE, update_every, RRDSET_TYPE_STACKED ); @@ -495,9 +502,9 @@ int do_dev_cpu_temperature(int update_every, usec_t dt) { "cpu.temperatute", "Core temperature", "Celsius", - "freebsd", + "freebsd.plugin", "dev.cpu.temperature", - 1050, + NETDATA_CHART_PRIO_CPU_TEMPERATURE, update_every, RRDSET_TYPE_LINE ); @@ -548,9 +555,9 @@ int do_dev_cpu_0_freq(int update_every, usec_t dt) { NULL, "Current CPU Scaling Frequency", "MHz", - "freebsd", + "freebsd.plugin", "dev.cpu.0.freq", - 5003, + NETDATA_CHART_PRIO_CPUFREQ_SCALING_CUR_FREQ, update_every, RRDSET_TYPE_LINE ); @@ -612,9 +619,9 @@ int do_hw_intcnt(int update_every, usec_t dt) { NULL, "Total Hardware Interrupts", "interrupts/s", - "freebsd", + "freebsd.plugin", "hw.intrcnt", - 900, + NETDATA_CHART_PRIO_SYSTEM_INTR, update_every, RRDSET_TYPE_LINE ); @@ -657,9 +664,9 @@ int do_hw_intcnt(int update_every, usec_t dt) { NULL, "System interrupts", "interrupts/s", - "freebsd", + "freebsd.plugin", "hw.intrcnt", - 1000, + NETDATA_CHART_PRIO_SYSTEM_INTERRUPTS, update_every, RRDSET_TYPE_STACKED ); @@ -715,9 +722,9 @@ int do_vm_stats_sys_v_intr(int update_every, usec_t dt) { NULL, "Device Interrupts", "interrupts/s", - "freebsd", + "freebsd.plugin", "vm.stats.sys.v_intr", - 1000, + NETDATA_CHART_PRIO_SYSTEM_DEV_INTR, update_every, RRDSET_TYPE_LINE ); @@ -761,9 +768,9 @@ int do_vm_stats_sys_v_soft(int update_every, usec_t dt) { NULL, "Software Interrupts", "interrupts/s", - "freebsd", + "freebsd.plugin", "vm.stats.sys.v_soft", - 1100, + NETDATA_CHART_PRIO_SYSTEM_SOFT_INTR, update_every, RRDSET_TYPE_LINE ); @@ -807,9 +814,9 @@ int do_vm_stats_sys_v_swtch(int update_every, usec_t dt) { NULL, "CPU Context Switches", "context switches/s", - "freebsd", + "freebsd.plugin", "vm.stats.sys.v_swtch", - 800, + NETDATA_CHART_PRIO_SYSTEM_CTXT, update_every, RRDSET_TYPE_LINE ); @@ -853,9 +860,9 @@ int do_vm_stats_sys_v_forks(int update_every, usec_t dt) { NULL, "Started Processes", "processes/s", - "freebsd", + "freebsd.plugin", "vm.stats.sys.v_swtch", - 700, + NETDATA_CHART_PRIO_SYSTEM_FORKS, update_every, RRDSET_TYPE_LINE ); @@ -930,9 +937,9 @@ int do_vm_swap_info(int update_every, usec_t dt) { NULL, "System Swap", "MB", - "freebsd", + "freebsd.plugin", "vm.swap_info", - 201, + NETDATA_CHART_PRIO_SYSTEM_SWAP, update_every, RRDSET_TYPE_STACKED ); @@ -958,7 +965,8 @@ int do_vm_swap_info(int update_every, usec_t dt) { int do_system_ram(int update_every, usec_t dt) { (void)dt; static int mib_active_count[4] = {0, 0, 0, 0}, mib_inactive_count[4] = {0, 0, 0, 0}, mib_wire_count[4] = {0, 0, 0, 0}, - mib_cache_count[4] = {0, 0, 0, 0}, mib_vfs_bufspace[2] = {0, 0}, mib_free_count[4] = {0, 0, 0, 0}; + mib_cache_count[4] = {0, 0, 0, 0}, mib_laundry_count[4] = {0, 0, 0, 0}, mib_vfs_bufspace[2] = {0, 0}, + mib_free_count[4] = {0, 0, 0, 0}; vmmeter_t vmmeter_data; int vfs_bufspace_count; @@ -968,6 +976,9 @@ int do_system_ram(int update_every, usec_t dt) { #if __FreeBSD_version < 1200016 GETSYSCTL_SIMPLE("vm.stats.vm.v_cache_count", mib_cache_count, vmmeter_data.v_cache_count) || #endif +#if defined(NETDATA_COLLECT_LAUNDRY) + GETSYSCTL_SIMPLE("vm.stats.vm.v_laundry_count", mib_laundry_count, vmmeter_data.v_laundry_count) || +#endif GETSYSCTL_SIMPLE("vfs.bufspace", mib_vfs_bufspace, vfs_bufspace_count) || GETSYSCTL_SIMPLE("vm.stats.vm.v_free_count", mib_free_count, vmmeter_data.v_free_count))) { error("DISABLED: system.ram chart"); @@ -978,8 +989,8 @@ int do_system_ram(int update_every, usec_t dt) { // -------------------------------------------------------------------- static RRDSET *st = NULL; - static RRDDIM *rd_free = NULL, *rd_active = NULL, *rd_inactive = NULL, - *rd_wired = NULL, *rd_cache = NULL, *rd_buffers = NULL; + static RRDDIM *rd_free = NULL, *rd_active = NULL, *rd_inactive = NULL, *rd_wired = NULL, + *rd_cache = NULL, *rd_laundry = NULL, *rd_buffers = NULL; if (unlikely(!st)) { st = rrdset_create_localhost( @@ -990,9 +1001,9 @@ int do_system_ram(int update_every, usec_t dt) { NULL, "System RAM", "MB", - "freebsd", + "freebsd.plugin", "system.ram", - 200, + NETDATA_CHART_PRIO_SYSTEM_RAM, update_every, RRDSET_TYPE_STACKED ); @@ -1004,6 +1015,9 @@ int do_system_ram(int update_every, usec_t dt) { #if __FreeBSD_version < 1200016 rd_cache = rrddim_add(st, "cache", NULL, system_pagesize, MEGA_FACTOR, RRD_ALGORITHM_ABSOLUTE); #endif +#if defined(NETDATA_COLLECT_LAUNDRY) + rd_laundry = rrddim_add(st, "laundry", NULL, system_pagesize, MEGA_FACTOR, RRD_ALGORITHM_ABSOLUTE); +#endif rd_buffers = rrddim_add(st, "buffers", NULL, 1, MEGA_FACTOR, RRD_ALGORITHM_ABSOLUTE); } else rrdset_next(st); @@ -1015,6 +1029,9 @@ int do_system_ram(int update_every, usec_t dt) { #if __FreeBSD_version < 1200016 rrddim_set_by_pointer(st, rd_cache, vmmeter_data.v_cache_count); #endif +#if defined(NETDATA_COLLECT_LAUNDRY) + rrddim_set_by_pointer(st, rd_laundry, vmmeter_data.v_laundry_count); +#endif rrddim_set_by_pointer(st, rd_buffers, vfs_bufspace_count); rrdset_done(st); } @@ -1051,9 +1068,9 @@ int do_vm_stats_sys_v_swappgs(int update_every, usec_t dt) { NULL, "Swap I/O", "kilobytes/s", - "freebsd", + "freebsd.plugin", "vm.stats.vm.v_swappgs", - 250, + NETDATA_CHART_PRIO_SYSTEM_SWAPIO, update_every, RRDSET_TYPE_AREA ); @@ -1105,7 +1122,7 @@ int do_vm_stats_sys_v_pgfaults(int update_every, usec_t dt) { NULL, "Memory Page Faults", "page faults/s", - "freebsd", + "freebsd.plugin", "vm.stats.vm.v_pgfaults", NETDATA_CHART_PRIO_MEM_SYSTEM_PGFAULTS, update_every, @@ -1187,9 +1204,9 @@ int do_kern_ipc_sem(int update_every, usec_t dt) { NULL, "IPC Semaphores", "semaphores", - "freebsd", + "freebsd.plugin", "kern.ipc.sem", - 1000, + NETDATA_CHART_PRIO_SYSTEM_IPC_SEMAPHORES, update_every, RRDSET_TYPE_AREA ); @@ -1212,9 +1229,9 @@ int do_kern_ipc_sem(int update_every, usec_t dt) { NULL, "IPC Semaphore Arrays", "arrays", - "freebsd", + "freebsd.plugin", "kern.ipc.sem", - 1000, + NETDATA_CHART_PRIO_SYSTEM_IPC_SEM_ARRAYS, update_every, RRDSET_TYPE_AREA ); @@ -1286,9 +1303,9 @@ int do_kern_ipc_shm(int update_every, usec_t dt) { NULL, "IPC Shared Memory Segments", "segments", - "freebsd", + "freebsd.plugin", "kern.ipc.shm", - 1000, + NETDATA_CHART_PRIO_SYSTEM_IPC_SHARED_MEM_SEGS, update_every, RRDSET_TYPE_AREA ); @@ -1311,9 +1328,9 @@ int do_kern_ipc_shm(int update_every, usec_t dt) { NULL, "IPC Shared Memory Segments Size", "kilobytes", - "freebsd", + "freebsd.plugin", "kern.ipc.shm", - 1000, + NETDATA_CHART_PRIO_SYSTEM_IPC_SHARED_MEM_SIZE, update_every, RRDSET_TYPE_AREA ); @@ -1391,9 +1408,9 @@ int do_kern_ipc_msq(int update_every, usec_t dt) { NULL, "Number of IPC Message Queues", "queues", - "freebsd", + "freebsd.plugin", "kern.ipc.msq", - 990, + NETDATA_CHART_PRIO_SYSTEM_IPC_MSQ_QUEUES, update_every, RRDSET_TYPE_AREA ); @@ -1416,9 +1433,9 @@ int do_kern_ipc_msq(int update_every, usec_t dt) { NULL, "Number of Messages in IPC Message Queues", "messages", - "freebsd", + "freebsd.plugin", "kern.ipc.msq", - 1000, + NETDATA_CHART_PRIO_SYSTEM_IPC_MSQ_MESSAGES, update_every, RRDSET_TYPE_AREA ); @@ -1441,9 +1458,9 @@ int do_kern_ipc_msq(int update_every, usec_t dt) { NULL, "Size of IPC Message Queues", "bytes", - "freebsd", + "freebsd.plugin", "kern.ipc.msq", - 1100, + NETDATA_CHART_PRIO_SYSTEM_IPC_MSQ_SIZE, update_every, RRDSET_TYPE_LINE ); @@ -1485,9 +1502,9 @@ int do_uptime(int update_every, usec_t dt) { NULL, "System Uptime", "seconds", - "freebsd", + "freebsd.plugin", "uptime", - 1000, + NETDATA_CHART_PRIO_SYSTEM_UPTIME, update_every, RRDSET_TYPE_LINE ); @@ -1613,9 +1630,9 @@ int do_net_isr(int update_every, usec_t dt) { NULL, "System softnet_stat", "events/s", - "freebsd", + "freebsd.plugin", "net.isr", - 955, + NETDATA_CHART_PRIO_SYSTEM_SOFTNET_STAT, update_every, RRDSET_TYPE_LINE ); @@ -1666,9 +1683,9 @@ int do_net_isr(int update_every, usec_t dt) { NULL, "Per CPU netisr statistics", "events/s", - "freebsd", + "freebsd.plugin", "net.isr", - 1101 + i, + NETDATA_CHART_PRIO_SOFTNET_PER_CORE + i, update_every, RRDSET_TYPE_LINE ); @@ -1728,7 +1745,7 @@ int do_net_inet_tcp_states(int update_every, usec_t dt) { NULL, "IPv4 TCP Connections", "active connections", - "freebsd", + "freebsd.plugin", "net.inet.tcp.states", 2500, update_every, @@ -1812,7 +1829,7 @@ int do_net_inet_tcp_stats(int update_every, usec_t dt) { NULL, "IPv4 TCP Packets", "packets/s", - "freebsd", + "freebsd.plugin", "net.inet.tcp.stats", 2600, update_every, @@ -1844,7 +1861,7 @@ int do_net_inet_tcp_stats(int update_every, usec_t dt) { NULL, "IPv4 TCP Errors", "packets/s", - "freebsd", + "freebsd.plugin", "net.inet.tcp.stats", 2700, update_every, @@ -1886,7 +1903,7 @@ int do_net_inet_tcp_stats(int update_every, usec_t dt) { NULL, "IPv4 TCP Handshake Issues", "events/s", - "freebsd", + "freebsd.plugin", "net.inet.tcp.stats", 2900, update_every, @@ -1927,7 +1944,7 @@ int do_net_inet_tcp_stats(int update_every, usec_t dt) { NULL, "TCP Connection Aborts", "connections/s", - "freebsd", + "freebsd.plugin", "net.inet.tcp.stats", 3010, update_every, @@ -1967,7 +1984,7 @@ int do_net_inet_tcp_stats(int update_every, usec_t dt) { NULL, "TCP Out-Of-Order Queue", "packets/s", - "freebsd", + "freebsd.plugin", "net.inet.tcp.stats", 3050, update_every, @@ -1999,7 +2016,7 @@ int do_net_inet_tcp_stats(int update_every, usec_t dt) { NULL, "TCP SYN Cookies", "packets/s", - "freebsd", + "freebsd.plugin", "net.inet.tcp.stats", 3100, update_every, @@ -2036,7 +2053,7 @@ int do_net_inet_tcp_stats(int update_every, usec_t dt) { NULL, "TCP Listen Socket Issues", "packets/s", - "freebsd", + "freebsd.plugin", "net.inet.tcp.stats", 3015, update_every, @@ -2070,7 +2087,7 @@ int do_net_inet_tcp_stats(int update_every, usec_t dt) { NULL, "IPv4 ECN Statistics", "packets/s", - "freebsd", + "freebsd.plugin", "net.inet.tcp.stats", 8700, update_every, @@ -2144,7 +2161,7 @@ int do_net_inet_udp_stats(int update_every, usec_t dt) { NULL, "IPv4 UDP Packets", "packets/s", - "freebsd", + "freebsd.plugin", "net.inet.udp.stats", 2601, update_every, @@ -2177,7 +2194,7 @@ int do_net_inet_udp_stats(int update_every, usec_t dt) { NULL, "IPv4 UDP Errors", "events/s", - "freebsd", + "freebsd.plugin", "net.inet.udp.stats", 2701, update_every, @@ -2263,7 +2280,7 @@ int do_net_inet_icmp_stats(int update_every, usec_t dt) { , NULL , "IPv4 ICMP Packets" , "packets/s" - , "freebsd" + , "freebsd.plugin" , "net.inet.icmp.stats" , 2602 , update_every @@ -2296,7 +2313,7 @@ int do_net_inet_icmp_stats(int update_every, usec_t dt) { , NULL , "IPv4 ICMP Errors" , "packets/s" - , "freebsd" + , "freebsd.plugin" , "net.inet.icmp.stats" , 2603 , update_every @@ -2332,7 +2349,7 @@ int do_net_inet_icmp_stats(int update_every, usec_t dt) { , NULL , "IPv4 ICMP Messages" , "packets/s" - , "freebsd" + , "freebsd.plugin" , "net.inet.icmp.stats" , 2604 , update_every @@ -2410,7 +2427,7 @@ int do_net_inet_ip_stats(int update_every, usec_t dt) { NULL, "IPv4 Packets", "packets/s", - "freebsd", + "freebsd.plugin", "net.inet.ip.stats", 3000, update_every, @@ -2446,7 +2463,7 @@ int do_net_inet_ip_stats(int update_every, usec_t dt) { NULL, "IPv4 Fragments Sent", "packets/s", - "freebsd", + "freebsd.plugin", "net.inet.ip.stats", 3010, update_every, @@ -2482,7 +2499,7 @@ int do_net_inet_ip_stats(int update_every, usec_t dt) { NULL, "IPv4 Fragments Reassembly", "packets/s", - "freebsd", + "freebsd.plugin", "net.inet.ip.stats", 3011, update_every, @@ -2520,7 +2537,7 @@ int do_net_inet_ip_stats(int update_every, usec_t dt) { NULL, "IPv4 Errors", "packets/s", - "freebsd", + "freebsd.plugin", "net.inet.ip.stats", 3002, update_every, @@ -2611,7 +2628,7 @@ int do_net_inet6_ip6_stats(int update_every, usec_t dt) { NULL, "IPv6 Packets", "packets/s", - "freebsd", + "freebsd.plugin", "net.inet6.ip6.stats", 3000, update_every, @@ -2651,7 +2668,7 @@ int do_net_inet6_ip6_stats(int update_every, usec_t dt) { NULL, "IPv6 Fragments Sent", "packets/s", - "freebsd", + "freebsd.plugin", "net.inet6.ip6.stats", 3010, update_every, @@ -2691,7 +2708,7 @@ int do_net_inet6_ip6_stats(int update_every, usec_t dt) { NULL, "IPv6 Fragments Reassembly", "packets/s", - "freebsd", + "freebsd.plugin", "net.inet6.ip6.stats", 3011, update_every, @@ -2742,7 +2759,7 @@ int do_net_inet6_ip6_stats(int update_every, usec_t dt) { NULL, "IPv6 Errors", "packets/s", - "freebsd", + "freebsd.plugin", "net.inet6.ip6.stats", 3002, update_every, @@ -2856,7 +2873,7 @@ int do_net_inet6_icmp6_stats(int update_every, usec_t dt) { NULL, "IPv6 ICMP Messages", "messages/s", - "freebsd", + "freebsd.plugin", "net.inet6.icmp6.stats", 10000, update_every, @@ -2891,7 +2908,7 @@ int do_net_inet6_icmp6_stats(int update_every, usec_t dt) { NULL, "IPv6 ICMP Redirects", "redirects/s", - "freebsd", + "freebsd.plugin", "net.inet6.icmp6.stats", 10050, update_every, @@ -2938,7 +2955,7 @@ int do_net_inet6_icmp6_stats(int update_every, usec_t dt) { NULL, "IPv6 ICMP Errors", "errors/s", - "freebsd", + "freebsd.plugin", "net.inet6.icmp6.stats", 10100, update_every, @@ -2993,7 +3010,7 @@ int do_net_inet6_icmp6_stats(int update_every, usec_t dt) { NULL, "IPv6 ICMP Echo", "messages/s", - "freebsd", + "freebsd.plugin", "net.inet6.icmp6.stats", 10200, update_every, @@ -3036,7 +3053,7 @@ int do_net_inet6_icmp6_stats(int update_every, usec_t dt) { NULL, "IPv6 Router Messages", "messages/s", - "freebsd", + "freebsd.plugin", "net.inet6.icmp6.stats", 10400, update_every, @@ -3079,7 +3096,7 @@ int do_net_inet6_icmp6_stats(int update_every, usec_t dt) { NULL, "IPv6 Neighbor Messages", "messages/s", - "freebsd", + "freebsd.plugin", "net.inet6.icmp6.stats", 10500, update_every, @@ -3129,7 +3146,7 @@ int do_net_inet6_icmp6_stats(int update_every, usec_t dt) { NULL, "IPv6 ICMP Types", "messages/s", - "freebsd", + "freebsd.plugin", "net.inet6.icmp6.stats", 10700, update_every, diff --git a/src/plugin_freebsd.c b/collectors/freebsd.plugin/plugin_freebsd.c index a0d3dc2ea..5cde37113 100644 --- a/src/plugin_freebsd.c +++ b/collectors/freebsd.plugin/plugin_freebsd.c @@ -1,4 +1,6 @@ -#include "common.h" +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "plugin_freebsd.h" static struct freebsd_module { const char *name; @@ -113,7 +115,7 @@ void *freebsd_main(void *ptr) { debug(D_PROCNETDEV_LOOP, "FREEBSD calling %s.", pm->name); 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; if(unlikely(netdata_exit)) break; diff --git a/collectors/freebsd.plugin/plugin_freebsd.h b/collectors/freebsd.plugin/plugin_freebsd.h new file mode 100644 index 000000000..ab46080be --- /dev/null +++ b/collectors/freebsd.plugin/plugin_freebsd.h @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef NETDATA_PLUGIN_FREEBSD_H +#define NETDATA_PLUGIN_FREEBSD_H 1 + +#include "daemon/common.h" + +#if (TARGET_OS == OS_FREEBSD) + +#define NETDATA_PLUGIN_HOOK_FREEBSD \ + { \ + .name = "PLUGIN[freebsd]", \ + .config_section = CONFIG_SECTION_PLUGINS, \ + .config_name = "freebsd", \ + .enabled = 1, \ + .thread = NULL, \ + .init_routine = NULL, \ + .start_routine = freebsd_main \ + }, + + +#include <sys/sysctl.h> + +#define KILO_FACTOR 1024 +#define MEGA_FACTOR 1048576 // 1024 * 1024 +#define GIGA_FACTOR 1073741824 // 1024 * 1024 * 1024 + +#define MAX_INT_DIGITS 10 // maximum number of digits for int + +void *freebsd_main(void *ptr); + +extern int freebsd_plugin_init(); + +extern int do_vm_loadavg(int update_every, usec_t dt); +extern int do_vm_vmtotal(int update_every, usec_t dt); +extern int do_kern_cp_time(int update_every, usec_t dt); +extern int do_kern_cp_times(int update_every, usec_t dt); +extern int do_dev_cpu_temperature(int update_every, usec_t dt); +extern int do_dev_cpu_0_freq(int update_every, usec_t dt); +extern int do_hw_intcnt(int update_every, usec_t dt); +extern int do_vm_stats_sys_v_intr(int update_every, usec_t dt); +extern int do_vm_stats_sys_v_soft(int update_every, usec_t dt); +extern int do_vm_stats_sys_v_swtch(int update_every, usec_t dt); +extern int do_vm_stats_sys_v_forks(int update_every, usec_t dt); +extern int do_vm_swap_info(int update_every, usec_t dt); +extern int do_system_ram(int update_every, usec_t dt); +extern int do_vm_stats_sys_v_swappgs(int update_every, usec_t dt); +extern int do_vm_stats_sys_v_pgfaults(int update_every, usec_t dt); +extern int do_kern_ipc_sem(int update_every, usec_t dt); +extern int do_kern_ipc_shm(int update_every, usec_t dt); +extern int do_kern_ipc_msq(int update_every, usec_t dt); +extern int do_uptime(int update_every, usec_t dt); +extern int do_net_isr(int update_every, usec_t dt); +extern int do_net_inet_tcp_states(int update_every, usec_t dt); +extern int do_net_inet_tcp_stats(int update_every, usec_t dt); +extern int do_net_inet_udp_stats(int update_every, usec_t dt); +extern int do_net_inet_icmp_stats(int update_every, usec_t dt); +extern int do_net_inet_ip_stats(int update_every, usec_t dt); +extern int do_net_inet6_ip6_stats(int update_every, usec_t dt); +extern int do_net_inet6_icmp6_stats(int update_every, usec_t dt); +extern int do_getifaddrs(int update_every, usec_t dt); +extern int do_getmntinfo(int update_every, usec_t dt); +extern int do_kern_devstat(int update_every, usec_t dt); +extern int do_kstat_zfs_misc_arcstats(int update_every, usec_t dt); +extern int do_kstat_zfs_misc_zio_trim(int update_every, usec_t dt); +extern int do_ipfw(int update_every, usec_t dt); + +#else // (TARGET_OS == OS_FREEBSD) + +#define NETDATA_PLUGIN_HOOK_FREEBSD + +#endif // (TARGET_OS == OS_FREEBSD) + +#endif /* NETDATA_PLUGIN_FREEBSD_H */ |