3
3
import logging
4
4
import glob
5
5
import subprocess
6
- import tempfile
7
6
import time
8
7
import sys
9
8
import signal
10
9
11
10
# datadog
12
11
from util import get_os , yLoader , yDumper
13
- from config import get_config , get_confd_path , get_logging_config , \
12
+ from config import get_config , get_confd_path , get_jmx_status_path , get_logging_config , \
14
13
PathNotFound , DEFAULT_CHECK_FREQUENCY
15
14
16
15
# 3rd party
@@ -165,6 +164,8 @@ def _should_run(self, checks_list):
165
164
tools_jar_path = check_tools_jar_path
166
165
except InvalidJMXConfiguration , e :
167
166
log .error ("%s check does not have a valid JMX configuration: %s" % (check_name , e ))
167
+ # Make sure check_name is a string - Fix issues with Windows
168
+ check_name = check_name .encode ('ascii' , 'ignore' )
168
169
invalid_checks [check_name ] = str (e )
169
170
170
171
return (jmx_checks , invalid_checks , java_bin_path , java_options , tools_jar_path )
@@ -180,7 +181,7 @@ def _start(self, path_to_java, java_run_opts, jmx_checks, command, reporter, too
180
181
path_to_java = path_to_java or "java"
181
182
java_run_opts = java_run_opts or ""
182
183
path_to_jmxfetch = self ._get_path_to_jmxfetch ()
183
- path_to_status_file = os .path .join (tempfile . gettempdir (), "jmx_status.yaml" )
184
+ path_to_status_file = os .path .join (get_jmx_status_path (), "jmx_status.yaml" )
184
185
185
186
if tools_jar_path is None :
186
187
classpath = path_to_jmxfetch
@@ -234,7 +235,7 @@ def _write_status_file(self, invalid_checks):
234
235
'timestamp' : time .time (),
235
236
'invalid_checks' : invalid_checks
236
237
}
237
- stream = file (os .path .join (tempfile . gettempdir (), PYTHON_JMX_STATUS_FILE ), 'w' )
238
+ stream = file (os .path .join (get_jmx_status_path (), PYTHON_JMX_STATUS_FILE ), 'w' )
238
239
yaml .dump (data , stream , Dumper = yDumper )
239
240
stream .close ()
240
241
0 commit comments