Managing NerveCenter - Controlling NerveCenter from the Command Line - NerveCenter Command Line Interface - Entering a Single Command in a UNIX Shell or a DOS Prompt -
NerveCenter Command Line Interface      Index

Entering a Single Command in a UNIX Shell or a DOS Prompt

 
  To issue a single command in a UNIX shell or at a DOS prompt, follow these steps:

  1. Open a UNIX shell or a DOS Command Prompt window.
  2. Type
       nccmd -s ServerName -u UserName -p Password -n Port Command

    where ServerName is the name of the NerveCenter server you want to contact, UserName and Password are a valid user name and password for that NerveCenter server, Port is the command-line-interface port for the server (32506 by default), and Command is the command you want to run. Then press Return.

    If you are already connected to a server via a previous connect or select server command, the command you issue is directed to that server, and the-
    -s switch is unnecessary.

The syntax for the commands is specified in Command line interface reference.

The command is executed and informs you if an error was encountered.

In the following example, a user named John lists all the polls that are suppressed. For this example, the server is named sales, John's user ID is johndoe, and his password is anytown.


   nccmd -s sales -u johndoe -p anytown -n 32506 list poll -S yes

Entering Multiple Commands in an Interactive Session

 
  To open an interactive session and enter multiple commands, follow these steps:

  1. Open a UNIX shell or a DOS Command Prompt window.
  2. Do one of the following:

    To open an interactive session without connecting directly to a server, type nccmd and press Return.

    The nccmd command prompt is displayed:

    nc>

    To open an interactive session and connect directly to a server, type

    nccmd -s ServerName -u UserName -p Password -n Port

    where ServerName is the name of the NerveCenter server you want to contact, UserName and Password are a valid user name and password for that NerveCenter server, and Port is the server's command-line-interface port (32506 by default). Then press Return.

    The nccmd command prompt is displayed and you are connected to the server you specified:

    nc>

    All subsequent commands are sent to that server until you connect to an additional server or issue a select server command.

  3. Type the commands you want to run, pressing Return after each one.

    The syntax for the commands is specified in Command line interface reference.

    Each time you press Return, you are returned to the nccmd command prompt. If any command returns an error, nccmd quits, returns you to the shell prompt or the Command Prompt, and displays the error.

  4. To exit the interactive session, type quit at the prompt and press Return.

    You are returned to a shell prompt or a Command Prompt.

In the following example, a user named Kim opens an interactive session, connects directly to the server, deletes a node, disconnects from the server, and quits the session. For this example, the server is named sales, Kim's user ID is kimz, her password is NoMuZak, and the name of the node she is deleting is N0128.


   C:\>nccmd -s sales -u kimz -p NoMuZak -n 32506
   nc>delete node -n N0128
   nc>disconnect
   nc>quit

Running a script that contains one or more commands

 
  To run a script that contains one or more commands, follow these steps:

  1. Create a text file that contains the commands in the order you would enter them if you were in an interactive session.

    The syntax for the commands is specified in Command line interface reference.

  2. Open a DOS Command Prompt window or a UNIX shell.
  3. Do one of the following:

    To connect to a NerveCenter server and have the server execute the commands in your file, enter a command of the following form:


       nccmd -s ServerName -u UserName -p Password -n Port -f Filename

    ServerName is the name of the NerveCenter server you want to contact, UserName and Password are a valid user name and password for that NerveCenter server, Port is the command-line-interface port for the server (32506 by default), and Filename is the name of the file containing the commands you want to run.

    To prevent having to connect to the server explicitly each time you want to run your script, you can edit your script so that its first line is a connection command. This command must have the form:


       connect -s ServerName -u UserName -p Password -n Port

    Once you've performed this step, you can type nccmd -f Filename from the DOS or a shell prompt to connect to the server and execute the commands in your script.

    If any command returns an error, nccmd quits, displays the error, and returns you to the Command Prompt or UNIX prompt.

In the following example, a user named Juan writes a script that connects to a server, turns on an alarm named Monitor, and disconnects from the server. For this example, the server is named sales, Juan's user ID is juanr, and his password is CaFFieNe. The script is named SetAlarm and it looks like this:


   connect -s sales -u juanr -p CaFFieNe -n 32506
set alarm -e on -w -a Monitor
disconnect -s sales

Juan runs the script by entering the following command at the command prompt:


   >nccmd -f SetAlarm


NerveCenter Command Line Interface Index
29 July 2003