Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jmxfetch] clean jmx status python file #1655

Merged
merged 1 commit into from
Jun 3, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion jmxfetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down