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 96 forks source link

Error parsing resource: mapping values are not allowed in this context #181

Closed phumpal closed 4 years ago

phumpal commented 4 years ago

Perhaps a sensu-go bug but passing a Host header in v5.19.1

type: CheckConfig
api_version: core/v2
metadata:
  name: check_http_unicorn
  namespace: default
spec:
  command: check-http.rb --hostname 10.2.12.116 --port 8080 --header 'Host: mydomain.dev' --request-uri / -r true

results in

Error: in /etc/sensu/conf.d/checks: error parsing resources: yaml: line 7: mapping values are not allowed in this context

Removing --header 'Host: mydomain.dev allows the check config to upload but without the header the check will fail.

Removing the assignment : prevents key value mapping of custom headers.

CheckHttp CRITICAL: Request error: undefined method `strip' for nil:NilClass

phumpal commented 4 years ago

@majormoses should I move this to sensu-go or am I missing something obvious?

phumpal commented 4 years ago

I solve this by "fixing" my yaml

type: CheckConfig
api_version: core/v2
metadata:
  name: check_http_unicorn
  namespace: default
spec:
  command: |
    check-http.rb --hostname 10.2.12.116 --port 8080 --header 'Host: mydomain.dev' --request-uri / -r true