|
Please follow the steps given below to create a new String Mode CCS file for the Standalone CLI Agent :
Go to <WebNMS\C-Agent>\bin directory from the command prompt.
Run the CLI Editor application by executing CLIEditor.bat or CLIEditor.sh in <WebNMS>\C-Agent\bin directory.
Select File -> Create from the menu bar options.
Select the type of CCS file as String Mode.
Enter the Filename as "stringsample".
The CCS directory indicates the location in which the CCS is to be stored. Enter the location as <WebNMS\C-Agent>\ccs. The location starts from the drive in which the product is installed.
Click OK to create the ccs file stringsample in the specified directory. You will now find the stringsample node added in the CLI tree.
The CLI Editor provides the following options to define String Commands:
Command
Options
Parameters
Objects
To define a string command,
Select the String CCS file node (stringsample) displayed in the CLI tree, right-click and select String Command from the pop-up menu.
In the Right side panel enter the following details to define a String Command.
Command Name : Specify the name of the command to be executed in the system/device. The command name must be of type alphanumeric and must start with an alphabet. The maximum character allowed is 25. Example : ls
|
|
Note:
|
Defining a Command with Options
Define the String Command as specified in Defining a Command
The Add Option block displays the following tabs for defining options to a command. Select the required tab and click the Add button to define the option. A command can have all or any of these options. Refer to the table to define the options.
Simple Option
Simple Option with Arguments
Long Option
Long Option with Arguments
Select the Description tab to give a description about the options specified.
| Option | Dependency | Type | Prefix | Example | |
|---|---|---|---|---|---|
|
Simple Option |
Specify the simple option for the command.
The syntax for this option will be an alphabet (A,a - Z,z) |
Specify the dependency of this option (if any), with other options defined for this command. Refer to the link Dependency to know more. |
- |
By default the prefix is hyphen. ( - ) |
ls -l In this example, ls is the command
-l is the option which will list all the files and directories of the ls command result. |
|
Simple Option with Arguments |
Specify the simple option for the command.
The length of this option should be 1 and it should be an alphabet (A,a - Z,z) |
Specify the dependency of this option (if any), with other options defined for this command. Refer to the link Dependency to know more. |
Specify if the argument to be passed to the simple option is of type String, Int, Char or Float, by selecting the Type from the list. |
By default the prefix is hyphen. ( - ) |
cagent -p 8001 In this example,
cagent is the command
-p refers to the port number where the cagent is running.
8001 is the argument passed to the simple option. |
|
Long Option |
Specify the Long option for the command.
The length of this option can be a maximum of 25 characters of type alphanumeric. Its ID is not case sensitive. |
Specify the dependency of this option (if any), with other options defined for this command. Refer to the link Dependency to know more. |
-- |
By default the prefix is double hyphen. ( -- ) |
ls --all In this example, ls is the command
-all is the long option. It will list all the files in the directory including the files starting with. |
|
Long Option with Arguments |
Specify the Long option for the command.
The length of this option can be a maximum of 25 characters of type alphanumeric. Its ID is not case sensitive. |
Specify the dependency of this option (if any), with other options defined for this command. Refer to the link Dependency to know more. |
Specify if the argument to be passed to the long option is of type String, Int, Char or Float, by selecting the Type from the list. |
By default the prefix is double hyphen. ( -- ) |
cagent --port 8001 In this example, cagent is the command --port is the long option, 8001 refers to the argument passed to the long option. |
If more than one option is defined for a command, specify the dependency, if any, with the other options. For example, Assume that you have defined a command ls with long options --help ,--all. To restrict the execution of --help if -all is executed, you can specify the dependency of -all as --help. If the user tries to enter this command ls --all --help, from the prompt, an error message will be displayed. To configure dependency,
Select Configure Dependency option. The Configure Dependency dialog opens.
Select the tab Simple Options to list all the simple options and simple options with arguments, defined for the command.
Select the tab Long Option, to list all the long options and long options with arguments, defined for the command.
Select the required option/options from the list and click Add. The selected option is added to the right side panel as shown in the image given below:

Click OK to exit from the Configure Dependency dialog.
You will now find the selected dependencies displayed in the Options dialog.

|
|
Note:
|
Defining a Command with Parameters
To define a parameter value to a string command,
Define a String Command with or without options.
In the Add Parameters block, click the Add button to add parameters. The Add Param dialog is displayed.
Enter the following details:
Name : The parameter name can be any string. The maximum number of characters allowed for parameter name is 25. It is not case sensitive.
Param Type : The following parameter types are listed.
NAMEVALUE : If type is specified as NAMEVALUE, while entering the command in the command prompt, both the parameter name and its value must be specified. Example : cp source="filename1" dest="filename2", where 'cp' is the command, 'source' is the parameter name, 'filename' is the value passed to the parameter.
VALUE : If type is specified as VALUE, while entering the command in the command prompt, the value of the parameter must be specified. Example : cp filename1 filename2, where 'cp' is the command, 'filename1' and 'filename2' are the parameter values passed to the parameter.
Value Type : Specify if the parameter is of type String, Int, Char, or Float, by selecting the Type from the list.
Option Flag : Specify if the parameter is Optional or Mandatory. If it is mandatory, the command will not be executed without the parameter value.
Description : Specify the description of the parameter.
Example : cp source dest
In this example,
cp - name of the command
source - parameter value
dest - parameter value
Defining a Command with Objects
Objects are sub-commands defined for a string command. Multiple levels of objects can be defined. Options and parameters can be defined only for leaf objects.
Example: You may need to Add a router configuration, modify a router configuration, or delete an existing configuration. Instead of defining separate commands for each operation, Router Configuration can be defined as a String Command and Add, Delete, and Modify can be defined as objects under the Router Configuration command. Options and Parameters can be defined for the Add, Delete, and Modify objects.
To define a String Object,
Select a command in the CLI tree, right-click and select the option String Object from the pop-up menu.
Defining String Objects is the same as defining string commands.
|
|
Note: Options and Parameters can be defined only for leaf objects. |
User can configure or edit the command help for the commands created with the help of CLI Editor. This can be done by pressing the button Help in the Edit help field in the Edit command interface. The Configure Help dialog box pops up where the user can configure the following fields for the command help:
Description: A description of/about the command can be entered.
For example, for the command adduser, Description: This command is used for creating a new user account. This command is executed only by administrator. User name and password parameter are mandatory and the other parameter are optional.
Syntax: To define the syntax of the command.
adduser [-g,param(INT)] [-a,param(INT)] [-i,param(STR)] userName(STR) userPassword(STR)
Help Options:The user can provide a detailed description about the options available for the command.
For the adduser example mentioned above the Help option field would be, -a AccoutAging: This parameter specifies the aging or expiry interval of a particular User ID. At the end of this interval, the UID is disabled if it has never been used to set up a session during this interval.
Example: An example implementation of the command can be provided in this field.
adduser root public -a 50 -g 50 -i 1
Remarks: If the user wants to enter any remarks or comment which might me important or related to the usage command he can do so here.
Related Commands: If there are any related commands they can be mentioned here.
After entering all this, the user can press OK to configure the help or press Cancel to cancel the operation carried out.
After filling up the necessary fields for the command, the user needs to press Update for the changes/additions made to be added/changed in the tree structure. This just ensures temporary update of the tree structure. To permanently save the changes, the user needs to save the project by choosing Save option from the File menu.
On pressing Cancel, the changes/additions made do not get added on to the tree structure.
|