{"action":"created","comment":{"url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/pulls/comments/24425628","id":24425628,"diff_hunk":"@@ -0,0 +1,96 @@\n+module Sensu\n+module Extension\n+\n+# 1) update per-check timestamps in redis\n+# 2) have eventmachine periodic timer to check if anything timed out and\n+#    generate a new \"critical\" event for every\n+#\n+# extension has access to:\n+#  - logger     @logger\n+#  - redis      @settings[:redis]\n+#  - transport  @settings[:transport]\n+\n+class ClientKeepalive < Handler\n+  def name\n+    'client_keepalive'\n+  end\n+\n+  def description\n+    'emit per-check keepalive events'\n+  end\n+\n+  def post_init\n+    @redis    = @settings.redis\n+    @em_timer = EventMachine::PeriodicTimer.new(10) { process_keepalives }\n+  end\n+\n+  def stop\n+    @em_timer.cancel\n+    yield\n+  end\n+\n+  def run(event)\n+    client_name = event[:client][:name]\n+    check_name  = event[:check][:name]\n+\n+    rkey = \"ext:check_keepalive:checks\"\n+    hkey = \"#{client_name}:#{check_name}\"\n+    hval = event[:check][:keepalive]","path":"files/check_keepalive.rb","position":38,"original_position":38,"commit_id":"758b48dd3e774459e9a057ce7fd87212b0c308ea","original_commit_id":"758b48dd3e774459e9a057ce7fd87212b0c308ea","user":{"login":"solarkennedy","id":370205,"avatar_url":"https://avatars.githubusercontent.com/u/370205?v=3","gravatar_id":"","url":"https://api.github.com/users/solarkennedy","html_url":"https://github.com/solarkennedy","followers_url":"https://api.github.com/users/solarkennedy/followers","following_url":"https://api.github.com/users/solarkennedy/following{/other_user}","gists_url":"https://api.github.com/users/solarkennedy/gists{/gist_id}","starred_url":"https://api.github.com/users/solarkennedy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solarkennedy/subscriptions","organizations_url":"https://api.github.com/users/solarkennedy/orgs","repos_url":"https://api.github.com/users/solarkennedy/repos","events_url":"https://api.github.com/users/solarkennedy/events{/privacy}","received_events_url":"https://api.github.com/users/solarkennedy/received_events","type":"User","site_admin":false},"body":"This looks a bit copy/pasted from the client keepalive code, but it cannot grab data from the keepalive event, it has to grab the event data from the \"check\" name event.\r\n\r\nWe have to store this data ourselves because it isn't stored anywhere else, but *not* the keepalive.","created_at":"2015-02-10T16:26:10Z","updated_at":"2015-02-10T16:26:10Z","html_url":"https://github.com/Yelp/puppet-monitoring_check/pull/33#discussion_r24425628","pull_request_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/pulls/33","_links":{"self":{"href":"https://api.github.com/repos/Yelp/puppet-monitoring_check/pulls/comments/24425628"},"html":{"href":"https://github.com/Yelp/puppet-monitoring_check/pull/33#discussion_r24425628"},"pull_request":{"href":"https://api.github.com/repos/Yelp/puppet-monitoring_check/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/pulls/33","id":29006653,"html_url":"https://github.com/Yelp/puppet-monitoring_check/pull/33","diff_url":"https://github.com/Yelp/puppet-monitoring_check/pull/33.diff","patch_url":"https://github.com/Yelp/puppet-monitoring_check/pull/33.patch","issue_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/issues/33","number":33,"state":"open","locked":false,"title":"per-check keepalive extension","user":{"login":"keymone","id":7057,"avatar_url":"https://avatars.githubusercontent.com/u/7057?v=3","gravatar_id":"","url":"https://api.github.com/users/keymone","html_url":"https://github.com/keymone","followers_url":"https://api.github.com/users/keymone/followers","following_url":"https://api.github.com/users/keymone/following{/other_user}","gists_url":"https://api.github.com/users/keymone/gists{/gist_id}","starred_url":"https://api.github.com/users/keymone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keymone/subscriptions","organizations_url":"https://api.github.com/users/keymone/orgs","repos_url":"https://api.github.com/users/keymone/repos","events_url":"https://api.github.com/users/keymone/events{/privacy}","received_events_url":"https://api.github.com/users/keymone/received_events","type":"User","site_admin":false},"body":"initial extension implementation","created_at":"2015-02-10T13:29:15Z","updated_at":"2015-02-10T16:26:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1e826f0a6d0de576f37122c0675fc60efe4dd22e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/pulls/33/commits","review_comments_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/pulls/33/comments","review_comment_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/pulls/comments/{number}","comments_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/issues/33/comments","statuses_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/statuses/758b48dd3e774459e9a057ce7fd87212b0c308ea","head":{"label":"Yelp:u/maksym/check_keepalive","ref":"u/maksym/check_keepalive","sha":"758b48dd3e774459e9a057ce7fd87212b0c308ea","user":{"login":"Yelp","id":49071,"avatar_url":"https://avatars.githubusercontent.com/u/49071?v=3","gravatar_id":"","url":"https://api.github.com/users/Yelp","html_url":"https://github.com/Yelp","followers_url":"https://api.github.com/users/Yelp/followers","following_url":"https://api.github.com/users/Yelp/following{/other_user}","gists_url":"https://api.github.com/users/Yelp/gists{/gist_id}","starred_url":"https://api.github.com/users/Yelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yelp/subscriptions","organizations_url":"https://api.github.com/users/Yelp/orgs","repos_url":"https://api.github.com/users/Yelp/repos","events_url":"https://api.github.com/users/Yelp/events{/privacy}","received_events_url":"https://api.github.com/users/Yelp/received_events","type":"Organization","site_admin":false},"repo":{"id":22772104,"name":"puppet-monitoring_check","full_name":"Yelp/puppet-monitoring_check","owner":{"login":"Yelp","id":49071,"avatar_url":"https://avatars.githubusercontent.com/u/49071?v=3","gravatar_id":"","url":"https://api.github.com/users/Yelp","html_url":"https://github.com/Yelp","followers_url":"https://api.github.com/users/Yelp/followers","following_url":"https://api.github.com/users/Yelp/following{/other_user}","gists_url":"https://api.github.com/users/Yelp/gists{/gist_id}","starred_url":"https://api.github.com/users/Yelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yelp/subscriptions","organizations_url":"https://api.github.com/users/Yelp/orgs","repos_url":"https://api.github.com/users/Yelp/repos","events_url":"https://api.github.com/users/Yelp/events{/privacy}","received_events_url":"https://api.github.com/users/Yelp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Yelp/puppet-monitoring_check","description":"A Puppet module to create Sensu checks that use the Yelp Sensu Handlers for a multi-tenant environment","fork":false,"url":"https://api.github.com/repos/Yelp/puppet-monitoring_check","forks_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/forks","keys_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/teams","hooks_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/hooks","issue_events_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/issues/events{/number}","events_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/events","assignees_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/assignees{/user}","branches_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/branches{/branch}","tags_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/tags","blobs_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/git/refs{/sha}","trees_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/statuses/{sha}","languages_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/languages","stargazers_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/stargazers","contributors_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/contributors","subscribers_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/subscribers","subscription_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/subscription","commits_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/commits{/sha}","git_commits_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/git/commits{/sha}","comments_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/comments{/number}","issue_comment_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/issues/comments/{number}","contents_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/contents/{+path}","compare_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/merges","archive_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/downloads","issues_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/issues{/number}","pulls_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/pulls{/number}","milestones_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/milestones{/number}","notifications_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/labels{/name}","releases_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/releases{/id}","created_at":"2014-08-08T21:29:32Z","updated_at":"2015-02-06T21:26:35Z","pushed_at":"2015-02-10T16:24:30Z","git_url":"git://github.com/Yelp/puppet-monitoring_check.git","ssh_url":"git@github.com:Yelp/puppet-monitoring_check.git","clone_url":"https://github.com/Yelp/puppet-monitoring_check.git","svn_url":"https://github.com/Yelp/puppet-monitoring_check","homepage":null,"size":588,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":4,"default_branch":"master"}},"base":{"label":"Yelp:master","ref":"master","sha":"edf92785dcb1b5f1118324282d847f3cb9f7ac27","user":{"login":"Yelp","id":49071,"avatar_url":"https://avatars.githubusercontent.com/u/49071?v=3","gravatar_id":"","url":"https://api.github.com/users/Yelp","html_url":"https://github.com/Yelp","followers_url":"https://api.github.com/users/Yelp/followers","following_url":"https://api.github.com/users/Yelp/following{/other_user}","gists_url":"https://api.github.com/users/Yelp/gists{/gist_id}","starred_url":"https://api.github.com/users/Yelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yelp/subscriptions","organizations_url":"https://api.github.com/users/Yelp/orgs","repos_url":"https://api.github.com/users/Yelp/repos","events_url":"https://api.github.com/users/Yelp/events{/privacy}","received_events_url":"https://api.github.com/users/Yelp/received_events","type":"Organization","site_admin":false},"repo":{"id":22772104,"name":"puppet-monitoring_check","full_name":"Yelp/puppet-monitoring_check","owner":{"login":"Yelp","id":49071,"avatar_url":"https://avatars.githubusercontent.com/u/49071?v=3","gravatar_id":"","url":"https://api.github.com/users/Yelp","html_url":"https://github.com/Yelp","followers_url":"https://api.github.com/users/Yelp/followers","following_url":"https://api.github.com/users/Yelp/following{/other_user}","gists_url":"https://api.github.com/users/Yelp/gists{/gist_id}","starred_url":"https://api.github.com/users/Yelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yelp/subscriptions","organizations_url":"https://api.github.com/users/Yelp/orgs","repos_url":"https://api.github.com/users/Yelp/repos","events_url":"https://api.github.com/users/Yelp/events{/privacy}","received_events_url":"https://api.github.com/users/Yelp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Yelp/puppet-monitoring_check","description":"A Puppet module to create Sensu checks that use the Yelp Sensu Handlers for a multi-tenant environment","fork":false,"url":"https://api.github.com/repos/Yelp/puppet-monitoring_check","forks_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/forks","keys_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/teams","hooks_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/hooks","issue_events_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/issues/events{/number}","events_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/events","assignees_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/assignees{/user}","branches_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/branches{/branch}","tags_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/tags","blobs_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/git/refs{/sha}","trees_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/statuses/{sha}","languages_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/languages","stargazers_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/stargazers","contributors_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/contributors","subscribers_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/subscribers","subscription_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/subscription","commits_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/commits{/sha}","git_commits_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/git/commits{/sha}","comments_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/comments{/number}","issue_comment_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/issues/comments/{number}","contents_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/contents/{+path}","compare_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/merges","archive_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/downloads","issues_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/issues{/number}","pulls_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/pulls{/number}","milestones_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/milestones{/number}","notifications_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/labels{/name}","releases_url":"https://api.github.com/repos/Yelp/puppet-monitoring_check/releases{/id}","created_at":"2014-08-08T21:29:32Z","updated_at":"2015-02-06T21:26:35Z","pushed_at":"2015-02-10T16:24:30Z","git_url":"git://github.com/Yelp/puppet-monitoring_check.git","ssh_url":"git@github.com:Yelp/puppet-monitoring_check.git","clone_url":"https://github.com/Yelp/puppet-monitoring_check.git","svn_url":"https://github.com/Yelp/puppet-monitoring_check","homepage":null,"size":588,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Yelp/puppet-monitoring_check/pulls/33"},"html":{"href":"https://github.com/Yelp/puppet-monitoring_check/pull/33"},"issue":{"href":"https://api.github.com/repos/Yelp/puppet-monitoring_check/issues/33"},"comments":{"href":"https://api.github.com/repos/Yelp/puppet-monitoring_check/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/Yelp/puppet-monitoring_check/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/Yelp/puppet-monitoring_check/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/Yelp/puppet-monitoring_check/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/Yelp/puppet-monitoring_check/statuses/758b48dd3e774459e9a057ce7fd87212b0c308ea"}}}}