File: //lib/python3.6/site-packages/glances/amps/__pycache__/glances_systemd.cpython-36.opt-1.pyc
3
Eo�c
� @ sP d Z ddlmZmZ ddlmZ ddlmZmZ ddl m
Z
G dd� de
�ZdS ) a�
Systemd AMP
===========
Monitor the state of the systemd system and service (unit) manager.
How to read the stats
---------------------
active: Number of active units. This is usually a fairly basic way to tell if the
unit has started successfully or not.
loaded: Number of loaded units (unit's configuration has been parsed by systemd).
failed: Number of units with an active failed status.
Source reference: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units
Configuration file example
--------------------------
[amp_systemd]
# Systemd
enable=true
regex=\/usr\/lib\/systemd\/systemd
refresh=60
one_line=true
systemctl_cmd=/usr/bin/systemctl --plain
� )�check_output�CalledProcessError)�logger)� iteritems�to_ascii)�
GlancesAmpc @ s, e Zd ZdZdZdZdZdZdZdd� Z d S )
�AmpzGlances' Systemd AMP.ZSystemdz1.0z*Get services list from systemctl (systemd)Z Nicolargozcontact@nicolargo.comc C s4 t jdj| j| jd��� yt| jd�j� �}W n: ttfk
rj } zt jdj| j|�� W Y dd}~X n�X i }x�t |�jd�dd
� D ]f}|j� }t
|�dkr�xLtdd�D ]>}y||| d7 <