Submit a ticketCall us

WebinarWebinar: A checklist for planning your Network Performance Monitor (NPM) upgrade

Are you ready for your next upgrade? To help you plan smoothly, join this webcast to learn more about, SolarWinds® Orion® Installer, SolarWinds Upgrade Advisor, Upgrades Guides, Training Videos, and other resources available. We’ll share key upgrade planning considerations, lessons learned from customers with practical advice from SolarWinds Product Experts. We’ll also give practical tips to identify the estimated time needed and resources, how to prepare the business and IT staff for changes, ways to plan for required system changes, and more.

Register now.

Home > Success Center > Network Configuration Manager (NCM) > NCM Documentation > NCM 7.9 Administrator Guide > Command scripts > Example variable script

Example variable script

Created by Caroline Juszczak, last modified by Anthony.Rinaldi_ret on Oct 03, 2016

Views: 1,391 Votes: 0 Revisions: 4

The following script contains commands with variables to remove the public read-only community string:

${EnterConfigMode}
no snmp-server community public RO
${ExitConfigMode}
${SaveConfig}
${Reboot}

Parsed for Cisco IOS devices:

config terminal
no snmp-server community public RO
end
write memory
reload${CRLF}y${CRLF}y

Parsed for a Dell PowerConnect Switch:

config
no snmp-server community public RO
end
copy running-config startup-config${CRLF}${CRLF}
reload${CRLF}Yes

The ${CRLF} variable equals a carriage return line feed for all devices.

Define script variables

Script variables are defined in device command templates. Templates are located in the \Configuration Management\DeviceTypes folder. Each .ConfigMgmt-Commands file contains a System OID that is used to uniquely identify a device. A list of command names, and the corresponding commands to be sent to the device when the command name is called, are also included in the templates. These command names are the variables used when creating a script.

Consider the following line taken from the Cisco IOS device command template:

<Command Name="EnterConfigMode" Value="config terminal"/>

When a script is run on a Cisco IOS device, the variable ${EnterConfigMode} parses as config terminal. New command names can be added and existing command names can be modified within these files.

Reference variables with variables

The script engine also allows you to reference variables with variables. For example, you can define a complex variable in the device template:

ShowInt = running | include interface

Then define another variable that includes the first:

Reveal = show ${ShowInt}

When you call ${Reveal}, it equals show running | include interface.

 

Last modified

Tags

Classifications

Public