{"action":"created","issue":{"url":"https://api.github.com/repos/sensu/sensu/issues/1748","repository_url":"https://api.github.com/repos/sensu/sensu","labels_url":"https://api.github.com/repos/sensu/sensu/issues/1748/labels{/name}","comments_url":"https://api.github.com/repos/sensu/sensu/issues/1748/comments","events_url":"https://api.github.com/repos/sensu/sensu/issues/1748/events","html_url":"https://github.com/sensu/sensu/pull/1748","id":259695497,"number":1748,"title":"Check Hooks","user":{"login":"portertech","id":149630,"avatar_url":"https://avatars2.githubusercontent.com/u/149630?v=4","gravatar_id":"","url":"https://api.github.com/users/portertech","html_url":"https://github.com/portertech","followers_url":"https://api.github.com/users/portertech/followers","following_url":"https://api.github.com/users/portertech/following{/other_user}","gists_url":"https://api.github.com/users/portertech/gists{/gist_id}","starred_url":"https://api.github.com/users/portertech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/portertech/subscriptions","organizations_url":"https://api.github.com/users/portertech/orgs","repos_url":"https://api.github.com/users/portertech/repos","events_url":"https://api.github.com/users/portertech/events{/privacy}","received_events_url":"https://api.github.com/users/portertech/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"portertech","id":149630,"avatar_url":"https://avatars2.githubusercontent.com/u/149630?v=4","gravatar_id":"","url":"https://api.github.com/users/portertech","html_url":"https://github.com/portertech","followers_url":"https://api.github.com/users/portertech/followers","following_url":"https://api.github.com/users/portertech/following{/other_user}","gists_url":"https://api.github.com/users/portertech/gists{/gist_id}","starred_url":"https://api.github.com/users/portertech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/portertech/subscriptions","organizations_url":"https://api.github.com/users/portertech/orgs","repos_url":"https://api.github.com/users/portertech/repos","events_url":"https://api.github.com/users/portertech/events{/privacy}","received_events_url":"https://api.github.com/users/portertech/received_events","type":"User","site_admin":false},"assignees":[{"login":"portertech","id":149630,"avatar_url":"https://avatars2.githubusercontent.com/u/149630?v=4","gravatar_id":"","url":"https://api.github.com/users/portertech","html_url":"https://github.com/portertech","followers_url":"https://api.github.com/users/portertech/followers","following_url":"https://api.github.com/users/portertech/following{/other_user}","gists_url":"https://api.github.com/users/portertech/gists{/gist_id}","starred_url":"https://api.github.com/users/portertech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/portertech/subscriptions","organizations_url":"https://api.github.com/users/portertech/orgs","repos_url":"https://api.github.com/users/portertech/repos","events_url":"https://api.github.com/users/portertech/events{/privacy}","received_events_url":"https://api.github.com/users/portertech/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/sensu/sensu/milestones/15","html_url":"https://github.com/sensu/sensu/milestone/15","labels_url":"https://api.github.com/repos/sensu/sensu/milestones/15/labels","id":2343845,"number":15,"title":"1.1","description":"","creator":{"login":"portertech","id":149630,"avatar_url":"https://avatars2.githubusercontent.com/u/149630?v=4","gravatar_id":"","url":"https://api.github.com/users/portertech","html_url":"https://github.com/portertech","followers_url":"https://api.github.com/users/portertech/followers","following_url":"https://api.github.com/users/portertech/following{/other_user}","gists_url":"https://api.github.com/users/portertech/gists{/gist_id}","starred_url":"https://api.github.com/users/portertech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/portertech/subscriptions","organizations_url":"https://api.github.com/users/portertech/orgs","repos_url":"https://api.github.com/users/portertech/repos","events_url":"https://api.github.com/users/portertech/events{/privacy}","received_events_url":"https://api.github.com/users/portertech/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":16,"state":"closed","created_at":"2017-02-23T17:09:10Z","updated_at":"2017-09-27T19:42:12Z","due_on":null,"closed_at":"2017-09-27T19:04:32Z"},"comments":9,"created_at":"2017-09-22T03:50:35Z","updated_at":"2018-05-15T05:57:01Z","closed_at":"2017-09-25T23:59:32Z","author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/sensu/sensu/pulls/1748","html_url":"https://github.com/sensu/sensu/pull/1748","diff_url":"https://github.com/sensu/sensu/pull/1748.diff","patch_url":"https://github.com/sensu/sensu/pull/1748.patch"},"body":"The Sensu client’s primary function is to execute check commands and publish their results for processing, allowing a Sensu server to take the appropriate actions. The practice of using Sensu for automated data gathering for incident triage continues to gain traction amongst Sensu users. Although this practice is achievable, Sensu does not currently make it easy, as all actions must be orchestrated by a Sensu server.\r\n\r\nThis pull request introduce check hooks, commands run by the Sensu client in response to the result of the check command execution. The Sensu client will execute the appropriate configured hook command, depending on the check execution status (e.g. 1). Valid hook names include (in order of precedence): \"1\"-\"255\", \"ok\", \"warning\", \"critical\", \"unknown\", and \"non-zero\". The check hook command output, status, executed timestamp, and duration are captured and published in the check result.\r\n\r\nExample check hook configuration:\r\n\r\n``` json\r\n{\r\n  \"checks\": {\r\n    \"my_check\": {\r\n      \"command\": \"echo WARNING && exit 1\",\r\n      \"...\": \"...\",\r\n      \"hooks\": {\r\n        \"ok\": {\"command\": \"echo ALL IS WELL\"},\r\n        \"warning\": {\"command\": \"echo DANGER WILL ROBINSON!\"},\r\n        \"critical\": {\"command\": \"ps aux\"}\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nExample check result hook data:\r\n\r\n```\r\n{\r\n  \"hooks\": {\r\n    \"warning\": {\r\n      \"command\": \"echo HOOKED\",\r\n      \"timeout\": 5,\r\n      \"output\": \"HOOKED\\n\",\r\n      \"status\": 0,\r\n      \"executed\": 1506049908,\r\n      \"duration\": 0.004\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nCloses https://github.com/sensu/sensu/issues/1680"},"comment":{"url":"https://api.github.com/repos/sensu/sensu/issues/comments/389051535","html_url":"https://github.com/sensu/sensu/pull/1748#issuecomment-389051535","issue_url":"https://api.github.com/repos/sensu/sensu/issues/1748","id":389051535,"user":{"login":"MrMoronIV","id":35342346,"avatar_url":"https://avatars3.githubusercontent.com/u/35342346?v=4","gravatar_id":"","url":"https://api.github.com/users/MrMoronIV","html_url":"https://github.com/MrMoronIV","followers_url":"https://api.github.com/users/MrMoronIV/followers","following_url":"https://api.github.com/users/MrMoronIV/following{/other_user}","gists_url":"https://api.github.com/users/MrMoronIV/gists{/gist_id}","starred_url":"https://api.github.com/users/MrMoronIV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrMoronIV/subscriptions","organizations_url":"https://api.github.com/users/MrMoronIV/orgs","repos_url":"https://api.github.com/users/MrMoronIV/repos","events_url":"https://api.github.com/users/MrMoronIV/events{/privacy}","received_events_url":"https://api.github.com/users/MrMoronIV/received_events","type":"User","site_admin":false},"created_at":"2018-05-15T05:57:01Z","updated_at":"2018-05-15T05:57:01Z","author_association":"NONE","body":"So this is implemented now and this is the way to define them?\r\n\r\n\r\n{\r\n  \"checks\": {\r\n    \"my_check\": {\r\n      \"command\": \"echo WARNING && exit 1\",\r\n      \"...\": \"...\",\r\n      \"hooks\": {\r\n        \"ok\": {\"command\": \"echo ALL IS WELL\"},\r\n        \"warning\": {\"command\": \"echo DANGER WILL ROBINSON!\"},\r\n        \"critical\": {\"command\": \"ps aux\"}\r\n      }\r\n    }\r\n  }\r\n}"}}
{"actor":{"display_login":"MrMoronIV"}}