VMware Cloud Community
Subnet88
Enthusiast
Enthusiast

ESXCLI from VCO

Hi all,

Is there a way to run a ESXCLI command to a host from VCO? Specifically running the command "esxcli system syslog reload"

8 Replies
tschoergez
Leadership
Leadership

hm, is using the SSH Plugin a solution, to run the command via SSH to the ESXi host?

Reply
0 Kudos
jcp0wermac
Enthusiast
Enthusiast

I have workflows that actually implement EsxCli in vCO but they are extremely rough.  At the time I wrote it there is little to no api documentation so I had to use wireshark and remote esxcli commands to see what SOAP methods were being called.  If you want it I can post the package later tonight with the caution I take no responsibility for the workflows.


Joe

Reply
0 Kudos
qc4vmware
Virtuoso
Virtuoso

I use a vMA for this kind of stuff along with the SSH plugin.  You should also be able to install the cli local to the vCO and run the command if it is a Windows version of vCO you are using.

Reply
0 Kudos
Subnet88
Enthusiast
Enthusiast

I would rather not use the vMA or SSH. I guess I could use Powershell, however I would rather avoid it.

Joe, I would love if you could share your Workflow. Thank you.

Reply
0 Kudos
jcp0wermac
Enthusiast
Enthusiast

OK, here you go.  The section highlighted will need to be modified.  I just ran it against 5.5 and it still kinda works 😉

Any updates if you would please post them.

I know I am repeating myself but just want to make sure the warning was understood...this is a complete hack, it could eat your cat :smileygrin:

VMware vCenter Orchestrator - vCO Administrator @ 10.53.252.25_032.png

jcp0wermac
Enthusiast
Enthusiast

Subnet88 I just ran your example against my home lab and it returned true, so surprisingly it works:

[2013-11-19 16:11:41.020] [I] xml

[2013-11-19 16:11:41.176] [I] vmware_soap_session="5261ed9b-fa0c-5282-148b-b30b6907af91"; Path=/; HttpOnly; Secure;

[2013-11-19 16:11:58.023] [I] <?xml version="1.0" encoding="UTF-8"?>

<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:xsd="http://www.w3.org/2001/XMLSchema"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<soapenv:Body>

<VimCLIInfoFetchCLIInfoResponse xmlns="urn:vim25"><returnval><name>system.syslog</name><displayName>syslog</displayName><help>Operations relating to system logging</help><method><name>mark</name><displayName>mark</displayName><help>Mark all logs with the specified string</help><param><name>message</name><displayName>message</displayName><aliases>-s</aliases><aliases>--message</aliases><help>The message to place in the logs</help></param><ret><name>result</name></ret><hints><key>formatter</key><value></value></hints></method><method><name>reload</name><displayName>reload</displayName><help>Reload the log daemon to apply any new configuration options</help><ret><name>result</name></ret><hints><key>formatter</key><value></value></hints></method></returnval></VimCLIInfoFetchCLIInfoResponse>

</soapenv:Body>

</soapenv:Envelope>

[2013-11-19 16:12:08.353] [I] loc: 4

[2013-11-19 16:12:08.354] [I] loc: 3

[2013-11-19 16:12:08.354] [I] loc: 2

[2013-11-19 16:12:08.354] [I] loc: 1

[2013-11-19 16:12:08.355] [I] loc: 0

[2013-11-19 16:12:08.355] [I] loc: 7

[2013-11-19 16:12:08.356] [I] loc: 6

[2013-11-19 16:12:08.356] [I] loc: 5

[2013-11-19 16:12:08.406] [I] <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <soapenv:Body>

    <VimEsxCLIsystemsyslogreload xmlns="urn:vim25">

      <_this type="VimEsxCLIsystemsyslog">ha-cli-handler-system-syslog</_this>

    </VimEsxCLIsystemsyslogreload>

  </soapenv:Body>

</soapenv:Envelope>

[2013-11-19 16:12:08.503] [I] <?xml version="1.0" encoding="UTF-8"?>

<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:xsd="http://www.w3.org/2001/XMLSchema"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<soapenv:Body>

<VimEsxCLIsystemsyslogreloadResponse xmlns="urn:vim25"><returnval>true</returnval></VimEsxCLIsystemsyslogreloadResponse>

</soapenv:Body>

</soapenv:Envelope>

[2013-11-19 16:12:08.534] [I] key: Envelope = [object Object]

[2013-11-19 16:12:08.535] [I] key: Body = [object Object]

[2013-11-19 16:12:08.535] [I] key: VimEsxCLIsystemsyslogreloadResponse = [object Object]

[2013-11-19 16:12:08.535] [I] key: returnval = true

[2013-11-19 16:12:08.535] [I] key: xmlns = urn:vim25

[2013-11-19 16:12:08.535] [I] key: xmlns:xsd = http://www.w3.org/2001/XMLSchema

[2013-11-19 16:12:08.535] [I] key: xmlns:soapenc = http://schemas.xmlsoap.org/soap/encoding/

[2013-11-19 16:12:08.536] [I] key: xmlns:xsi = http://www.w3.org/2001/XMLSchema-instance

[2013-11-19 16:12:08.536] [I] key: xmlns:soapenv = http://schemas.xmlsoap.org/soap/envelope/

Reply
0 Kudos
tschoergez
Leadership
Leadership

This is DAMN COOL stuff! Thanks for sharing!

Reply
0 Kudos
aslk5
Enthusiast
Enthusiast

Does anyone have this working with 6.5 or 6.7? I'm trying to use it and it partially works. If I try to do a simple get it always fails (even fails when I try manually with Postman after building the calls manually based on what the workflow does) so I'm thinking the format has changed a bit.

Reply
0 Kudos