Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

processes plugin: Add support for Linux Delay Accounting. #2598

Merged
merged 8 commits into from Dec 8, 2017
14 changes: 14 additions & 0 deletions Makefile.am
Expand Up @@ -1421,14 +1421,28 @@ python_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBPYTHON_CPPFLAGS)
python_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(LIBPYTHON_LDFLAGS)
endif

if HAVE_LIBMNL
noinst_LTLIBRARIES += libtaskstats.la
libtaskstats_la_SOURCES = \
src/utils_taskstats.c \
src/utils_taskstats.h
libtaskstats_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBMNL_CFLAGS)
libtaskstats_la_LIBADD = $(BUILD_WITH_LIBMNL_LIBS)
endif

if BUILD_PLUGIN_PROCESSES
pkglib_LTLIBRARIES += processes.la
processes_la_SOURCES = src/processes.c
processes_la_CPPFLAGS = $(AM_CPPFLAGS)
processes_la_LDFLAGS = $(PLUGIN_LDFLAGS)
processes_la_LIBADD =
if BUILD_WITH_LIBKVM_GETPROCS
processes_la_LIBADD += -lkvm
endif
if HAVE_LIBMNL
processes_la_CPPFLAGS += -DHAVE_LIBTASKSTATS=1
processes_la_LIBADD += libtaskstats.la
endif
endif

if BUILD_PLUGIN_PROTOCOLS
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Expand Up @@ -3668,6 +3668,7 @@ if test "x$with_libmnl" = "xyes"; then
fi
AC_SUBST([BUILD_WITH_LIBMNL_CFLAGS])
AC_SUBST([BUILD_WITH_LIBMNL_LIBS])
AM_CONDITIONAL([HAVE_LIBMNL], [test "x$with_libmnl" = "xyes"])
# }}}

# --with-libnetapp {{{
Expand Down
1 change: 1 addition & 0 deletions contrib/systemd.collectd.service
Expand Up @@ -22,6 +22,7 @@ ProtectHome=true
# intel_pmu CAP_SYS_ADMIN
# iptables CAP_NET_ADMIN
# ping CAP_NET_RAW
# processes CAP_NET_ADMIN (CollectDelayAccounting only)
# smart CAP_SYS_RAWIO
# turbostat CAP_SYS_RAWIO
#
Expand Down
2 changes: 2 additions & 0 deletions src/collectd.conf.in
Expand Up @@ -1200,11 +1200,13 @@
# CollectFileDescriptor true
# CollectContextSwitch true
# CollectMemoryMaps true
# CollectDelayAccounting false
# Process "name"
# ProcessMatch "name" "regex"
# <Process "collectd">
# CollectFileDescriptor false
# CollectContextSwitch false
# CollectDelayAccounting true
# </Process>
# <ProcessMatch "name" "regex">
# CollectFileDescriptor false
Expand Down
36 changes: 27 additions & 9 deletions src/collectd.conf.pod
Expand Up @@ -6842,22 +6842,25 @@ The statistics collected for matched processes are:
- number of memory mapped files (under Linux)
- io data (where available)
- context switches (under Linux)
- minor and major pagefaults.
- minor and major pagefaults
- Delay Accounting information (Linux only, requires libmnl)

B<Synopsis:>

<Plugin processes>
CollectFileDescriptor true
CollectContextSwitch true
CollectFileDescriptor true
CollectContextSwitch true
CollectDelayAccounting false
Process "name"
ProcessMatch "name" "regex"
<Process "collectd">
CollectFileDescriptor false
CollectContextSwitch false
CollectFileDescriptor false
CollectContextSwitch false
CollectDelayAccounting true
</Process>
<ProcessMatch "name" "regex">
CollectFileDescriptor false
CollectContextSwitch true
CollectContextSwitch true
</Process>
</Plugin>

Expand All @@ -6883,6 +6886,18 @@ I<name> must not contain slashes.
Collect the number of context switches for matched processes.
Disabled by default.

=item B<CollectDelayAccounting> I<Boolean>

If enabled, collect Linux Delay Accounding information for matching processes.
Delay Accounting provides the time processes wait for the CPU to become
available, for I/O operations to finish, for pages to be swapped in and for
freed pages to be reclaimed. The metrics are reported as "seconds per second"
using the C<delay_rate> type, e.g. C<delay_rate-delay-cpu>.
Disabled by default.

This option is only available on Linux, requires the C<libmnl> library and
requires the C<CAP_NET_ADMIN> capability at runtime.

=item B<CollectFileDescriptor> I<Boolean>

Collect number of file descriptors of matched processes.
Expand All @@ -6896,9 +6911,12 @@ the Linux kernel.

=back

Options B<CollectContextSwitch> and B<CollectFileDescriptor> may be used inside
B<Process> and B<ProcessMatch> blocks - then they affect corresponding match
only. Otherwise they set the default value for subsequent matches.
The B<CollectContextSwitch>, B<CollectDelayAccounting>,
B<CollectFileDescriptor> and B<CollectMemoryMaps> options may be used inside
B<Process> and B<ProcessMatch> blocks. When used there, these options affect
reporting the corresponding processes only. Outside of B<Process> and
B<ProcessMatch> blocks these options set the default value for subsequent
matches.

=head2 Plugin C<protocols>

Expand Down