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

read postbody as a string argument and not as a file in check-http-json.rb #24

Open
oryband opened this issue Nov 15, 2015 · 1 comment

Comments

@oryband
Copy link

oryband commented Nov 15, 2015

See this line. Forcing the sensu-client to have a file with the body when using -b argument is limiting. I would prefer the server to be able to send the body as a string argument. I've tried to hack around this by using the <(..) bash statement in order to create an on-the-fly file descriptor and pass it as the body argument instead:

// sensu-server checks conf.d:
"check-gcm-service-health": {
    "command": "check-http-json.rb -u 'http://gcm-http.googleapis.com/gcm/send' -m POST -H 'Content-Type: application/json,Authorization: key=my-key' -b <(echo '{\"to\": \"my-device-token\"}') -K 'results' -v '[{\"error\"=>\"NotRegistered\"}]'",
        // other options

This however doesn't work, since sensu-client is using /bin/sh and not /bin/bash (I think), thus the <(..) statement returns a sh: 1: Syntax error: "(" unexpected.

It would've been a lot easier (and simpler) if the body could be passed as a string argument instead of a file. You can easily stay backward compatible by using:

check-http-json.rb -b `cat body.txt`
@analytically
Copy link
Contributor

I'd gladly merge a backwards-compatible PR.

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

No branches or pull requests

3 participants