Spectrum Basic CLI Framework Script
search cancel

Spectrum Basic CLI Framework Script

book

Article ID: 222340

calendar_today

Updated On:

Products

CA Spectrum DX NetOps

Issue/Introduction


Often times it might be necessary to use the Spectrum CLI to  obtain, create, destroy models or associations between 
   models in the SpectroSERVER SSdb.

The below script is intended to be a simple starter script to aid in the creation of a script to perform quick tasks.

Environment

Release : 20.x, 21.2.x

Component : Spectrum Core / SpectroSERVER

Resolution

 

#!/bin/sh

# 
# CLI Environment Variables
# https://techdocs.broadcom.com/us/en/ca-enterprise-software/it-operations-management/spectrum/21-2/managing-client-applications/command-line-interface/introduction-to-command-line-interface-cli/overview-on-ca-spectrum-command-line-interface/cli-environment-variables.html
#

CLIMNAMEWIDTH=64
export CLIMNAMEWIDTH

CLISESSID=$$
export CLISESSID

#
# Script Variables
#
SPECROOT=/usr/Spectrum
VNMSHPATH="${SPECROOT}/vnmsh"
SSTOOLPATH="${SPECROOT}/SS-Tools"

#
# Connect 
#

${VNMSHPATH}/connect

#
# Execute Some Code
#

# for obj in $(${VNMSHPATH}/show children rel=dynamicGlobalCollects mh=0x1000525 |tail -n +2 | awk '{  print $1 }')
# do
# ${VNMSHPATH}/show attributes attr=0x11ee8 attr=0x1006e  mh=${obj} | tail -n +2
# done


#
# Disconnect from CLI
#
${VNMSHPATH}/disconnect

Additional Information


PLAIN TEXT

#!/bin/sh


# CLI Environment Variables
# https://techdocs.broadcom.com/us/en/ca-enterprise-software/it-operations-management/spectrum/21-2/managing-client-applications/command-line-interface/introduction-to-command-line-interface-cli/overview-on-ca-spectrum-command-line-interface/cli-environment-variables.html
#

CLIMNAMEWIDTH=64
export CLIMNAMEWIDTH

CLISESSID=$$
export CLISESSID

#
# Script Variables
#
SPECROOT=/usr/Spectrum
VNMSHPATH="${SPECROOT}/vnmsh"
SSTOOLPATH="${SPECROOT}/SS-Tools"

#
# Connect 
#

${VNMSHPATH}/connect

#
# Execute Some Code
#

# for obj in $(${VNMSHPATH}/show children rel=dynamicGlobalCollects mh=0x1000525 |tail -n +2 | awk '{  print $1 }')
# do
# ${VNMSHPATH}/show attributes attr=0x11ee8 attr=0x1006e  mh=${obj} | tail -n +2
# done


#
# Disconnect from CLI
#
${VNMSHPATH}/disconnect