Description
Hello there,
I am trying to setup an unix shell check. As referenced here: https://help.datadoghq.com/hc/en-us/articles/115000722623-How-can-I-gather-metrics-from-the-UNIX-shell-
For some reason, running a simple command like ls -l /path/to/foo | wc -l was not working. I ended up writing a shell script to output X number. With the shell script it started to work fine.
But now I tried to pass arguments to it, and all I get now is:
`- instance #1 [ERROR]: '[Errno 2] No such file or directory'
Traceback (most recent call last):
File "/opt/datadog-agent/agent/checks/init.py", line 812, in run
self.check(copy.deepcopy(instance))
File "/opt/datadog-agent/agent/checks.d/shell.py", line 52, in check
output, _, _ = get_subprocess_output(command, self.log, True)
File "/opt/datadog-agent/agent/utils/subprocess_output.py", line 28, in get_subprocess_output
proc = subprocess.Popen(command, stdout=stdout_f, stderr=stderr_f)
File "/opt/datadog-agent/agent/utils/subprocess_output.py", line 55, in wrapper
return func(*params, **kwargs)
File "/opt/datadog-agent/embedded/lib/python2.7/subprocess.py", line 390, in init
errread, errwrite)
File "/opt/datadog-agent/embedded/lib/python2.7/subprocess.py", line 1025, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
- instance @fabrice Missing urllib import. Turned 2.6ism into 2.4 code. #2 [ERROR]: '[Errno 2] No such file or directory'
Traceback (most recent call last):
File "/opt/datadog-agent/agent/checks/init.py", line 812, in run
self.check(copy.deepcopy(instance))
File "/opt/datadog-agent/agent/checks.d/shell.py", line 52, in check
output, _, _ = get_subprocess_output(command, self.log, True)
File "/opt/datadog-agent/agent/utils/subprocess_output.py", line 28, in get_subprocess_output
proc = subprocess.Popen(command, stdout=stdout_f, stderr=stderr_f)
File "/opt/datadog-agent/agent/utils/subprocess_output.py", line 55, in wrapper
return func(*params, **kwargs)
File "/opt/datadog-agent/embedded/lib/python2.7/subprocess.py", line 390, in init
errread, errwrite)
File "/opt/datadog-agent/embedded/lib/python2.7/subprocess.py", line 1025, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory`
Seems the arguments aren't handled properly. Has anyone come across this or has patched it in any way? This is my shell.yaml file:
`init_config: null
instances:
- command: /usr/local/bin/jr_queue.sh feeds
metric_name: eb.redis.jobrunner-feeds-queue-length
metric_type: gauge - command: /usr/local/bin/jr_queue.sh jobs
metric_name: eb.redis.jobrunner-jobs-queue-length
metric_type: gauge - command: /usr/local/bin/jr_queue.sh batchedjobs
metric_name: eb.redis.jobrunner-batchedjobs-queue-length
metric_type: gauge`
I tried various arrangements of quotes as well.
Thanks!