{"action":"created","comment":{"url":"https://api.github.com/repos/DataDog/documentation/pulls/comments/173944540","pull_request_review_id":103217084,"id":173944540,"diff_hunk":"@@ -0,0 +1,186 @@\n+---\n+title: Custom check, Agent v5 example\n+kind: faq\n+---\n+\n+## An HTTP Check\n+\n+Let's write a basic check that checks the status of an HTTP endpoint. On each run of the check, a *GET* request is made to the HTTP endpoint. Based on the response, one of the following happens:\n+\n+* If the response is successful (response is 200, no timeout) the response time is submitted as a metric.\n+* If the response times out, an event is submitted with the URL and timeout.\n+* If the response code != 200, an event is submitted with the URL and the response code.\n+\n+### Configuration\n+\n+First let's define how the configuration should look so that we know\n+how to handle the structure of the `instance` payload that is passed into the\n+call to `check`.\n+\n+Besides just defining a URL per call, it'd be nice to allow you to set a timeout for each URL. We'd also want to be able to configure a default timeout if no timeout value is given for a particular URL.\n+\n+So our final configuration looks something like this:\n+\n+```yaml\n+init_config:\n+    default_timeout: 5\n+\n+instances:\n+    -   url: https://google.com\n+\n+    -   url: http://httpbin.org/delay/10\n+        timeout: 8\n+\n+    -   url: http://httpbin.org/status/400\n+\n+```\n+\n+### The Check\n+\n+Now let's define our check method. The main part of the check makes\n+a request to the URL and time the response time, handling error cases as it goes.\n+\n+In this snippet, we start a timer, make the GET request using the\n+[requests library](http://docs.python-requests.org/en/latest/) and handle and\n+errors that might arise.\n+\n+```python\n+","path":"content/agent/faq/agent-5-custom-agent-check.md","position":48,"original_position":48,"commit_id":"e1963b0022b1cf9079524e259bd85e703920efd7","original_commit_id":"e1963b0022b1cf9079524e259bd85e703920efd7","user":{"login":"AndrewMcBurney","id":8942499,"avatar_url":"https://avatars3.githubusercontent.com/u/8942499?v=4","gravatar_id":"","url":"https://api.github.com/users/AndrewMcBurney","html_url":"https://github.com/AndrewMcBurney","followers_url":"https://api.github.com/users/AndrewMcBurney/followers","following_url":"https://api.github.com/users/AndrewMcBurney/following{/other_user}","gists_url":"https://api.github.com/users/AndrewMcBurney/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewMcBurney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewMcBurney/subscriptions","organizations_url":"https://api.github.com/users/AndrewMcBurney/orgs","repos_url":"https://api.github.com/users/AndrewMcBurney/repos","events_url":"https://api.github.com/users/AndrewMcBurney/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewMcBurney/received_events","type":"User","site_admin":false},"body":"Could you please remove this extra newline?","created_at":"2018-03-12T20:59:00Z","updated_at":"2018-03-12T20:59:01Z","html_url":"https://github.com/DataDog/documentation/pull/2172#discussion_r173944540","pull_request_url":"https://api.github.com/repos/DataDog/documentation/pulls/2172","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/DataDog/documentation/pulls/comments/173944540"},"html":{"href":"https://github.com/DataDog/documentation/pull/2172#discussion_r173944540"},"pull_request":{"href":"https://api.github.com/repos/DataDog/documentation/pulls/2172"}}},"pull_request":{"url":"https://api.github.com/repos/DataDog/documentation/pulls/2172","id":174474967,"html_url":"https://github.com/DataDog/documentation/pull/2172","diff_url":"https://github.com/DataDog/documentation/pull/2172.diff","patch_url":"https://github.com/DataDog/documentation/pull/2172.patch","issue_url":"https://api.github.com/repos/DataDog/documentation/issues/2172","number":2172,"state":"open","locked":false,"title":"Agent v5 example","user":{"login":"l0k0ms","id":3624790,"avatar_url":"https://avatars3.githubusercontent.com/u/3624790?v=4","gravatar_id":"","url":"https://api.github.com/users/l0k0ms","html_url":"https://github.com/l0k0ms","followers_url":"https://api.github.com/users/l0k0ms/followers","following_url":"https://api.github.com/users/l0k0ms/following{/other_user}","gists_url":"https://api.github.com/users/l0k0ms/gists{/gist_id}","starred_url":"https://api.github.com/users/l0k0ms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/l0k0ms/subscriptions","organizations_url":"https://api.github.com/users/l0k0ms/orgs","repos_url":"https://api.github.com/users/l0k0ms/repos","events_url":"https://api.github.com/users/l0k0ms/events{/privacy}","received_events_url":"https://api.github.com/users/l0k0ms/received_events","type":"User","site_admin":false},"body":"### What does this PR do?\r\n\r\nRelocation of agent v5 custom check example\r\n\r\n### Motivation\r\n\r\n`from_yaml` method has been removed from AgentCheck [for agent v6](https://github.com/DataDog/datadog-agent/blob/2ab89172aa89421d3901f3f4f505d9fe036c100a/docs/agent/changes.md#check-api), but the http example uses the `from_yaml` method here: https://docs.datadoghq.com/agent/agent_checks/#putting-it-all-together. \r\n\r\n### Preview link\r\n\r\n* https://docs-staging.datadoghq.com/gus/agent-v5-example/agent/agent_checks/#your-first-check\r\n* https://docs-staging.datadoghq.com/gus/agent-v5-example/agent/faq/agent-5-custom-agent-check/","created_at":"2018-03-12T19:44:48Z","updated_at":"2018-03-12T20:59:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4e49a6618075dce9724c08b868b2ac4ca97d99b3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":794806364,"url":"https://api.github.com/repos/DataDog/documentation/labels/App","name":"App","color":"d4c5f9","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/DataDog/documentation/pulls/2172/commits","review_comments_url":"https://api.github.com/repos/DataDog/documentation/pulls/2172/comments","review_comment_url":"https://api.github.com/repos/DataDog/documentation/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DataDog/documentation/issues/2172/comments","statuses_url":"https://api.github.com/repos/DataDog/documentation/statuses/e1963b0022b1cf9079524e259bd85e703920efd7","head":{"label":"DataDog:gus/agent-v5-example","ref":"gus/agent-v5-example","sha":"e1963b0022b1cf9079524e259bd85e703920efd7","user":{"login":"DataDog","id":365230,"avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"repo":{"id":2967233,"name":"documentation","full_name":"DataDog/documentation","owner":{"login":"DataDog","id":365230,"avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DataDog/documentation","description":"The source for Datadog's documentation site.","fork":false,"url":"https://api.github.com/repos/DataDog/documentation","forks_url":"https://api.github.com/repos/DataDog/documentation/forks","keys_url":"https://api.github.com/repos/DataDog/documentation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataDog/documentation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataDog/documentation/teams","hooks_url":"https://api.github.com/repos/DataDog/documentation/hooks","issue_events_url":"https://api.github.com/repos/DataDog/documentation/issues/events{/number}","events_url":"https://api.github.com/repos/DataDog/documentation/events","assignees_url":"https://api.github.com/repos/DataDog/documentation/assignees{/user}","branches_url":"https://api.github.com/repos/DataDog/documentation/branches{/branch}","tags_url":"https://api.github.com/repos/DataDog/documentation/tags","blobs_url":"https://api.github.com/repos/DataDog/documentation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataDog/documentation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataDog/documentation/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataDog/documentation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataDog/documentation/statuses/{sha}","languages_url":"https://api.github.com/repos/DataDog/documentation/languages","stargazers_url":"https://api.github.com/repos/DataDog/documentation/stargazers","contributors_url":"https://api.github.com/repos/DataDog/documentation/contributors","subscribers_url":"https://api.github.com/repos/DataDog/documentation/subscribers","subscription_url":"https://api.github.com/repos/DataDog/documentation/subscription","commits_url":"https://api.github.com/repos/DataDog/documentation/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataDog/documentation/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataDog/documentation/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataDog/documentation/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataDog/documentation/contents/{+path}","compare_url":"https://api.github.com/repos/DataDog/documentation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataDog/documentation/merges","archive_url":"https://api.github.com/repos/DataDog/documentation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataDog/documentation/downloads","issues_url":"https://api.github.com/repos/DataDog/documentation/issues{/number}","pulls_url":"https://api.github.com/repos/DataDog/documentation/pulls{/number}","milestones_url":"https://api.github.com/repos/DataDog/documentation/milestones{/number}","notifications_url":"https://api.github.com/repos/DataDog/documentation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataDog/documentation/labels{/name}","releases_url":"https://api.github.com/repos/DataDog/documentation/releases{/id}","deployments_url":"https://api.github.com/repos/DataDog/documentation/deployments","created_at":"2011-12-12T20:32:29Z","updated_at":"2018-03-12T20:52:17Z","pushed_at":"2018-03-12T19:44:49Z","git_url":"git://github.com/DataDog/documentation.git","ssh_url":"git@github.com:DataDog/documentation.git","clone_url":"https://github.com/DataDog/documentation.git","svn_url":"https://github.com/DataDog/documentation","homepage":"http://docs.datadoghq.com","size":214253,"stargazers_count":44,"watchers_count":44,"language":"HTML","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":90,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":90,"open_issues":9,"watchers":44,"default_branch":"master"}},"base":{"label":"DataDog:master","ref":"master","sha":"c3f71432569dfa3275cc32885f255ab7c804de05","user":{"login":"DataDog","id":365230,"avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"repo":{"id":2967233,"name":"documentation","full_name":"DataDog/documentation","owner":{"login":"DataDog","id":365230,"avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DataDog/documentation","description":"The source for Datadog's documentation site.","fork":false,"url":"https://api.github.com/repos/DataDog/documentation","forks_url":"https://api.github.com/repos/DataDog/documentation/forks","keys_url":"https://api.github.com/repos/DataDog/documentation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataDog/documentation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataDog/documentation/teams","hooks_url":"https://api.github.com/repos/DataDog/documentation/hooks","issue_events_url":"https://api.github.com/repos/DataDog/documentation/issues/events{/number}","events_url":"https://api.github.com/repos/DataDog/documentation/events","assignees_url":"https://api.github.com/repos/DataDog/documentation/assignees{/user}","branches_url":"https://api.github.com/repos/DataDog/documentation/branches{/branch}","tags_url":"https://api.github.com/repos/DataDog/documentation/tags","blobs_url":"https://api.github.com/repos/DataDog/documentation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataDog/documentation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataDog/documentation/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataDog/documentation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataDog/documentation/statuses/{sha}","languages_url":"https://api.github.com/repos/DataDog/documentation/languages","stargazers_url":"https://api.github.com/repos/DataDog/documentation/stargazers","contributors_url":"https://api.github.com/repos/DataDog/documentation/contributors","subscribers_url":"https://api.github.com/repos/DataDog/documentation/subscribers","subscription_url":"https://api.github.com/repos/DataDog/documentation/subscription","commits_url":"https://api.github.com/repos/DataDog/documentation/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataDog/documentation/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataDog/documentation/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataDog/documentation/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataDog/documentation/contents/{+path}","compare_url":"https://api.github.com/repos/DataDog/documentation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataDog/documentation/merges","archive_url":"https://api.github.com/repos/DataDog/documentation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataDog/documentation/downloads","issues_url":"https://api.github.com/repos/DataDog/documentation/issues{/number}","pulls_url":"https://api.github.com/repos/DataDog/documentation/pulls{/number}","milestones_url":"https://api.github.com/repos/DataDog/documentation/milestones{/number}","notifications_url":"https://api.github.com/repos/DataDog/documentation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataDog/documentation/labels{/name}","releases_url":"https://api.github.com/repos/DataDog/documentation/releases{/id}","deployments_url":"https://api.github.com/repos/DataDog/documentation/deployments","created_at":"2011-12-12T20:32:29Z","updated_at":"2018-03-12T20:52:17Z","pushed_at":"2018-03-12T19:44:49Z","git_url":"git://github.com/DataDog/documentation.git","ssh_url":"git@github.com:DataDog/documentation.git","clone_url":"https://github.com/DataDog/documentation.git","svn_url":"https://github.com/DataDog/documentation","homepage":"http://docs.datadoghq.com","size":214253,"stargazers_count":44,"watchers_count":44,"language":"HTML","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":90,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":90,"open_issues":9,"watchers":44,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DataDog/documentation/pulls/2172"},"html":{"href":"https://github.com/DataDog/documentation/pull/2172"},"issue":{"href":"https://api.github.com/repos/DataDog/documentation/issues/2172"},"comments":{"href":"https://api.github.com/repos/DataDog/documentation/issues/2172/comments"},"review_comments":{"href":"https://api.github.com/repos/DataDog/documentation/pulls/2172/comments"},"review_comment":{"href":"https://api.github.com/repos/DataDog/documentation/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DataDog/documentation/pulls/2172/commits"},"statuses":{"href":"https://api.github.com/repos/DataDog/documentation/statuses/e1963b0022b1cf9079524e259bd85e703920efd7"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"AndrewMcBurney"}}