ezget(n) 1.3 ezget "Easy Get Commands"

NAME

ezget - get common information

SYNOPSIS

package require libcisco

ezget config ConfigType
ezget version ?varNameArray?

DESCRIPTION

The ezget command is used to get information from Cisco network equipment. The first argument to ezget specifies the type of information to get from the target device. A list of valid information elements and their associated options is detailed below.

Note: Before making a call to ezget, a session must first be opened to the target device using the session open command.

COMMANDS

ezget config ConfigType
Get the configuration from the target device.

ConfigType may be one of two options--primary or secondary. The primary option will cause the command to get the running-config from an IOS device, the complete config of a switch running Catalyst code, and the complete configuration of a 1900. The secondary option will cause the function to retrieve the startup-config from an IOS device, the nondefault config from a switch running Catalyst code, and nothing from a 1900.

On success, ezget config returns the configuration. On error, a short text message is returned beginning with the string "err".

ezget version ?varNameArray?
Get the operating system version from the target device.

varNameArray is optional. It is the name of a variable. The variable should be an array. The following elements will be set if varNameArray is specified:

  • String - represents the complete version string (same value returned by the command)

  • Major - the major version number

  • Minor - the minor version number

  • Maint - the maintenance release


On success, ezget version returns the complete OS version. On error, a short text message is returned beginning with the string "err".

EXAMPLE

The following code will get the configuration from 192.168.1.1 and print it to the screen (stdout).

 
#!/bin/sh
# the next line restarts using the tclsh interpreter \ 
exec tclsh "$0" "$@"

package require libcisco
namespace import libcisco::*

session open 192.168.1.1 cisco
session enable san-fran
set Config [ ezget config primary ]
session close
puts $Config

AUTHOR

Andy Ziegelbein <
mailto:aziegelb@users.sourceforge.net>

SEE ALSO

session(n), sendCmd(n), ezset(n), ezdo(n)

KEYWORDS

ezget, configuration, running-config, startup-config, config