In Spectrum, its possible to use the command line interface (CLI) to run commands and incorporate those commands into a shell script (such as bash) to automate various processes, such as creation or deletion of models based on certain criteria.
How can the destruction of models be achieved via an automated process and then creation of new models be achieved using the CLI?
#!/bin/bashtimestamp=`date "+%H%M%d/%m/%Y"`# Check the CLIPATH settingif [ -z "$CLIPATH" ]thenCLIPATH=$SPECROOT/vnmshexport CLIPATHficd $CLIPATH# Connect to the VNM shell./connect# Using as example alarm to eliminate models - 'DIFFERENT TYPE MODEL - 0x10203'"
probCauseID="0x10203"
# For each model with this alarm, we will destroy it,# after obtaining its IP address (attribute - Network_Address)# and then create it againfor model in `./show alarms -a | grep $probCauseID | awk '{print $5}'`;doecho "-----------------------------------"echo $timestamp Model Handle of device with Alarm = $model./current mh=$modelIP=`./show attributes mh=$model | grep Network_Address | grep -v Legacy | awk '{print $3}'`echo $timestamp IP Address = $IPif [ $interactive -eq 1 ]then# Run silent./destroy model -n mh=$modelelse# Default - Run interactive, where you will be asked if you want to destroy each model./destroy model mh=$modelfi# You can then rediscover a new model with the same IP address if needed../create model ip=$IPdone# Disconnect from the VNM shell./disconnect
Please reference the "Introduction to Command Line Interface (CLI)" section for more information.