Managing NerveCenter
-
Controlling NerveCenter from the Command Line - NerveCenter Command Line Interface - 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:
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
To open an interactive session and enter multiple commands, follow these steps:
To open an interactive session without connecting directly to a server, type nccmd
and press
Return.
The nccmd command prompt is displayed:
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:
All subsequent commands are sent to that server until you connect to an additional server or issue a select server command.
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.
quit
at the prompt and press Return.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
To run a script that contains one or more commands, follow these steps:
The syntax for the commands is specified in Command line interface reference.
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 |