diff --git a/jmxfetch.py b/jmxfetch.py index 0fe4bdd06a..94b228eabd 100644 --- a/jmxfetch.py +++ b/jmxfetch.py @@ -94,8 +94,10 @@ def register_signal_handlers(self): def configure(self, check_list=None): """ - Instantiate JMXFetch parameters. + Instantiate JMXFetch parameters, clean potential previous run leftovers. """ + _clean_status_file() + self.jmx_checks, self.invalid_checks, self.java_bin_path, self.java_options, self.tools_jar_path = \ self.get_configuration(check_list) @@ -384,6 +386,16 @@ def _get_path_to_jmxfetch(self): "jmxfetch", JMX_FETCH_JAR_NAME)) +def _clean_status_file(): + """ + Removes Python JMX status file + """ + try: + os.remove(os.path.join(get_jmx_status_path(), PYTHON_JMX_STATUS_FILE)) + except OSError: + pass + + def _get_jmx_appnames(): """ Retrieves the running JMX checks based on the {tmp}/jmx_status.yaml file