###### vmware query ############

vc="vcenter7.zabbix.sandbox"
u="administrator@zabbix.sandbox"
p="password"

curl -k -c /tmp/vm_cookie --location --request POST 'https://'$vc'/sdk/vimService.wsdl' \
--header 'Content-Type: application/xml' \
-d '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:Login>
         <urn:_this type="SessionManager">SessionManager</urn:_this>
         <urn:userName>'$u'</urn:userName>
         <urn:password>'$p'</urn:password>
      </urn:Login>
   </soapenv:Body>
</soapenv:Envelope>' \
> /dev/null


curl -k -b /tmp/vm_cookie --location --request POST 'https://'$vc'/sdk/vimService.wsdl' \
--header 'Content-Type: text/xml;charset=UTF-8' \
--header 'SOAPAction: "urn:vim25/6.0"' \
-d '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">
<soapenv:Header/>
   <soapenv:Body>
      <urn:RetrieveProperties>
         <urn:_this type="PropertyCollector">propertyCollector</urn:_this>
         <urn:specSet>
            <urn:propSet>
               <urn:type>PerformanceManager</urn:type>
               <urn:pathSet>perfCounter</urn:pathSet>
            </urn:propSet>
            <urn:objectSet>
               <urn:obj type="PerformanceManager">PerfMgr</urn:obj>
            </urn:objectSet>
         </urn:specSet>
      </urn:RetrieveProperties>
   </soapenv:Body>
</soapenv:Envelope>' > ./metrics.xml

curl -k -b /tmp/vm_cookie --location --request POST 'https://'$vc'/sdk/vimService.wsdl' \
--header 'Content-Type: application/xml' \
-d '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:Logout>
         <urn:_this type="SessionManager">SessionManager</urn:_this>
      </urn:Logout>
   </soapenv:Body>
</soapenv:Envelope>' \
> /dev/null
