diff --git a/conf/glances.conf b/conf/glances.conf index f0184bdf..7c090651 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -256,6 +256,7 @@ queue=glances_queue ###### [amp_dropbox] +# Use the default AMP which execute the command enable=true regex=.*dropbox.* refresh=3 @@ -286,3 +287,9 @@ regex=\/sbin\/init refresh=30 one_line=true service_cmd=/usr/bin/service --status-all + +[amp_python] +# Monitor all Python scripts +enable=true +regex=.*python.* +refresh=3 diff --git a/glances/amps/glances_nginx.py b/glances/amps/glances_nginx.py index a312680d..7b5cedf7 100644 --- a/glances/amps/glances_nginx.py +++ b/glances/amps/glances_nginx.py @@ -73,7 +73,7 @@ class Amp(GlancesAmp): # """Init the AMP.""" # super(Amp, self).__init__(args=args) - def update(self): + def update(self, process_list): """Update the AMP""" if self.should_update(): diff --git a/glances/amps/glances_systemd.py b/glances/amps/glances_systemd.py index df2cad95..4ee6feb6 100644 --- a/glances/amps/glances_systemd.py +++ b/glances/amps/glances_systemd.py @@ -65,7 +65,7 @@ class Amp(GlancesAmp): # """Init the AMP.""" # super(Amp, self).__init__(args=args) - def update(self): + def update(self, process_list): """Update the AMP""" if self.should_update(): diff --git a/glances/amps/glances_systemv.py b/glances/amps/glances_systemv.py index 7ef2256f..583f6b82 100644 --- a/glances/amps/glances_systemv.py +++ b/glances/amps/glances_systemv.py @@ -64,7 +64,7 @@ class Amp(GlancesAmp): # """Init the AMP.""" # super(Amp, self).__init__(args=args) - def update(self): + def update(self, process_list): """Update the AMP""" if self.should_update(): diff --git a/glances/amps_list.py b/glances/amps_list.py index a7ba7cf5..2635e530 100644 --- a/glances/amps_list.py +++ b/glances/amps_list.py @@ -108,10 +108,8 @@ class AmpsList(object): # At least one process is matching the regex logger.debug("AMPS: {} process detected (PID={})".format(k, amps_list[0]['pid'])) # Call the AMP update method - # TODO: should be non blocking - thread = threading.Thread(target=v.update) + thread = threading.Thread(target=v.update, args=[amps_list]) thread.start() - # v.update() return self.__amps_dict