sensu-plugins / sensu-plugins-http

This plugin provides native HTTP instrumentation for monitoring and metrics collection, including: response code, JSON response, HTTP last modified, SSL expiry, and metrics via `curl`.
http://sensu-plugins.io
MIT License
30 stars 97 forks source link

Simpler curl detection #171

Closed elfranne closed 4 years ago

elfranne commented 4 years ago

Simpler curl detection for better support, It was failing on Ubuntu LTS where the default shell is /bin/dash for non-interactive user.

Tested on Ubuntu LTS (18.04) and Travis goes all green.

magnuslarsen commented 4 years ago

Can confirm that this works on Ubuntu 16.04 and 18.04

majormoses commented 4 years ago

One odd thing I see in my testing is that we could have removed -t and still used type. I am puzzled on why is bash and shell it returns different results without the options specified:

# default shell bash
$ type curl
curl is /usr/bin/curl

$ /bin/dash
$ type curl
curl is a tracked alias for /usr/bin/curl

If I reach for shell scripting I really don't bother with non bash shells if I can help it so I never really looked much into dash. I know we are using 18.04 at work but maybe we are locked on an old version or we switched the shells. Anyways just mentioning it in case someone comes across this and can explain the differences here I would love to hear it.