Add SystemV AMP

pull/863/head
nicolargo 2016-04-27 21:35:19 +02:00
parent 4613342019
commit ba249a7514
2 changed files with 14 additions and 6 deletions

View File

@ -267,6 +267,14 @@ status_url=http://localhost/nginx_status
# Systemd
enable=true
regex=\/usr\/lib\/systemd\/systemd
refresh=30
refresh=60
one_line=true
systemctl_path=/usr/bin/systemctl --plain
systemctl_cmd=/usr/bin/systemctl --plain
[amp_systemv]
# Systemv
enable=true
regex=\/sbin\/init
refresh=10
one_line=true
service_cmd=/usr/bin/service --status-all

View File

@ -40,9 +40,9 @@ Configuration file example
# Systemd
enable=true
regex=\/usr\/lib\/systemd\/systemd
refresh=30
refresh=60
one_line=true
systemctl_path=/usr/bin/systemctl
systemctl_cmd=/usr/bin/systemctl --plain
"""
from subprocess import check_output
@ -70,9 +70,9 @@ class Amp(GlancesAmp):
if self.should_update():
# Get the systemctl status
logger.debug('{0}: Update stats using systemctl {1}'.format(self.NAME, self.get('systemctl_path')))
logger.debug('{0}: Update stats using systemctl {1}'.format(self.NAME, self.get('systemctl_cmd')))
try:
res = check_output(self.get('systemctl_path').split())
res = check_output(self.get('systemctl_cmd').split())
except OSError as e:
logger.debug('{0}: Error while executing systemctl ({1})'.format(self.NAME, e))
else: