{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/openshift-ansible/pulls/comments/122597528","pull_request_review_id":44726954,"id":122597528,"diff_hunk":"@@ -0,0 +1,163 @@\n+#!/usr/bin/python\n+\"\"\"Interface to journalctl\"\"\"\n+\n+from time import time\n+import json\n+import re\n+import subprocess\n+\n+from ansible.module_utils.basic import AnsibleModule\n+\n+\n+class InvalidMatcherRegexp(Exception):\n+    \"\"\"Exception class for invalid matcher regexp.\"\"\"\n+    pass\n+\n+\n+class InvalidMatcher(Exception):\n+    \"\"\"Exception class for missing or invalid matcher fields.\"\"\"\n+    def __init__(self, message, missing_fields=None):\n+        super(InvalidMatcher, self).__init__(message)\n+        self.missing_fields = missing_fields\n+\n+\n+class InvalidLogEntry(Exception):\n+    \"\"\"Exception class for invalid / non-json log entries.\"\"\"\n+    pass\n+\n+\n+class LogInputSubprocessError(Exception):\n+    \"\"\"Exception class for errors that occur while executing a subprocess\"\"\"\n+    pass\n+\n+\n+def main():\n+    \"\"\"Scan a given list of matchers for journalctl messages containing given patterns.\"\"\"\n+    module = AnsibleModule(\n+        argument_spec=dict(\n+            log_count_limit=dict(type=\"int\", default=500),\n+            log_matchers=dict(type=\"list\", required=True),","path":"roles/openshift_health_checker/library/search_journalctl.py","position":39,"original_position":39,"commit_id":"333a68a8114d2bbff2716b013493f99a1837ef53","original_commit_id":"333a68a8114d2bbff2716b013493f99a1837ef53","user":{"login":"rhcarvalho","id":88819,"avatar_url":"https://avatars3.githubusercontent.com/u/88819?v=3","gravatar_id":"","url":"https://api.github.com/users/rhcarvalho","html_url":"https://github.com/rhcarvalho","followers_url":"https://api.github.com/users/rhcarvalho/followers","following_url":"https://api.github.com/users/rhcarvalho/following{/other_user}","gists_url":"https://api.github.com/users/rhcarvalho/gists{/gist_id}","starred_url":"https://api.github.com/users/rhcarvalho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhcarvalho/subscriptions","organizations_url":"https://api.github.com/users/rhcarvalho/orgs","repos_url":"https://api.github.com/users/rhcarvalho/repos","events_url":"https://api.github.com/users/rhcarvalho/events{/privacy}","received_events_url":"https://api.github.com/users/rhcarvalho/received_events","type":"User","site_admin":false},"body":"If we simplify the interface with the module, we could get rid of some code... e.g.\r\n\r\n```python\r\nargument_spec=dict(\r\n    log_count_limit=dict(type='int', default=500),\r\n    start_regexp=dict(type='string', default=''),\r\n    ...\r\n)\r\n```","created_at":"2017-06-18T18:14:44Z","updated_at":"2017-06-18T18:18:35Z","html_url":"https://github.com/openshift/openshift-ansible/pull/4316#discussion_r122597528","pull_request_url":"https://api.github.com/repos/openshift/openshift-ansible/pulls/4316","_links":{"self":{"href":"https://api.github.com/repos/openshift/openshift-ansible/pulls/comments/122597528"},"html":{"href":"https://github.com/openshift/openshift-ansible/pull/4316#discussion_r122597528"},"pull_request":{"href":"https://api.github.com/repos/openshift/openshift-ansible/pulls/4316"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/openshift-ansible/pulls/4316","id":123162251,"html_url":"https://github.com/openshift/openshift-ansible/pull/4316","diff_url":"https://github.com/openshift/openshift-ansible/pull/4316.diff","patch_url":"https://github.com/openshift/openshift-ansible/pull/4316.patch","issue_url":"https://api.github.com/repos/openshift/openshift-ansible/issues/4316","number":4316,"state":"open","locked":false,"title":"add check to detect increased etcd traffic","user":{"login":"juanvallejo","id":3902875,"avatar_url":"https://avatars1.githubusercontent.com/u/3902875?v=3","gravatar_id":"","url":"https://api.github.com/users/juanvallejo","html_url":"https://github.com/juanvallejo","followers_url":"https://api.github.com/users/juanvallejo/followers","following_url":"https://api.github.com/users/juanvallejo/following{/other_user}","gists_url":"https://api.github.com/users/juanvallejo/gists{/gist_id}","starred_url":"https://api.github.com/users/juanvallejo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juanvallejo/subscriptions","organizations_url":"https://api.github.com/users/juanvallejo/orgs","repos_url":"https://api.github.com/users/juanvallejo/repos","events_url":"https://api.github.com/users/juanvallejo/events{/privacy}","received_events_url":"https://api.github.com/users/juanvallejo/received_events","type":"User","site_admin":false},"body":"Related trello card: https://trello.com/c/7pJdHj4F\r\nRelated bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1415839\r\n\r\nAn update in OSE 3.4 caused an increase in etcd traffic due to increased quorum reads.\r\nThis check scans etcd logs (`journalctl -ru <unit>`) and recommends an upgrade to `OSE 3.6` if the message `etcd: sync duration of ..., expected less than 1s` is found (this message is a direct symptom of the increased traffic update). \r\n\r\nBased on [oadm diagnostics](https://github.com/openshift/origin/blob/master/pkg/diagnostics/systemd/analyze_logs.go)\r\n\r\nTODO\r\n\r\n- [x] add unit tests\r\n\r\ncc @brenton @rhcarvalho @sosiouxme ","created_at":"2017-05-30T23:06:46Z","updated_at":"2017-06-18T18:18:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a2bd5f2ac2121450da8043bbd225e144c63f5f27","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/openshift/openshift-ansible/pulls/4316/commits","review_comments_url":"https://api.github.com/repos/openshift/openshift-ansible/pulls/4316/comments","review_comment_url":"https://api.github.com/repos/openshift/openshift-ansible/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/openshift-ansible/issues/4316/comments","statuses_url":"https://api.github.com/repos/openshift/openshift-ansible/statuses/333a68a8114d2bbff2716b013493f99a1837ef53","head":{"label":"juanvallejo:jvallejo/add-increased-etcd-traffic-check","ref":"jvallejo/add-increased-etcd-traffic-check","sha":"333a68a8114d2bbff2716b013493f99a1837ef53","user":{"login":"juanvallejo","id":3902875,"avatar_url":"https://avatars1.githubusercontent.com/u/3902875?v=3","gravatar_id":"","url":"https://api.github.com/users/juanvallejo","html_url":"https://github.com/juanvallejo","followers_url":"https://api.github.com/users/juanvallejo/followers","following_url":"https://api.github.com/users/juanvallejo/following{/other_user}","gists_url":"https://api.github.com/users/juanvallejo/gists{/gist_id}","starred_url":"https://api.github.com/users/juanvallejo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juanvallejo/subscriptions","organizations_url":"https://api.github.com/users/juanvallejo/orgs","repos_url":"https://api.github.com/users/juanvallejo/repos","events_url":"https://api.github.com/users/juanvallejo/events{/privacy}","received_events_url":"https://api.github.com/users/juanvallejo/received_events","type":"User","site_admin":false},"repo":{"id":82593304,"name":"openshift-ansible","full_name":"juanvallejo/openshift-ansible","owner":{"login":"juanvallejo","id":3902875,"avatar_url":"https://avatars1.githubusercontent.com/u/3902875?v=3","gravatar_id":"","url":"https://api.github.com/users/juanvallejo","html_url":"https://github.com/juanvallejo","followers_url":"https://api.github.com/users/juanvallejo/followers","following_url":"https://api.github.com/users/juanvallejo/following{/other_user}","gists_url":"https://api.github.com/users/juanvallejo/gists{/gist_id}","starred_url":"https://api.github.com/users/juanvallejo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juanvallejo/subscriptions","organizations_url":"https://api.github.com/users/juanvallejo/orgs","repos_url":"https://api.github.com/users/juanvallejo/repos","events_url":"https://api.github.com/users/juanvallejo/events{/privacy}","received_events_url":"https://api.github.com/users/juanvallejo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/juanvallejo/openshift-ansible","description":"OpenShift Installation and Configuration Management","fork":true,"url":"https://api.github.com/repos/juanvallejo/openshift-ansible","forks_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/forks","keys_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/teams","hooks_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/hooks","issue_events_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/issues/events{/number}","events_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/events","assignees_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/assignees{/user}","branches_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/branches{/branch}","tags_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/tags","blobs_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/git/refs{/sha}","trees_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/statuses/{sha}","languages_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/languages","stargazers_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/stargazers","contributors_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/contributors","subscribers_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/subscribers","subscription_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/subscription","commits_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/commits{/sha}","git_commits_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/git/commits{/sha}","comments_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/comments{/number}","issue_comment_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/issues/comments{/number}","contents_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/contents/{+path}","compare_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/merges","archive_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/downloads","issues_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/issues{/number}","pulls_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/pulls{/number}","milestones_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/milestones{/number}","notifications_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/labels{/name}","releases_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/releases{/id}","deployments_url":"https://api.github.com/repos/juanvallejo/openshift-ansible/deployments","created_at":"2017-02-20T19:18:13Z","updated_at":"2017-02-20T19:18:19Z","pushed_at":"2017-06-16T21:24:18Z","git_url":"git://github.com/juanvallejo/openshift-ansible.git","ssh_url":"git@github.com:juanvallejo/openshift-ansible.git","clone_url":"https://github.com/juanvallejo/openshift-ansible.git","svn_url":"https://github.com/juanvallejo/openshift-ansible","homepage":"https://install.openshift.com","size":13740,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"b3772d718802191276e3a6278cc5628df5056399","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars0.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":24109199,"name":"openshift-ansible","full_name":"openshift/openshift-ansible","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars0.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/openshift-ansible","description":"OpenShift Installation and Configuration Management","fork":false,"url":"https://api.github.com/repos/openshift/openshift-ansible","forks_url":"https://api.github.com/repos/openshift/openshift-ansible/forks","keys_url":"https://api.github.com/repos/openshift/openshift-ansible/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/openshift-ansible/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/openshift-ansible/teams","hooks_url":"https://api.github.com/repos/openshift/openshift-ansible/hooks","issue_events_url":"https://api.github.com/repos/openshift/openshift-ansible/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/openshift-ansible/events","assignees_url":"https://api.github.com/repos/openshift/openshift-ansible/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/openshift-ansible/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/openshift-ansible/tags","blobs_url":"https://api.github.com/repos/openshift/openshift-ansible/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/openshift-ansible/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/openshift-ansible/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/openshift-ansible/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/openshift-ansible/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/openshift-ansible/languages","stargazers_url":"https://api.github.com/repos/openshift/openshift-ansible/stargazers","contributors_url":"https://api.github.com/repos/openshift/openshift-ansible/contributors","subscribers_url":"https://api.github.com/repos/openshift/openshift-ansible/subscribers","subscription_url":"https://api.github.com/repos/openshift/openshift-ansible/subscription","commits_url":"https://api.github.com/repos/openshift/openshift-ansible/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/openshift-ansible/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/openshift-ansible/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/openshift-ansible/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/openshift-ansible/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/openshift-ansible/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/openshift-ansible/merges","archive_url":"https://api.github.com/repos/openshift/openshift-ansible/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/openshift-ansible/downloads","issues_url":"https://api.github.com/repos/openshift/openshift-ansible/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/openshift-ansible/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/openshift-ansible/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/openshift-ansible/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/openshift-ansible/labels{/name}","releases_url":"https://api.github.com/repos/openshift/openshift-ansible/releases{/id}","deployments_url":"https://api.github.com/repos/openshift/openshift-ansible/deployments","created_at":"2014-09-16T17:07:51Z","updated_at":"2017-06-18T11:03:45Z","pushed_at":"2017-06-18T07:03:18Z","git_url":"git://github.com/openshift/openshift-ansible.git","ssh_url":"git@github.com:openshift/openshift-ansible.git","clone_url":"https://github.com/openshift/openshift-ansible.git","svn_url":"https://github.com/openshift/openshift-ansible","homepage":"https://install.openshift.com","size":14751,"stargazers_count":463,"watchers_count":463,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":736,"mirror_url":null,"open_issues_count":474,"forks":736,"open_issues":474,"watchers":463,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/openshift-ansible/pulls/4316"},"html":{"href":"https://github.com/openshift/openshift-ansible/pull/4316"},"issue":{"href":"https://api.github.com/repos/openshift/openshift-ansible/issues/4316"},"comments":{"href":"https://api.github.com/repos/openshift/openshift-ansible/issues/4316/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/openshift-ansible/pulls/4316/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/openshift-ansible/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/openshift-ansible/pulls/4316/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/openshift-ansible/statuses/333a68a8114d2bbff2716b013493f99a1837ef53"}}}}
{"actor":{"display_login":"rhcarvalho"}}