aenagy
Hot Shot
Hot Shot

How to do a simple health check of vAPI (vRO 7.3 and vCenter 6.0)

Jump to solution

From vRO how do I check to see that the vAPI service on a target vCenter is viable? The endpoint is already defined and working as there are other workflows that do tagging. I need something that can do a simple login/getAll check.

I could use this code (https://www.vcoteam.info/articles/learn-vco/307-leveraging-vcenter-6-vapi-rest-endpoint.html) but it would seem to make more sense to use what is currently available. The Orchestrator API explorer shows the scriptable object "com_vmware_cis_tagging_sessions_sessions_manager". I couldn't find any code samples on the Internet.

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee

1) All these actions with pscoe in their module name are not part of vAPI plug-in, I guess you've got them from some other plug-in/package.

2) Yes, by default it uses the credentials you provided in configuration workflows to import vAPI metamodel and register vAPI endpoint. If you want to use a different credentials for a particular vAPI method call, you can override them when you acquire a client from endpoint. That is, instead of

var client = endpoint.client();

you can use the form

var client = endpoint.client(someuser, somepassword);

View solution in original post

0 Kudos
3 Replies
iiliev
VMware Employee
VMware Employee

Hmm, I don't see such scriptable object in my environment, but there is another one com_vmware_cis_session. And there is an example workflow Create CIS session (coming with vAPI plug-in) that shows how to create a new session (don't forget to delete it afterwards).

BTW, most vAPI calls require authentication and the plug-in does login if needed before calling the API, but this login happen automatically without user knowing about it. So in theory almost any vAPI call can be used as a kind of health check.

0 Kudos
aenagy
Hot Shot
Hot Shot

iiliev

Hmm, I don't see such scriptable object in my environment, but there is another one com_vmware_cis_session. And there is an example workflow Create CIS session (coming with vAPI plug-in) that shows how to create a new session (don't forget to delete it afterwards).

BTW, most vAPI calls require authentication and the plug-in does login if needed before calling the API, but this login happen automatically without user knowing about it. So in theory almost any vAPI call can be used as a kind of health check.

1) I don't know if this makes a difference but the vAPI plugin is version 7.4.0. After looking more closely at the existing workflows I see that the action com.vmware.pscoe.vmtags/assignTagsToVM is being called. This module is using com.vmware.pscoe.library.vapi/Tags and com.vmware.pscoe.library.vapi/VapiBase. The VapiBase seems to have a login and logout function. Unfortunately, I don't know JavaScript well enough to leverage this.

2) I found a workflow "/Library/VAPI/Examples/vSphere/Create CIS Session" which takes "VAPI:VAPIEndpoint" as it's INPUT. I copied, pasted and massaged the code from this workflow. To your point the workflow does not require any explicate credentials. I'm assuming it is using whatever the plugin is using for credentials.

0 Kudos
iiliev
VMware Employee
VMware Employee

1) All these actions with pscoe in their module name are not part of vAPI plug-in, I guess you've got them from some other plug-in/package.

2) Yes, by default it uses the credentials you provided in configuration workflows to import vAPI metamodel and register vAPI endpoint. If you want to use a different credentials for a particular vAPI method call, you can override them when you acquire a client from endpoint. That is, instead of

var client = endpoint.client();

you can use the form

var client = endpoint.client(someuser, somepassword);

0 Kudos