SkylineCLI: How to automate Skyline Endpoint operations

This blog post will show you how to use the Skyline CLI fling to automate the Skyline Endpoint operations including workflows, commands and a example powershell script which automates the Skyline endpoint operations.

Prerequisites:

  • Skyline CLI Link
  • Powershell
  • PowerCLI
  • Skyline users and permissions
  • VM Name schema of endpoints based on FQDN
  • vCenter: vcsa.vmware.local
  • vROPs: vrops.vmware.local
  • NSX-T: nsx-01.vmware.local, nsx-02.vmware.local, nsx-03.vmware.local | VIP nsx.vmware.local

Workflow 1 create endpoints:

  • Login to vCenter
  • find all management VMs
  • execute SkylineCLI and create corresponding endpoints

Workflow 2 monitor endpoints and update if required:

  • SkylineCLI monitor
  • Skyline CLI update endpoint if necessary

Workflow 3 check if endpoints exist if not create:

  • list all existing endpoints using SkylineCLI
  • get all management VMs from VC
  • compare and add what is not existing in Skyline collector

SkylineCLI Commands:

List all endpoints:

Remark: if no Webhook is provided the action will provide a list of the endpoints including status

1skylinecli --action=monitor_slack --username admin --password PASSWORD --collector COLLECTOR-IP --insecure=true --output=true

Add Endpoint

1skylinecli --action=add --username admin --password PASSWORD --collector COLLECTOR-IP --insecure=true --eptype=VSPHERE --epuser="ENDPOINT-USER" --eppassword="ENDPOINT-PASSWORD" --ep="ENDPOINT-FQDN"

Update vSphere Endpoint

1skylinecli --action=update --username admin --password PASSWORD --collector COLLECTOR-IP --insecure=true --eptype=VSPHERE --epuser="ENDPOINT-USER" --eppassword="ENDPOINT-PASSWORD" --ep="ENDPOINT-FQDN"

Update vROPs Endpoint

1skylinecli --action=update --username admin --password PASSWORD --collector COLLECTOR-IP --insecure=true --eptype=VROPS --epuser="ENDPOINT-USER" --eppassword="ENDPOINT-PASSWORD" --ep="ENDPOINT-FQDN"

Update NSX-T Endpoint

1skylinecli --action=update --username admin --password PASSWORD --collector COLLECTOR-IP --insecure=true --eptype=NSX_T --epuser="ENDPOINT-USER" --eppassword="ENDPOINT-PASSWORD" --ep="ENDPOINT-FQDN"

Update LCM Endpoint

1skylinecli --action=update --username admin --password PASSWORD --collector COLLECTOR-IP --insecure=true --eptype=LCM --epuser="ENDPOINT-USER" --eppassword="ENDPOINT-PASSWORD" --ep="ENDPOINT-FQDN"

Powershell script using PowerCLI and SkylineCLI

Download the script and the json file

1git clone https://github.com/mdhemmi/skyline-endpoint-ops.git

Adjust the config json file based on your environment

ParameterDescriptionExample
SkylineCLIPath to the SkylineCLI binary/Users/mdhemmi/Documents/skyline-endpoint-ops/skylinecli-darwin-arm64-1.0.5
vcsavCenter FQDNvcsa.vmware.local
SkylineVCUservCenter username with Skyline permissions based on docsskywatcher@vsphere.local
SkylineVCUserPassCorresponding passwordVMware123!
CollectorSkyline collector FQDNskyline.vmware.local
CollectorUserSkyline collector useradmin
CollectorUserPassCorresponding passwordVMware123!
vROPsUservROPs user for Skylineskywatcher
vROPsUserPasswordCorresponding passwordVMware123!
NSXTUserNSX-T user (until 3.2 the admin user has to be used)admin
NSXTPasswordCorresponding passwordVMware123!
LCMUserLCM user for Skylineadmin@local
LCMPasswordCorresponding passwordVMware123!
vCenterFilterFilter string to find vCentervc
vROPsFilterFilter string to findvrops
NSXTFilterFilter string to findnsx
LCMFilterFilter string to findlcm
1vi skyline_ops.json
 1{
 2    "SkylineCLI": "/PATH/TO/skylinecli-darwin-arm64-1.0.5",
 3    "vcsa":  "VCENTER-FQDN",
 4    "SkylineVCUser": "skywatcher@vsphere.local",
 5    "SkylineVCUserPass": "VMware123!",
 6    "Collector": "COLLECTOR-FQDN",
 7    "CollectorUser": "admin",
 8    "CollectorUserPass": "VMware123!",
 9    "vROPsUser": "skywatcher",
10    "vROPsUserPassword": "VMware123!",
11    "NSXTUser": "admin",
12    "NSXTPassword": "VMware123!",
13    "vCenterFilter": "vc",
14    "vROPsFilter": "vrops",
15    "NSXTFilter": "nsx",
16    "LCMFilter": "lcm"
17}

Run the powershell script

1./skyline-endpoint-ops.ps1

Example Output if no Endpoints are existing

 1--------------------------------------------------------------------------------------------------------------
 2[11-24-2022_09-38-04] Connect to vCenter vcsa.vmware.local
 3[11-24-2022_09-38-05] Get endpoints from vCenter vcsa.vmware.local
 4[11-24-2022_09-38-05] Get endpoints from Skyline Collector skyline.vmware.local
 5[11-24-2022_09-38-05] Compare Endpoints in Skyline Collector vs. found Endpoints
 6[11-24-2022_09-38-05] vcsa.vmware.local not found in Skyline Collector skyline.vmware.local
 7[11-24-2022_09-38-05] Add Endpoint vcsa.vmware.local in Skyline Collector skyline.vmware.local
 8[11-24-2022_09-38-10] Endpoint created
 9[11-24-2022_09-38-10] vrops.vmware.local not found in Skyline Collector skyline.vmware.local
10[11-24-2022_09-38-10] Add Endpoint vrops.vmware.local in Skyline Collector skyline.vmware.local
11[11-24-2022_09-38-14] Endpoint created
12[11-24-2022_09-38-14] Disconnect from vcsa.vmware.local
13--------------------------------------------------------------------------------------------------------------

Example Output if all Endpoints are working as expected

 1--------------------------------------------------------------------------------------------------------------
 2[11-24-2022_09-36-19] Connect to vCenter vcsa.vmware.local
 3[11-24-2022_09-36-20] Get endpoints from vCenter vcsa.vmware.local
 4[11-24-2022_09-36-21] Get endpoints from Skyline Collector skyline.vmware.local
 5[11-24-2022_09-36-21] Compare Endpoints in Skyline Collector vs. found Endpoints
 6[11-24-2022_09-36-21] Found vcsa.vmware.local in Skyline Collector skyline.vmware.local
 7[11-24-2022_09-36-21] Check status of vcsa.vmware.local in Skyline Collector skyline.vmware.local
 8[11-24-2022_09-36-21] Endpoint status of vcsa.vmware.local is OK
 9[11-24-2022_09-36-21] Found vrops.vmware.local in Skyline Collector skyline.vmware.local
10[11-24-2022_09-36-21] Check status of vrops.vmware.local in Skyline Collector skyline.vmware.local
11[11-24-2022_09-36-21] Endpoint status of vrops.vmware.local is OK
12[11-24-2022_09-36-21] Disconnect from vcsa.vmware.local
13--------------------------------------------------------------------------------------------------------------