{"action":"created","issue":{"url":"https://api.github.com/repos/sensu-plugins/sensu-plugins-jenkins/issues/33","repository_url":"https://api.github.com/repos/sensu-plugins/sensu-plugins-jenkins","labels_url":"https://api.github.com/repos/sensu-plugins/sensu-plugins-jenkins/issues/33/labels{/name}","comments_url":"https://api.github.com/repos/sensu-plugins/sensu-plugins-jenkins/issues/33/comments","events_url":"https://api.github.com/repos/sensu-plugins/sensu-plugins-jenkins/issues/33/events","html_url":"https://github.com/sensu-plugins/sensu-plugins-jenkins/pull/33","id":300649730,"number":33,"title":"When a health check fails a status code of 500 is returned.","user":{"login":"yuri-zubov","id":2146069,"avatar_url":"https://avatars3.githubusercontent.com/u/2146069?v=4","gravatar_id":"","url":"https://api.github.com/users/yuri-zubov","html_url":"https://github.com/yuri-zubov","followers_url":"https://api.github.com/users/yuri-zubov/followers","following_url":"https://api.github.com/users/yuri-zubov/following{/other_user}","gists_url":"https://api.github.com/users/yuri-zubov/gists{/gist_id}","starred_url":"https://api.github.com/users/yuri-zubov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuri-zubov/subscriptions","organizations_url":"https://api.github.com/users/yuri-zubov/orgs","repos_url":"https://api.github.com/users/yuri-zubov/repos","events_url":"https://api.github.com/users/yuri-zubov/events{/privacy}","received_events_url":"https://api.github.com/users/yuri-zubov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-27T14:22:41Z","updated_at":"2018-02-27T17:20:06Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/sensu-plugins/sensu-plugins-jenkins/pulls/33","html_url":"https://github.com/sensu-plugins/sensu-plugins-jenkins/pull/33","diff_url":"https://github.com/sensu-plugins/sensu-plugins-jenkins/pull/33.diff","patch_url":"https://github.com/sensu-plugins/sensu-plugins-jenkins/pull/33.patch"},"body":"Parse health check JSON response in error case\r\n\r\nWhen a health check fails a status code of 500 is returned. To get a\r\nmeaningful error message, the JSON response needs to be parsed also for\r\nstatus code 500.\r\n\r\n```bash\r\ncurl -sn http://172.16.0.4:8080/metrics/$APIKEY/healthcheck | jq .\r\n{\r\n \"disk-space\": {\r\n   \"healthy\": true\r\n },\r\n \"mesos\": {\r\n   \"healthy\": true\r\n },\r\n \"plugins\": {\r\n   \"healthy\": false,\r\n   \"message\": \"There are 13 failed plugins: workflow-durable-task-step; docker-workflow; pipeline-model-definition; blueocean-pipeline-api-impl; blueocean-events; blueocean-bitbucket-pipeline; blueocean-git-pipeline; pyenv-pipeline; workflow-aggregator; blueocean-github-pipeline; blueocean-pipeline-editor; blueocean; ws-cleanup\"\r\n },\r\n \"temporary-space\": {\r\n   \"healthy\": true\r\n },\r\n \"thread-deadlock\": {\r\n   \"healthy\": true\r\n }\r\n}\r\n```\r\n\r\nbefore the fix\r\nplugin return \r\n```bash\r\nbin/check-jenkins-health.rb -t 15 -u /metrics/Dg9rH4iCIjTEBQwWDeYfPstOw9xfX4UBg1ykJucszPFv-GDX9DWUv3JasMtFlgmr/healthcheck\r\nCheck failed to run: 500 Internal Server Error, [\\\"/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/rest-client-2.0.2/lib/restclient/abstract_response.rb:223:in `exception_with_response'\\\", \\\"/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/rest-client-2.0.2/lib/restclient/abstract_response.rb:103:in `return!'\\\", \\\"/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/rest-client-2.0.2/lib/restclient/request.rb:809:in `process_result'\\\", \\\"/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/rest-client-2.0.2/lib/restclient/request.rb:725:in `block in transmit'\\\", \\\"/opt/sensu/embedded/lib/ruby/2.4.0/net/http.rb:877:in `start'\\\", \\\"/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/rest-client-2.0.2/lib/restclient/request.rb:715:in `transmit'\\\", \\\"/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/rest-client-2.0.2/lib/restclient/request.rb:145:in `execute'\\\", \\\"/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/rest-client-2.0.2/lib/restclient/request.rb:52:in `execute'\\\", \\\"/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/rest-client-2.0.2/lib/restclient/resource.rb:51:in `get'\\\", \\\"/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-jenkins-1.4.0/bin/check-jenkins-health.rb:73:in `run'\\\", \\\"/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugin-1.4.5/lib/sensu-plugin/cli.rb:58:in `block in <class:CLI>'\\\"]\r\n```\r\n\r\nafter the fix\r\nplugin return\r\n```bash\r\nbin/check-jenkins-health.rb -t 15 -u /metrics/Dg9rH4iCIjTEBQwWDeYfPstOw9xfX4UBg1ykJucszPFv-GDX9DWUv3JasMtFlgmr/healthcheck\r\nJenkinsMetricsHealthChecker CRITICAL: Jenkins health check 'disk-space' reported unhealthy state. Message: Only 0.549 Gb free on (master)\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/sensu-plugins/sensu-plugins-jenkins/issues/comments/368955967","html_url":"https://github.com/sensu-plugins/sensu-plugins-jenkins/pull/33#issuecomment-368955967","issue_url":"https://api.github.com/repos/sensu-plugins/sensu-plugins-jenkins/issues/33","id":368955967,"user":{"login":"majormoses","id":3145127,"avatar_url":"https://avatars3.githubusercontent.com/u/3145127?v=4","gravatar_id":"","url":"https://api.github.com/users/majormoses","html_url":"https://github.com/majormoses","followers_url":"https://api.github.com/users/majormoses/followers","following_url":"https://api.github.com/users/majormoses/following{/other_user}","gists_url":"https://api.github.com/users/majormoses/gists{/gist_id}","starred_url":"https://api.github.com/users/majormoses/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/majormoses/subscriptions","organizations_url":"https://api.github.com/users/majormoses/orgs","repos_url":"https://api.github.com/users/majormoses/repos","events_url":"https://api.github.com/users/majormoses/events{/privacy}","received_events_url":"https://api.github.com/users/majormoses/received_events","type":"User","site_admin":false},"created_at":"2018-02-27T17:20:06Z","updated_at":"2018-02-27T17:20:06Z","author_association":"OWNER","body":"let me know if you need help resolving those dependencies conflicts"}}
{"actor":{"display_login":"majormoses"}}