diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-06 16:11:30 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-06 16:11:30 +0000 |
commit | aa2fe8ccbfcb117efa207d10229eeeac5d0f97c7 (patch) | |
tree | 941cbdd387b41c1a81587c20a6df9f0e5e0ff7ab /collectors/python.d.plugin/logind | |
parent | Adding upstream version 1.37.1. (diff) | |
download | netdata-upstream/1.38.0.tar.xz netdata-upstream/1.38.0.zip |
Adding upstream version 1.38.0.upstream/1.38.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/python.d.plugin/logind')
-rw-r--r-- | collectors/python.d.plugin/logind/Makefile.inc | 13 | ||||
-rw-r--r-- | collectors/python.d.plugin/logind/README.md | 86 | ||||
-rw-r--r-- | collectors/python.d.plugin/logind/logind.chart.py | 85 | ||||
-rw-r--r-- | collectors/python.d.plugin/logind/logind.conf | 60 |
4 files changed, 0 insertions, 244 deletions
diff --git a/collectors/python.d.plugin/logind/Makefile.inc b/collectors/python.d.plugin/logind/Makefile.inc deleted file mode 100644 index adadab120..000000000 --- a/collectors/python.d.plugin/logind/Makefile.inc +++ /dev/null @@ -1,13 +0,0 @@ -# SPDX-License-Identifier: GPL-3.0-or-later - -# THIS IS NOT A COMPLETE Makefile -# IT IS INCLUDED BY ITS PARENT'S Makefile.am -# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT - -# install these files -dist_python_DATA += logind/logind.chart.py -dist_pythonconfig_DATA += logind/logind.conf - -# do not install these files, but include them in the distribution -dist_noinst_DATA += logind/README.md logind/Makefile.inc - diff --git a/collectors/python.d.plugin/logind/README.md b/collectors/python.d.plugin/logind/README.md deleted file mode 100644 index 442d388d0..000000000 --- a/collectors/python.d.plugin/logind/README.md +++ /dev/null @@ -1,86 +0,0 @@ -<!-- -title: "systemd-logind monitoring with Netdata" -custom_edit_url: https://github.com/netdata/netdata/edit/master/collectors/python.d.plugin/logind/README.md -sidebar_label: "systemd-logind" ---> - -# Systemd-Logind monitoring with Netdata - -Monitors active sessions, users, and seats tracked by `systemd-logind` or `elogind`. - -It provides the following charts: - -1. **Sessions** Tracks the total number of sessions. - - - Graphical: Local graphical sessions (running X11, or Wayland, or something else). - - Console: Local console sessions. - - Remote: Remote sessions. - -2. **Users** Tracks total number of unique user logins of each type. - - - Graphical - - Console - - Remote - -3. **Seats** Total number of seats in use. - - - Seats - -## Enable the collector - -The `logind` collector is disabled by default. To enable it, use `edit-config` from the Netdata [config -directory](/docs/configure/nodes.md), which is typically at `/etc/netdata`, to edit the `python.d.conf` file. - -```bash -cd /etc/netdata # Replace this path with your Netdata config directory, if different -sudo ./edit-config python.d.conf -``` - -Change the value of the `logind` setting to `yes`. Save the file and restart the Netdata Agent with `sudo systemctl -restart netdata`, or the appropriate method for your system, to finish enabling the `logind` collector. - -## Configuration - -This module needs no configuration. Just make sure the `netdata` user -can run the `loginctl` command and get a session list without having to -specify a path. - -This will work with any command that can output data in the _exact_ -same format as `loginctl list-sessions --no-legend`. If you have some -other command you want to use that outputs data in this format, you can -specify it using the `command` key like so: - -```yaml -command: '/path/to/other/command' -``` - -Edit the `python.d/logind.conf` configuration file using `edit-config` from the Netdata [config -directory](/docs/configure/nodes.md), which is typically at `/etc/netdata`. - -```bash -cd /etc/netdata # Replace this path with your Netdata config directory, if different -sudo ./edit-config python.d/logind.conf -``` - -## Notes - -- This module's ability to track logins is dependent on what PAM services - are configured to register sessions with logind. In particular, for - most systems, it will only track TTY logins, local desktop logins, - and logins through remote shell connections. - -- The users chart counts _usernames_ not UID's. This is potentially - important in configurations where multiple users have the same UID. - -- The users chart counts any given user name up to once for _each_ type - of login. So if the same user has a graphical and a console login on a - system, they will show up once in the graphical count, and once in the - console count. - -- Because the data collection process is rather expensive, this plugin - is currently disabled by default, and needs to be explicitly enabled in - `/etc/netdata/python.d.conf` before it will run. - ---- - - diff --git a/collectors/python.d.plugin/logind/logind.chart.py b/collectors/python.d.plugin/logind/logind.chart.py deleted file mode 100644 index 708668649..000000000 --- a/collectors/python.d.plugin/logind/logind.chart.py +++ /dev/null @@ -1,85 +0,0 @@ -# -*- coding: utf-8 -*- -# Description: logind netdata python.d module -# Author: Austin S. Hemmelgarn (Ferroin) -# SPDX-License-Identifier: GPL-3.0-or-later - -from bases.FrameworkServices.ExecutableService import ExecutableService - -priority = 59999 -disabled_by_default = True - -LOGINCTL_COMMAND = 'loginctl list-sessions --no-legend' - -ORDER = [ - 'sessions', - 'users', - 'seats', -] - -CHARTS = { - 'sessions': { - 'options': [None, 'Logind Sessions', 'sessions', 'sessions', 'logind.sessions', 'stacked'], - 'lines': [ - ['sessions_graphical', 'Graphical', 'absolute', 1, 1], - ['sessions_console', 'Console', 'absolute', 1, 1], - ['sessions_remote', 'Remote', 'absolute', 1, 1] - ] - }, - 'users': { - 'options': [None, 'Logind Users', 'users', 'users', 'logind.users', 'stacked'], - 'lines': [ - ['users_graphical', 'Graphical', 'absolute', 1, 1], - ['users_console', 'Console', 'absolute', 1, 1], - ['users_remote', 'Remote', 'absolute', 1, 1] - ] - }, - 'seats': { - 'options': [None, 'Logind Seats', 'seats', 'seats', 'logind.seats', 'line'], - 'lines': [ - ['seats', 'Active Seats', 'absolute', 1, 1] - ] - } -} - - -class Service(ExecutableService): - def __init__(self, configuration=None, name=None): - ExecutableService.__init__(self, configuration=configuration, name=name) - self.order = ORDER - self.definitions = CHARTS - self.command = LOGINCTL_COMMAND - - def _get_data(self): - ret = { - 'sessions_graphical': 0, - 'sessions_console': 0, - 'sessions_remote': 0, - } - users = { - 'graphical': list(), - 'console': list(), - 'remote': list() - } - seats = list() - data = self._get_raw_data() - - for item in data: - fields = item.split() - if len(fields) == 3: - users['remote'].append(fields[2]) - ret['sessions_remote'] += 1 - elif len(fields) == 4: - users['graphical'].append(fields[2]) - ret['sessions_graphical'] += 1 - seats.append(fields[3]) - elif len(fields) == 5: - users['console'].append(fields[2]) - ret['sessions_console'] += 1 - seats.append(fields[3]) - - ret['users_graphical'] = len(set(users['graphical'])) - ret['users_console'] = len(set(users['console'])) - ret['users_remote'] = len(set(users['remote'])) - ret['seats'] = len(set(seats)) - - return ret diff --git a/collectors/python.d.plugin/logind/logind.conf b/collectors/python.d.plugin/logind/logind.conf deleted file mode 100644 index 01a859d21..000000000 --- a/collectors/python.d.plugin/logind/logind.conf +++ /dev/null @@ -1,60 +0,0 @@ -# netdata python.d.plugin configuration for logind -# -# This file is in YaML format. Generally the format is: -# -# name: value -# -# There are 2 sections: -# - global variables -# - one or more JOBS -# -# JOBS allow you to collect values from multiple sources. -# Each source will have its own set of charts. -# -# JOB parameters have to be indented (using spaces only, example below). - -# ---------------------------------------------------------------------- -# Global Variables -# These variables set the defaults for all JOBs, however each JOB -# may define its own, overriding the defaults. - -# update_every sets the default data collection frequency. -# If unset, the python.d.plugin default is used. -# update_every: 1 - -# priority controls the order of charts at the netdata dashboard. -# Lower numbers move the charts towards the top of the page. -# If unset, the default for python.d.plugin is used. -# priority: 60000 - -# penalty indicates whether to apply penalty to update_every in case of failures. -# Penalty will increase every 5 failed updates in a row. Maximum penalty is 10 minutes. -# penalty: yes - -# autodetection_retry sets the job re-check interval in seconds. -# The job is not deleted if check fails. -# Attempts to start the job are made once every autodetection_retry. -# This feature is disabled by default. -# autodetection_retry: 0 - -# ---------------------------------------------------------------------- -# JOBS (data collection sources) -# -# The default JOBS share the same *name*. JOBS with the same name -# are mutually exclusive. Only one of them will be allowed running at -# any time. This allows autodetection to try several alternatives and -# pick the one that works. -# -# Any number of jobs is supported. -# -# All python.d.plugin JOBS (for all its modules) support a set of -# predefined parameters. These are: -# -# job_name: -# name: myname # the JOB's name as it will appear at the -# # dashboard (by default is the job_name) -# # JOBs sharing a name are mutually exclusive -# update_every: 1 # the JOB's data collection frequency -# priority: 60000 # the JOB's order on the dashboard -# penalty: yes # the JOB's penalty -# autodetection_retry: 0 # the JOB's re-check interval in seconds |