{"action":"created","comment":{"url":"https://api.github.com/repos/firehol/netdata/pulls/comments/185508484","pull_request_review_id":116911188,"id":185508484,"diff_hunk":"@@ -249,6 +273,28 @@ def _parse_config(self):\n             except (KeyError, TypeError):\n                 self.debug('No port specified. Using: \"{0}\"'.format(self.port))\n \n+            self.ssl = bool(self.configuration.get('ssl', self.ssl))\n+            if self.ssl and not _SSL_SUPPORT:\n+                self.warning('SSL requested but not SSL module found, disabling SSL support.')\n+                self.ssl = False\n+            if _SSL_SUPPORT and not self.ssl:\n+                self.debug('No SSL preference specified, not using SSL.')\n+\n+            if self.ssl and _SSL_SUPPORT:\n+                self.key = str(self.configuration.get('ssl_key'))\n+                self.cert = str(self.configuration.get('ssl_cert'))","path":"python.d/python_modules/bases/FrameworkServices/SocketService.py","position":63,"original_position":63,"commit_id":"bc06bf1fc5000c291445c90f61d22a92dd70fad5","original_commit_id":"bc06bf1fc5000c291445c90f61d22a92dd70fad5","user":{"login":"l2isbad","id":22274335,"avatar_url":"https://avatars3.githubusercontent.com/u/22274335?v=4","gravatar_id":"","url":"https://api.github.com/users/l2isbad","html_url":"https://github.com/l2isbad","followers_url":"https://api.github.com/users/l2isbad/followers","following_url":"https://api.github.com/users/l2isbad/following{/other_user}","gists_url":"https://api.github.com/users/l2isbad/gists{/gist_id}","starred_url":"https://api.github.com/users/l2isbad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/l2isbad/subscriptions","organizations_url":"https://api.github.com/users/l2isbad/orgs","repos_url":"https://api.github.com/users/l2isbad/repos","events_url":"https://api.github.com/users/l2isbad/events{/privacy}","received_events_url":"https://api.github.com/users/l2isbad/received_events","type":"User","site_admin":false},"body":"i believe `str` is not needed. How else can you set the key/cert? \r\nAnd `str(None)` is always True. \r\n","created_at":"2018-05-02T14:09:18Z","updated_at":"2018-05-02T14:09:23Z","html_url":"https://github.com/firehol/netdata/pull/3670#discussion_r185508484","pull_request_url":"https://api.github.com/repos/firehol/netdata/pulls/3670","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/firehol/netdata/pulls/comments/185508484"},"html":{"href":"https://github.com/firehol/netdata/pull/3670#discussion_r185508484"},"pull_request":{"href":"https://api.github.com/repos/firehol/netdata/pulls/3670"}}},"pull_request":{"url":"https://api.github.com/repos/firehol/netdata/pulls/3670","id":185247463,"html_url":"https://github.com/firehol/netdata/pull/3670","diff_url":"https://github.com/firehol/netdata/pull/3670.diff","patch_url":"https://github.com/firehol/netdata/pull/3670.patch","issue_url":"https://api.github.com/repos/firehol/netdata/issues/3670","number":3670,"state":"open","locked":false,"title":"Add a plugin for the Unbound DNS server.","user":{"login":"Ferroin","id":905151,"avatar_url":"https://avatars2.githubusercontent.com/u/905151?v=4","gravatar_id":"","url":"https://api.github.com/users/Ferroin","html_url":"https://github.com/Ferroin","followers_url":"https://api.github.com/users/Ferroin/followers","following_url":"https://api.github.com/users/Ferroin/following{/other_user}","gists_url":"https://api.github.com/users/Ferroin/gists{/gist_id}","starred_url":"https://api.github.com/users/Ferroin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ferroin/subscriptions","organizations_url":"https://api.github.com/users/Ferroin/orgs","repos_url":"https://api.github.com/users/Ferroin/repos","events_url":"https://api.github.com/users/Ferroin/events{/privacy}","received_events_url":"https://api.github.com/users/Ferroin/received_events","type":"User","site_admin":false},"body":"Unbound is a caching, recursive DNS resolver primarily used as a local DNS cache for Linux client systems, and to provide basic DNS service for a local network from a router.  It provides a bunch of statistics over it's remote control interface for tools like Netdata to collect.\r\n\r\nThis PR first adds rudimentary TLS encapsulation and client authentication support to `SocketService`, which is needed to allow TCP based communication with the Unbound remote control interface (they insist on using TLS with an X.509 client certificate for authentication if you're not using a UNIX socket for the connection).  This adds a conditional dependency on the `ssl` module from the Python standard library, if this module isn't found (and it may not be on some embedded systems where space is at a premium, because it depends on a big library and is pretty big itself) then there just won't be any TLS support, but everything else will continue to work as normal.  TLS support comes with 3 new keys for the `SocketService` configuration:\r\n\r\n* `ssl`: A simple boolean toggle controlling whether to use SSL/TLS or not.\r\n* `ssl_key`: Specifies the path to an X.509 private key to use for client authentication.\r\n* `ssl_cert`: Specifies the path to an X.509 certificate to be used for client authentication.\r\n\r\nIn the current default case of not using TLS support, this adds about 1.5-2.5ms to the initialization time of plugins using `SocketService` on most of my systems.  I've verified that this works correctly (that is, just like the existing `SocketService` module on systems that don't have the Python `ssl` module, and that existing modules work the same as before (other than the slightly higher initialization time mentioned above).\r\n\r\nThe plugin is then added by the second commit.  It currently collects the following stats:\r\n\r\n* Query rates, including cache hit and miss rates, how many were dropped due to rate limiting, how many served expired data still in the cache, how many times items were pre-fetched into the cache and how many triggered upstream recursion.\r\n* Various stats about the internal request processing list, including the average and maximum size over the previous collection period, the current number of requests in the list, how many are user requests (as opposed to internal requests such as pre-fetching requests), and how many requests had to be dropped because the list was full (which should obviously be zero most of the time).\r\n* Average and median (50th percentile) processing times for upstream recursive requests.\r\n* Optionally (if you turn on extended stats in both Unbound and the plugin), how many items are in each of the caches.\r\n\r\nUnbound actually provides more stats than what this plugin collects, but most of them are largely only of interest to developers or individuals who are debugging low-level issues with Unbound's internals (things like exact memory usage of the various components, or per-thread stats).  Most of these (other than the per-thread stats) can be added pretty easily if desired, but I didn't include them here because I have no use for them.\r\n\r\nThe plugin supports auto-detection of most of the required settings when connecting to the local host if you tell it where the config for Unbound is, although this is dependent on `unbound.conf` being parseable as YAML (technically, it _is_YAML file, except Unbound allows tabs for indentation, and the upstream config example (and therefore almost every distribution config) use tabs).\r\n\r\nThe plugin itself is disabled by default as it requires some non-trivial changes from the default Unbound configuration to set up and enable the remote control interface, as well as some mucking about with permissions to get it all working correctly (although the permissions changes can be avoided by running Netdata either as root or as the same user as the Unbound server process).  \r\n\r\nExample graphs from one of my systems (which has very little DNS load and as a result doesn't show most of the stats (because they're all just zero)):\r\n![image](https://user-images.githubusercontent.com/905151/39487804-5747b9a4-4d4e-11e8-9346-429d348609cd.png)\r\n\r\nLightly tested on half a dozen of my own systems using a variety of remote-control interface configurations.","created_at":"2018-05-01T18:53:46Z","updated_at":"2018-05-02T14:09:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"59559854a9ba79cc60cc414e7c9ff59324949ea2","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/firehol/netdata/pulls/3670/commits","review_comments_url":"https://api.github.com/repos/firehol/netdata/pulls/3670/comments","review_comment_url":"https://api.github.com/repos/firehol/netdata/pulls/comments{/number}","comments_url":"https://api.github.com/repos/firehol/netdata/issues/3670/comments","statuses_url":"https://api.github.com/repos/firehol/netdata/statuses/bc06bf1fc5000c291445c90f61d22a92dd70fad5","head":{"label":"Ferroin:unbound-dns","ref":"unbound-dns","sha":"bc06bf1fc5000c291445c90f61d22a92dd70fad5","user":{"login":"Ferroin","id":905151,"avatar_url":"https://avatars2.githubusercontent.com/u/905151?v=4","gravatar_id":"","url":"https://api.github.com/users/Ferroin","html_url":"https://github.com/Ferroin","followers_url":"https://api.github.com/users/Ferroin/followers","following_url":"https://api.github.com/users/Ferroin/following{/other_user}","gists_url":"https://api.github.com/users/Ferroin/gists{/gist_id}","starred_url":"https://api.github.com/users/Ferroin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ferroin/subscriptions","organizations_url":"https://api.github.com/users/Ferroin/orgs","repos_url":"https://api.github.com/users/Ferroin/repos","events_url":"https://api.github.com/users/Ferroin/events{/privacy}","received_events_url":"https://api.github.com/users/Ferroin/received_events","type":"User","site_admin":false},"repo":{"id":123435635,"name":"netdata","full_name":"Ferroin/netdata","owner":{"login":"Ferroin","id":905151,"avatar_url":"https://avatars2.githubusercontent.com/u/905151?v=4","gravatar_id":"","url":"https://api.github.com/users/Ferroin","html_url":"https://github.com/Ferroin","followers_url":"https://api.github.com/users/Ferroin/followers","following_url":"https://api.github.com/users/Ferroin/following{/other_user}","gists_url":"https://api.github.com/users/Ferroin/gists{/gist_id}","starred_url":"https://api.github.com/users/Ferroin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ferroin/subscriptions","organizations_url":"https://api.github.com/users/Ferroin/orgs","repos_url":"https://api.github.com/users/Ferroin/repos","events_url":"https://api.github.com/users/Ferroin/events{/privacy}","received_events_url":"https://api.github.com/users/Ferroin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Ferroin/netdata","description":"Get control of your servers. Simple. Effective. Awesome! https://my-netdata.io/","fork":true,"url":"https://api.github.com/repos/Ferroin/netdata","forks_url":"https://api.github.com/repos/Ferroin/netdata/forks","keys_url":"https://api.github.com/repos/Ferroin/netdata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ferroin/netdata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ferroin/netdata/teams","hooks_url":"https://api.github.com/repos/Ferroin/netdata/hooks","issue_events_url":"https://api.github.com/repos/Ferroin/netdata/issues/events{/number}","events_url":"https://api.github.com/repos/Ferroin/netdata/events","assignees_url":"https://api.github.com/repos/Ferroin/netdata/assignees{/user}","branches_url":"https://api.github.com/repos/Ferroin/netdata/branches{/branch}","tags_url":"https://api.github.com/repos/Ferroin/netdata/tags","blobs_url":"https://api.github.com/repos/Ferroin/netdata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ferroin/netdata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ferroin/netdata/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ferroin/netdata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ferroin/netdata/statuses/{sha}","languages_url":"https://api.github.com/repos/Ferroin/netdata/languages","stargazers_url":"https://api.github.com/repos/Ferroin/netdata/stargazers","contributors_url":"https://api.github.com/repos/Ferroin/netdata/contributors","subscribers_url":"https://api.github.com/repos/Ferroin/netdata/subscribers","subscription_url":"https://api.github.com/repos/Ferroin/netdata/subscription","commits_url":"https://api.github.com/repos/Ferroin/netdata/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ferroin/netdata/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ferroin/netdata/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ferroin/netdata/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ferroin/netdata/contents/{+path}","compare_url":"https://api.github.com/repos/Ferroin/netdata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ferroin/netdata/merges","archive_url":"https://api.github.com/repos/Ferroin/netdata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ferroin/netdata/downloads","issues_url":"https://api.github.com/repos/Ferroin/netdata/issues{/number}","pulls_url":"https://api.github.com/repos/Ferroin/netdata/pulls{/number}","milestones_url":"https://api.github.com/repos/Ferroin/netdata/milestones{/number}","notifications_url":"https://api.github.com/repos/Ferroin/netdata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ferroin/netdata/labels{/name}","releases_url":"https://api.github.com/repos/Ferroin/netdata/releases{/id}","deployments_url":"https://api.github.com/repos/Ferroin/netdata/deployments","created_at":"2018-03-01T13:02:44Z","updated_at":"2018-04-27T11:58:37Z","pushed_at":"2018-05-02T13:42:42Z","git_url":"git://github.com/Ferroin/netdata.git","ssh_url":"git@github.com:Ferroin/netdata.git","clone_url":"https://github.com/Ferroin/netdata.git","svn_url":"https://github.com/Ferroin/netdata","homepage":"","size":23559,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"firehol:master","ref":"master","sha":"772d01106637ff3ee46011792204010defd3ffc4","user":{"login":"firehol","id":9442231,"avatar_url":"https://avatars2.githubusercontent.com/u/9442231?v=4","gravatar_id":"","url":"https://api.github.com/users/firehol","html_url":"https://github.com/firehol","followers_url":"https://api.github.com/users/firehol/followers","following_url":"https://api.github.com/users/firehol/following{/other_user}","gists_url":"https://api.github.com/users/firehol/gists{/gist_id}","starred_url":"https://api.github.com/users/firehol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firehol/subscriptions","organizations_url":"https://api.github.com/users/firehol/orgs","repos_url":"https://api.github.com/users/firehol/repos","events_url":"https://api.github.com/users/firehol/events{/privacy}","received_events_url":"https://api.github.com/users/firehol/received_events","type":"Organization","site_admin":false},"repo":{"id":10744183,"name":"netdata","full_name":"firehol/netdata","owner":{"login":"firehol","id":9442231,"avatar_url":"https://avatars2.githubusercontent.com/u/9442231?v=4","gravatar_id":"","url":"https://api.github.com/users/firehol","html_url":"https://github.com/firehol","followers_url":"https://api.github.com/users/firehol/followers","following_url":"https://api.github.com/users/firehol/following{/other_user}","gists_url":"https://api.github.com/users/firehol/gists{/gist_id}","starred_url":"https://api.github.com/users/firehol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firehol/subscriptions","organizations_url":"https://api.github.com/users/firehol/orgs","repos_url":"https://api.github.com/users/firehol/repos","events_url":"https://api.github.com/users/firehol/events{/privacy}","received_events_url":"https://api.github.com/users/firehol/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/firehol/netdata","description":"Get control of your servers. Simple. Effective. Awesome! https://my-netdata.io/","fork":false,"url":"https://api.github.com/repos/firehol/netdata","forks_url":"https://api.github.com/repos/firehol/netdata/forks","keys_url":"https://api.github.com/repos/firehol/netdata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/firehol/netdata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/firehol/netdata/teams","hooks_url":"https://api.github.com/repos/firehol/netdata/hooks","issue_events_url":"https://api.github.com/repos/firehol/netdata/issues/events{/number}","events_url":"https://api.github.com/repos/firehol/netdata/events","assignees_url":"https://api.github.com/repos/firehol/netdata/assignees{/user}","branches_url":"https://api.github.com/repos/firehol/netdata/branches{/branch}","tags_url":"https://api.github.com/repos/firehol/netdata/tags","blobs_url":"https://api.github.com/repos/firehol/netdata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/firehol/netdata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/firehol/netdata/git/refs{/sha}","trees_url":"https://api.github.com/repos/firehol/netdata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/firehol/netdata/statuses/{sha}","languages_url":"https://api.github.com/repos/firehol/netdata/languages","stargazers_url":"https://api.github.com/repos/firehol/netdata/stargazers","contributors_url":"https://api.github.com/repos/firehol/netdata/contributors","subscribers_url":"https://api.github.com/repos/firehol/netdata/subscribers","subscription_url":"https://api.github.com/repos/firehol/netdata/subscription","commits_url":"https://api.github.com/repos/firehol/netdata/commits{/sha}","git_commits_url":"https://api.github.com/repos/firehol/netdata/git/commits{/sha}","comments_url":"https://api.github.com/repos/firehol/netdata/comments{/number}","issue_comment_url":"https://api.github.com/repos/firehol/netdata/issues/comments{/number}","contents_url":"https://api.github.com/repos/firehol/netdata/contents/{+path}","compare_url":"https://api.github.com/repos/firehol/netdata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/firehol/netdata/merges","archive_url":"https://api.github.com/repos/firehol/netdata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/firehol/netdata/downloads","issues_url":"https://api.github.com/repos/firehol/netdata/issues{/number}","pulls_url":"https://api.github.com/repos/firehol/netdata/pulls{/number}","milestones_url":"https://api.github.com/repos/firehol/netdata/milestones{/number}","notifications_url":"https://api.github.com/repos/firehol/netdata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/firehol/netdata/labels{/name}","releases_url":"https://api.github.com/repos/firehol/netdata/releases{/id}","deployments_url":"https://api.github.com/repos/firehol/netdata/deployments","created_at":"2013-06-17T18:39:10Z","updated_at":"2018-05-02T13:10:26Z","pushed_at":"2018-05-02T13:42:45Z","git_url":"git://github.com/firehol/netdata.git","ssh_url":"git@github.com:firehol/netdata.git","clone_url":"https://github.com/firehol/netdata.git","svn_url":"https://github.com/firehol/netdata","homepage":"","size":23471,"stargazers_count":29193,"watchers_count":29193,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2445,"mirror_url":null,"archived":false,"open_issues_count":419,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":2445,"open_issues":419,"watchers":29193,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/firehol/netdata/pulls/3670"},"html":{"href":"https://github.com/firehol/netdata/pull/3670"},"issue":{"href":"https://api.github.com/repos/firehol/netdata/issues/3670"},"comments":{"href":"https://api.github.com/repos/firehol/netdata/issues/3670/comments"},"review_comments":{"href":"https://api.github.com/repos/firehol/netdata/pulls/3670/comments"},"review_comment":{"href":"https://api.github.com/repos/firehol/netdata/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/firehol/netdata/pulls/3670/commits"},"statuses":{"href":"https://api.github.com/repos/firehol/netdata/statuses/bc06bf1fc5000c291445c90f61d22a92dd70fad5"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"l2isbad"}}