How to Run the NetScaler Shell Commands from a Remote Computer

How to Run the NetScaler Shell Commands from a Remote Computer

book

Article ID: CTX116453

calendar_today

Updated On:

Description

This article describes how to run the shell (FreeBSD) commands on the NetScaler appliance from a remote computer by using a secure shell (SSH) utility.

Requirements

The following setup is required to run the shell commands on a NetScaler appliance from a remote location:
  • Citrix NetScaler software release 6 or later installed on the NetScaler appliance

  • A remote computer with an SSH utility installed on it

Instructions

To run commands from the FreeBSD shell on a NetScaler appliance with NetScaler software release 6 or later, the standard method is to use an SSH utility to log on to the appliance and then run the shell command.

After the shell prompt appears, run the required shell command(s). However, sometimes, it is desirable to run these commands without actually logging on to the NetScaler appliance, or to automate the running of the shell commands from a remote computer.

One method to accomplish this is to use scripts, such as shell, expect, or Perl scripts, running on the remote server and/or on the NetScaler appliance. Creating a script is out of the scope of this document.

To run the shell command on a NetScaler appliance from a remote computer, complete the following procedure:

  1. If you do not want to be prompted for a password, you can set up the NetScaler appliance to allow the nsroot user to log on using SSH keys instead of a password.
  2. From the remote computer, run the following command:

    ssh user@NSIP 'shell <Shell_Command>'

    The following is an example of the command and its output when run from a remote computer:

    user@mgmnt# ssh nsroot@NSIP 'shell date'
    Done
    Thu Feb 21 00:09:42 GMT 2008
    Done

    Note: The single-quote characters in the preceding command are required and cannot be substituted for back-ticks. However, you can replace these with double-quotes.

    You can also redirect the output of the SSH command to the local applications for processing. In the following example, the grep command is run from the local shell prompt and not from the NetScaler shell prompt:

    user@mgmnt# ssh nsroot@NSIP 'shell sysctl -a' | grep netscaler
    debug.netscaler_panic:
    netscaler.developer: 0
    netscaler.recovery: 0
    netscaler.sysid: 940030
    netscaler.serial: 3f549e6f4cc9f6664ea8
    netscaler.descr: 7000 v1 6*EZ+2*EM
    netscaler.pitbossexitcode: -559039810

You can run multiple commands separated by a semi colon (;) and enclosed in double quotes (" "). The following is an example of running commands to display ARP and Bridge table entries on the NetScaler appliance:

user@mgmnt #ssh nsroot@NSIP 'shell “nsapimgr -d allarp ; nsapimgr -d allbridge”'

The following screen shot displays the APR entries in the first part of the output:

User-added image

The following screen shot displays the bridge table entries in the second part of the output:

User-added image
Note: You can also connect to a SNIP with Management Access enabled

Issue/Introduction

This article describes how to run the shell (FreeBSD) commands on the NetScaler appliance from a remote computer by using a secure shell (SSH) utility.