From ba249a75143989ec7f77393b1b0942ad4bb174ab Mon Sep 17 00:00:00 2001 From: nicolargo Date: Wed, 27 Apr 2016 21:35:19 +0200 Subject: [PATCH] Add SystemV AMP --- conf/glances.conf | 12 ++++++++++-- glances/amps/glances_systemd.py | 8 ++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/conf/glances.conf b/conf/glances.conf index 274fc79a..1d35d691 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -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 diff --git a/glances/amps/glances_systemd.py b/glances/amps/glances_systemd.py index 602ee4c0..df2cad95 100644 --- a/glances/amps/glances_systemd.py +++ b/glances/amps/glances_systemd.py @@ -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: