{"action":"created","comment":{"url":"https://api.github.com/repos/influxdata/telegraf/pulls/comments/207912068","pull_request_review_id":143617774,"id":207912068,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNzkxMjA2OA==","diff_hunk":"@@ -0,0 +1,75 @@\n+package vsphere\n+\n+import (\n+\t\"context\"\n+\t\"log\"\n+\t\"net/url\"\n+\n+\t\"github.com/vmware/govmomi\"\n+\t\"github.com/vmware/govmomi/performance\"\n+\t\"github.com/vmware/govmomi/view\"\n+)\n+\n+// Client represents a connection to vSphere and is backed by a govmoni connection\n+type Client struct {\n+\tClient *govmomi.Client\n+\tViews  *view.Manager\n+\tRoot   *view.ContainerView\n+\tPerf   *performance.Manager\n+\tValid  bool\n+}\n+\n+// NewClient creates a new vSphere client based on the url and setting passed as parameters.\n+func NewClient(u *url.URL, vs *VSphere) (*Client, error) {\n+\ttlsCfg, err := vs.TLSConfig()\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\tif vs.Username != \"\" {\n+\t\tlog.Printf(\"D! Logging in using explicit credentials: %s\", vs.Username)\n+\t\tu.User = url.UserPassword(vs.Username, vs.Password)\n+\t}\n+\tctx := context.Background()\n+\n+\tlog.Printf(\"D! Creating client: %s\", u.Host)\n+\tc, err := govmomi.NewClient(ctx, u, vs.InsecureSkipVerify)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\t// Add certificate if we have it\n+\t//\n+\tif tlsCfg != nil && len(tlsCfg.Certificates) > 0 {\n+\t\tc.Client.SetCertificate(tlsCfg.Certificates[0])\n+\t}\n+\n+\tc.Timeout = vs.Timeout.Duration\n+\tm := view.NewManager(c.Client)\n+\n+\tv, err := m.CreateContainerView(ctx, c.ServiceContent.RootFolder, []string{}, true)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\tp := performance.NewManager(c.Client)\n+\n+\treturn &Client{\n+\t\tClient: c,\n+\t\tViews:  m,\n+\t\tRoot:   v,\n+\t\tPerf:   p,\n+\t\tValid:  true,\n+\t}, nil\n+}\n+\n+// Close disconnects a client from the vSphere backend and releases all assiciated resources.\n+func (c *Client) Close() {","path":"plugins/inputs/vsphere/client.go","position":69,"original_position":66,"commit_id":"c2a2f57513e6105b9267eeb48bf4c4592be64691","original_commit_id":"654135acc88c0dc43295d83f297d5c6aa9d11316","user":{"login":"prydin","id":5239535,"node_id":"MDQ6VXNlcjUyMzk1MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/5239535?v=4","gravatar_id":"","url":"https://api.github.com/users/prydin","html_url":"https://github.com/prydin","followers_url":"https://api.github.com/users/prydin/followers","following_url":"https://api.github.com/users/prydin/following{/other_user}","gists_url":"https://api.github.com/users/prydin/gists{/gist_id}","starred_url":"https://api.github.com/users/prydin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prydin/subscriptions","organizations_url":"https://api.github.com/users/prydin/orgs","repos_url":"https://api.github.com/users/prydin/repos","events_url":"https://api.github.com/users/prydin/events{/privacy}","received_events_url":"https://api.github.com/users/prydin/received_events","type":"User","site_admin":false},"body":"Completely refactored the logic for reloading the agent. This functions is now called.","created_at":"2018-08-06T14:30:43Z","updated_at":"2018-08-06T14:30:43Z","html_url":"https://github.com/influxdata/telegraf/pull/4141#discussion_r207912068","pull_request_url":"https://api.github.com/repos/influxdata/telegraf/pulls/4141","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/influxdata/telegraf/pulls/comments/207912068"},"html":{"href":"https://github.com/influxdata/telegraf/pull/4141#discussion_r207912068"},"pull_request":{"href":"https://api.github.com/repos/influxdata/telegraf/pulls/4141"}},"in_reply_to_id":204944762},"pull_request":{"url":"https://api.github.com/repos/influxdata/telegraf/pulls/4141","id":187593245,"node_id":"MDExOlB1bGxSZXF1ZXN0MTg3NTkzMjQ1","html_url":"https://github.com/influxdata/telegraf/pull/4141","diff_url":"https://github.com/influxdata/telegraf/pull/4141.diff","patch_url":"https://github.com/influxdata/telegraf/pull/4141.patch","issue_url":"https://api.github.com/repos/influxdata/telegraf/issues/4141","number":4141,"state":"open","locked":false,"title":"Added input plugin for VMware vSphere.","user":{"login":"prydin","id":5239535,"node_id":"MDQ6VXNlcjUyMzk1MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/5239535?v=4","gravatar_id":"","url":"https://api.github.com/users/prydin","html_url":"https://github.com/prydin","followers_url":"https://api.github.com/users/prydin/followers","following_url":"https://api.github.com/users/prydin/following{/other_user}","gists_url":"https://api.github.com/users/prydin/gists{/gist_id}","starred_url":"https://api.github.com/users/prydin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prydin/subscriptions","organizations_url":"https://api.github.com/users/prydin/orgs","repos_url":"https://api.github.com/users/prydin/repos","events_url":"https://api.github.com/users/prydin/events{/privacy}","received_events_url":"https://api.github.com/users/prydin/received_events","type":"User","site_admin":false},"body":"Added full support for vSphere monitoring. Supports vms, hosts, clusters and datastores. Allows filtering of metrics and resources. Written by Pontus Rydin, VMware and Pierre Tessier, VMware.\r\n\r\n### Required for all PRs:\r\n\r\n- [ X ] Signed [CLA](https://influxdata.com/community/cla/).\r\n- [ X ] Associated README.md updated.\r\n- [ X ] Has appropriate unit tests.\r\n#","created_at":"2018-05-12T00:03:39Z","updated_at":"2018-08-06T14:30:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"87805d15be62f99bd9a22b8db1a17162c9b34c49","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":696213361,"node_id":"MDU6TGFiZWw2OTYyMTMzNjE=","url":"https://api.github.com/repos/influxdata/telegraf/labels/new%20plugin","name":"new plugin","color":"513cc6","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/influxdata/telegraf/pulls/4141/commits","review_comments_url":"https://api.github.com/repos/influxdata/telegraf/pulls/4141/comments","review_comment_url":"https://api.github.com/repos/influxdata/telegraf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/influxdata/telegraf/issues/4141/comments","statuses_url":"https://api.github.com/repos/influxdata/telegraf/statuses/c2a2f57513e6105b9267eeb48bf4c4592be64691","head":{"label":"prydin:master","ref":"master","sha":"c2a2f57513e6105b9267eeb48bf4c4592be64691","user":{"login":"prydin","id":5239535,"node_id":"MDQ6VXNlcjUyMzk1MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/5239535?v=4","gravatar_id":"","url":"https://api.github.com/users/prydin","html_url":"https://github.com/prydin","followers_url":"https://api.github.com/users/prydin/followers","following_url":"https://api.github.com/users/prydin/following{/other_user}","gists_url":"https://api.github.com/users/prydin/gists{/gist_id}","starred_url":"https://api.github.com/users/prydin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prydin/subscriptions","organizations_url":"https://api.github.com/users/prydin/orgs","repos_url":"https://api.github.com/users/prydin/repos","events_url":"https://api.github.com/users/prydin/events{/privacy}","received_events_url":"https://api.github.com/users/prydin/received_events","type":"User","site_admin":false},"repo":{"id":105369728,"node_id":"MDEwOlJlcG9zaXRvcnkxMDUzNjk3Mjg=","name":"telegraf","full_name":"prydin/telegraf","owner":{"login":"prydin","id":5239535,"node_id":"MDQ6VXNlcjUyMzk1MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/5239535?v=4","gravatar_id":"","url":"https://api.github.com/users/prydin","html_url":"https://github.com/prydin","followers_url":"https://api.github.com/users/prydin/followers","following_url":"https://api.github.com/users/prydin/following{/other_user}","gists_url":"https://api.github.com/users/prydin/gists{/gist_id}","starred_url":"https://api.github.com/users/prydin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prydin/subscriptions","organizations_url":"https://api.github.com/users/prydin/orgs","repos_url":"https://api.github.com/users/prydin/repos","events_url":"https://api.github.com/users/prydin/events{/privacy}","received_events_url":"https://api.github.com/users/prydin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/prydin/telegraf","description":"The plugin-driven server agent for collecting & reporting metrics.","fork":true,"url":"https://api.github.com/repos/prydin/telegraf","forks_url":"https://api.github.com/repos/prydin/telegraf/forks","keys_url":"https://api.github.com/repos/prydin/telegraf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prydin/telegraf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prydin/telegraf/teams","hooks_url":"https://api.github.com/repos/prydin/telegraf/hooks","issue_events_url":"https://api.github.com/repos/prydin/telegraf/issues/events{/number}","events_url":"https://api.github.com/repos/prydin/telegraf/events","assignees_url":"https://api.github.com/repos/prydin/telegraf/assignees{/user}","branches_url":"https://api.github.com/repos/prydin/telegraf/branches{/branch}","tags_url":"https://api.github.com/repos/prydin/telegraf/tags","blobs_url":"https://api.github.com/repos/prydin/telegraf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prydin/telegraf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prydin/telegraf/git/refs{/sha}","trees_url":"https://api.github.com/repos/prydin/telegraf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prydin/telegraf/statuses/{sha}","languages_url":"https://api.github.com/repos/prydin/telegraf/languages","stargazers_url":"https://api.github.com/repos/prydin/telegraf/stargazers","contributors_url":"https://api.github.com/repos/prydin/telegraf/contributors","subscribers_url":"https://api.github.com/repos/prydin/telegraf/subscribers","subscription_url":"https://api.github.com/repos/prydin/telegraf/subscription","commits_url":"https://api.github.com/repos/prydin/telegraf/commits{/sha}","git_commits_url":"https://api.github.com/repos/prydin/telegraf/git/commits{/sha}","comments_url":"https://api.github.com/repos/prydin/telegraf/comments{/number}","issue_comment_url":"https://api.github.com/repos/prydin/telegraf/issues/comments{/number}","contents_url":"https://api.github.com/repos/prydin/telegraf/contents/{+path}","compare_url":"https://api.github.com/repos/prydin/telegraf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prydin/telegraf/merges","archive_url":"https://api.github.com/repos/prydin/telegraf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prydin/telegraf/downloads","issues_url":"https://api.github.com/repos/prydin/telegraf/issues{/number}","pulls_url":"https://api.github.com/repos/prydin/telegraf/pulls{/number}","milestones_url":"https://api.github.com/repos/prydin/telegraf/milestones{/number}","notifications_url":"https://api.github.com/repos/prydin/telegraf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prydin/telegraf/labels{/name}","releases_url":"https://api.github.com/repos/prydin/telegraf/releases{/id}","deployments_url":"https://api.github.com/repos/prydin/telegraf/deployments","created_at":"2017-09-30T12:53:04Z","updated_at":"2018-08-04T22:33:07Z","pushed_at":"2018-08-04T22:33:05Z","git_url":"git://github.com/prydin/telegraf.git","ssh_url":"git@github.com:prydin/telegraf.git","clone_url":"https://github.com/prydin/telegraf.git","svn_url":"https://github.com/prydin/telegraf","homepage":"","size":18259,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"influxdata:master","ref":"master","sha":"9491cd91cda59eb4ffaa0ca2b4821679bdc510da","user":{"login":"influxdata","id":5713248,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU3MTMyNDg=","avatar_url":"https://avatars2.githubusercontent.com/u/5713248?v=4","gravatar_id":"","url":"https://api.github.com/users/influxdata","html_url":"https://github.com/influxdata","followers_url":"https://api.github.com/users/influxdata/followers","following_url":"https://api.github.com/users/influxdata/following{/other_user}","gists_url":"https://api.github.com/users/influxdata/gists{/gist_id}","starred_url":"https://api.github.com/users/influxdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/influxdata/subscriptions","organizations_url":"https://api.github.com/users/influxdata/orgs","repos_url":"https://api.github.com/users/influxdata/repos","events_url":"https://api.github.com/users/influxdata/events{/privacy}","received_events_url":"https://api.github.com/users/influxdata/received_events","type":"Organization","site_admin":false},"repo":{"id":33258973,"node_id":"MDEwOlJlcG9zaXRvcnkzMzI1ODk3Mw==","name":"telegraf","full_name":"influxdata/telegraf","owner":{"login":"influxdata","id":5713248,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU3MTMyNDg=","avatar_url":"https://avatars2.githubusercontent.com/u/5713248?v=4","gravatar_id":"","url":"https://api.github.com/users/influxdata","html_url":"https://github.com/influxdata","followers_url":"https://api.github.com/users/influxdata/followers","following_url":"https://api.github.com/users/influxdata/following{/other_user}","gists_url":"https://api.github.com/users/influxdata/gists{/gist_id}","starred_url":"https://api.github.com/users/influxdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/influxdata/subscriptions","organizations_url":"https://api.github.com/users/influxdata/orgs","repos_url":"https://api.github.com/users/influxdata/repos","events_url":"https://api.github.com/users/influxdata/events{/privacy}","received_events_url":"https://api.github.com/users/influxdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/influxdata/telegraf","description":"The plugin-driven server agent for collecting & reporting metrics.","fork":false,"url":"https://api.github.com/repos/influxdata/telegraf","forks_url":"https://api.github.com/repos/influxdata/telegraf/forks","keys_url":"https://api.github.com/repos/influxdata/telegraf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/influxdata/telegraf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/influxdata/telegraf/teams","hooks_url":"https://api.github.com/repos/influxdata/telegraf/hooks","issue_events_url":"https://api.github.com/repos/influxdata/telegraf/issues/events{/number}","events_url":"https://api.github.com/repos/influxdata/telegraf/events","assignees_url":"https://api.github.com/repos/influxdata/telegraf/assignees{/user}","branches_url":"https://api.github.com/repos/influxdata/telegraf/branches{/branch}","tags_url":"https://api.github.com/repos/influxdata/telegraf/tags","blobs_url":"https://api.github.com/repos/influxdata/telegraf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/influxdata/telegraf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/influxdata/telegraf/git/refs{/sha}","trees_url":"https://api.github.com/repos/influxdata/telegraf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/influxdata/telegraf/statuses/{sha}","languages_url":"https://api.github.com/repos/influxdata/telegraf/languages","stargazers_url":"https://api.github.com/repos/influxdata/telegraf/stargazers","contributors_url":"https://api.github.com/repos/influxdata/telegraf/contributors","subscribers_url":"https://api.github.com/repos/influxdata/telegraf/subscribers","subscription_url":"https://api.github.com/repos/influxdata/telegraf/subscription","commits_url":"https://api.github.com/repos/influxdata/telegraf/commits{/sha}","git_commits_url":"https://api.github.com/repos/influxdata/telegraf/git/commits{/sha}","comments_url":"https://api.github.com/repos/influxdata/telegraf/comments{/number}","issue_comment_url":"https://api.github.com/repos/influxdata/telegraf/issues/comments{/number}","contents_url":"https://api.github.com/repos/influxdata/telegraf/contents/{+path}","compare_url":"https://api.github.com/repos/influxdata/telegraf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/influxdata/telegraf/merges","archive_url":"https://api.github.com/repos/influxdata/telegraf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/influxdata/telegraf/downloads","issues_url":"https://api.github.com/repos/influxdata/telegraf/issues{/number}","pulls_url":"https://api.github.com/repos/influxdata/telegraf/pulls{/number}","milestones_url":"https://api.github.com/repos/influxdata/telegraf/milestones{/number}","notifications_url":"https://api.github.com/repos/influxdata/telegraf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/influxdata/telegraf/labels{/name}","releases_url":"https://api.github.com/repos/influxdata/telegraf/releases{/id}","deployments_url":"https://api.github.com/repos/influxdata/telegraf/deployments","created_at":"2015-04-01T16:28:44Z","updated_at":"2018-08-06T03:49:25Z","pushed_at":"2018-08-06T05:07:10Z","git_url":"git://github.com/influxdata/telegraf.git","ssh_url":"git@github.com:influxdata/telegraf.git","clone_url":"https://github.com/influxdata/telegraf.git","svn_url":"https://github.com/influxdata/telegraf","homepage":"","size":19359,"stargazers_count":5301,"watchers_count":5301,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1986,"mirror_url":null,"archived":false,"open_issues_count":628,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1986,"open_issues":628,"watchers":5301,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/influxdata/telegraf/pulls/4141"},"html":{"href":"https://github.com/influxdata/telegraf/pull/4141"},"issue":{"href":"https://api.github.com/repos/influxdata/telegraf/issues/4141"},"comments":{"href":"https://api.github.com/repos/influxdata/telegraf/issues/4141/comments"},"review_comments":{"href":"https://api.github.com/repos/influxdata/telegraf/pulls/4141/comments"},"review_comment":{"href":"https://api.github.com/repos/influxdata/telegraf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/influxdata/telegraf/pulls/4141/commits"},"statuses":{"href":"https://api.github.com/repos/influxdata/telegraf/statuses/c2a2f57513e6105b9267eeb48bf4c4592be64691"}},"author_association":"NONE"}}
{"actor":{"display_login":"prydin"}}