{"id":7915,"date":"2018-06-21T21:43:54","date_gmt":"2018-06-22T04:43:54","guid":{"rendered":"http:\/\/www.apolonio.com\/blog\/?p=7915"},"modified":"2018-06-21T21:43:54","modified_gmt":"2018-06-22T04:43:54","slug":"new-tool-for-virtual-center","status":"publish","type":"post","link":"https:\/\/www.apolonio.com\/blog\/?p=7915","title":{"rendered":"New Tool For Virtual Center"},"content":{"rendered":"<p>Today I had to query virtual center.<\/p>\n<p>I tried the old vmware-vix utility and it just did not work.<\/p>\n<p>Then I found a utility called govc, the binary can be downloaded from here<\/p>\n<pre>https:\/\/github.com\/vmware\/govmomi\/releases\/download\/v0.16.0\/govc_linux_amd64.gz<\/pre>\n<p>It&#8217;s a simple gunzip of the file and chmod +x<\/p>\n<p>I renamed it to govc and moved it to \/usr\/local\/bin<\/p>\n<p>It needed some enviromental variables to work, so I created a file<\/p>\n<p>parameters.env<\/p>\n<pre>export GOVC_URL='https:\/\/vc.example.local\/sdk'\r\nexport GOVC_INSECURE=true\r\nexport GOVC_USERNAME='example\\larry'\r\nexport GOVC_PASSWORD=someRANDOMPASSWORD<\/pre>\n<p>Then sourced the file<\/p>\n<pre>source paramaters.env<\/pre>\n<p>First thing I did was list<\/p>\n<pre>govc list<\/pre>\n<p>But then I wanted more, find was pretty cool<\/p>\n<pre>govc find \/STIA\/vm -type m<\/pre>\n<p>No screwey gui<\/p>\n<p>I got details for a paticular vm using the vm.info command but it did not give me annotations<\/p>\n<p>I was able to get it using json<\/p>\n<pre>govc vm.info -json VMNAME<\/pre>\n<p>But it wasn&#8217;t formatted right, I downloaded jq and a dependancy<\/p>\n<pre>wget http:\/\/dl.fedoraproject.org\/pub\/epel\/7\/x86_64\/Packages\/j\/jq-1.5-1.el7.x86_64.rpm\r\nwget http:\/\/dl.fedoraproject.org\/pub\/epel\/7\/x86_64\/Packages\/o\/oniguruma-5.9.5-3.el7.x86_64.rpm<\/pre>\n<p>And was able to read more complex information<\/p>\n<pre>govc vm.info -json VMNAME | jq .VirtualMachines[].Config\r\ngovc vm.info -json VMNAME | jq .VirtualMachines[].Guest.Net<\/pre>\n<p>And I got formatted readable stuff.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I had to query virtual center. I tried the old vmware-vix utility and it just did not work. Then I found a utility called govc, the binary can be downloaded from here https:\/\/github.com\/vmware\/govmomi\/releases\/download\/v0.16.0\/govc_linux_amd64.gz It&#8217;s a simple gunzip of the &hellip; <a href=\"https:\/\/www.apolonio.com\/blog\/?p=7915\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,3,12],"tags":[],"class_list":["post-7915","post","type-post","status-publish","format-standard","hentry","category-technical","category-training","category-virtualization"],"_links":{"self":[{"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7915","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7915"}],"version-history":[{"count":1,"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7915\/revisions"}],"predecessor-version":[{"id":7916,"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7915\/revisions\/7916"}],"wp:attachment":[{"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7915"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7915"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7915"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}