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/logind.chart.py | |
parent | Adding upstream version 1.37.1. (diff) | |
download | netdata-aa2fe8ccbfcb117efa207d10229eeeac5d0f97c7.tar.xz netdata-aa2fe8ccbfcb117efa207d10229eeeac5d0f97c7.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/logind.chart.py')
-rw-r--r-- | collectors/python.d.plugin/logind/logind.chart.py | 85 |
1 files changed, 0 insertions, 85 deletions
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 |