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

Unix shell check wont take arguments #3684

Open
jrowinski88 opened this issue Feb 21, 2018 · 0 comments
Open

Unix shell check wont take arguments #3684

jrowinski88 opened this issue Feb 21, 2018 · 0 comments

Comments

@jrowinski88
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant