Apps Plugin - hilbix/netdata GitHub Wiki
This plugin provides charts for 3 sections of the default dashboard:
- Per application charts
- Per user charts
- Per user group charts
Per application charts
This plugin walks through the entire /proc
filesystem and aggregates statistics for applications of interest, defined in /etc/netdata/apps_groups.conf
(the default is here) (to edit it on your system run /etc/netdata/edit-config apps_groups.conf
).
The plugin internally builds a process tree (much like ps fax
does), and groups processes together (evaluating both child and parent processes) so that the result is always a chart with a predefined set of dimensions (of course, only application groups found running are reported).
Using this information it provides the following charts (per application group defined in /etc/netdata/apps_groups.conf
- to edit it on your system run /etc/netdata/edit-config apps_groups.conf
):
- Total CPU usage
- Total User CPU usage
- Total System CPU usage
- Total Disk Physical Reads
- Total Disk Physical Writes
- Total Disk Logical Reads
- Total Disk Logical Writes
- Total Open Files (unique files - if a file is found open multiple times, it is counted just once)
- Total Dedicated Memory (non shared)
- Total Minor Page Faults
- Total Number of Processes
- Total Number of Threads
- Total Number of Pipes
- Total Swap Activity (Major Page Faults)
- Total Open Sockets
Per User Charts
All the above charts, are also grouped by username, using the effective uid of each process.
Per Group Charts
All the above charts, are also grouped by group name, using the effective gid of each process.
CPU Usage
apps.plugin
is a complex software piece and has a lot of work to do (actually this plugin requires more CPU resources that the netdata daemon). For each process running, apps.plugin
reads several /proc
files to get CPU usage, memory allocated, I/O usage, open file descriptors, etc. Doing this work per-second, especially on hosts with several thousands of processes, may increase the CPU resources consumed by the plugin.
In such cases, you many need to lower its data collection frequency. To do this, edit /etc/netdata/netdata.conf
and find this section:
[plugin:apps]
# update every = 1
# command options =
Uncomment the line update every
and set it to a higher number. If you just set it to 2
, its CPU resources will be cut in half, and data collection will be once every 2 seconds.
Configuration
The configuration file is /etc/netdata/apps_groups.conf
(the default is here).
To edit it on your system run /etc/netdata/edit-config apps_groups.conf
.
The configuration file works accepts multiple lines, each having this format:
group: process1 process2 ...
Process names should be given as they appear when running ps -e
. The program will actually match the process names in the /proc/PID/status
file. So, to be sure the name is right for a process running with PID X
, do this:
cat /proc/X/status
The first line on the output is Name: xxxxx
. This is the process name apps.plugin
sees.
The order of the lines in the file is important only if you include the same process name to multiple groups.
Apps plugin is missing information
apps.plugin
requires additional privileges to collect all the information it needs. The problem is described in issue #157.
When netdata is installed, apps.plugin
is given the capabilities cap_dac_read_search,cap_sys_ptrace+ep
. If that is not possible (i.e. setcap
fails), apps.plugin
is setuid to root
.
linux capabilities in containers
There are a few cases, like docker
and virtuozzo
containers, where setcap
succeeds, but the capabilities are silently ignored (in lxc
containers setcap
fails).
In these cases that setcap
succeeds by capabilities do not work, you will have to setuid to root apps.plugin
by running these commands:
chown root:netdata /usr/libexec/netdata/plugins.d/apps.plugin
chmod 4750 /usr/libexec/netdata/plugins.d/apps.plugin
You will have to run these, every time you update netdata.
apps.plugin
these privileges?
Is is safe to give apps.plugin
performs a hard-coded function of building the process tree in memory, iterating forever, collecting metrics for each running process and sending them to netdata. This is a one-way communication, from apps.plugin
to netdata.
So, since apps.plugin
cannot be instructed by netdata for the actions it performs, we think it is pretty safe to allow it have these increased privileges.
Keep in mind that apps.plugin
will still run without these permissions, but it will not be able to collect all the data for every process.