Built-In Commands

 



 

What Are Built-In Commands?

 

Built-in Commands are provisioning input commands common to all OS/NE interfaces. They are commonly used input commands that are already implemented in the WebNMS CLI Agent. Some General Built-in Commands have already been implemented in the CL1 Agent and are available in the clibuiltincommand.ccs file. Please note that since the commands in the CCS file are already implemented, it should not be loaded in the Agent Compiler for code generation.

 

Enabling Built-In Commands

 

You have to enable Built-in Commands support before code generation. To enable Built-in Commands support in the CLI Agent, follow these steps:

  1. In the Agent Compiler (CLI) , choose Settings -> Protocol menu from the menu bar. This opens up a Settings wizard for the CLI Agent.

  2. Choose the node CLI -> General in the Protocols panel.

  3. Here, you can enable the Built-in Commands support.

Built-In Commands in WebNMS CLI Agent

 

General Commands

 

Following Built-in commands/features are available in String mode CLI Agent and Multi-Protocol CLI Agent.

 

1. Changing Prompt

 

The general format of the command is prompt <prompt string>.

 

By default, the prompt will be CLI>>. You can change this prompt by using the Agent Compiler CLI General Settings or by using the prompt command.

      1. Example : CLI>> prompt WebNMS>>

         

        WebNMS>>

2. Clearing the Console

 

The general format of the command clear.

 

This command clears the console.

      1. Example : CLI>> clear

3. Logging out from the System

 

The general format of the command is logout.

 

This is used for logging out from the session.

      1. Example : CLI>>logout

4. Command Line Help

 

The general format of the command is man <command>.

 

This is used for displaying online manual pages.

      1. Example : CLI>>man adduser

 

note_nc.jpg

Note: For setting the number of lines / scroll size of the manual page, refer to the Building CLI Agents -> Building CLI Agents in String Mode -> CLI Callback APIs and Macros -> Configuring Maximum Scroll size help topic.

 

 

5. Setting Keep Alive Timeout

 

The general format of the command is keepalive [keep alive timeout in seconds].

 

This command is used for setting/getting the keepalive timeout value. Keep Alive Timeout represents the time taken between 2 queries to a CLI Agent. If there is a delay beyond the specified time then the connection with the client will be lost.

The minimum keep alive time out value is 10 seconds and the default is set to 300 second. Also, the functioning of keep alive time out will come into action once a session has been established by the client with the agent.

      1. Example 1 : CLI>> keepalive

        Response : 5

        Example 2 : CLI>> keepalive 15

        Response : 15

6. Changing the user's password

 

The general format of the command is editpasswd <oldpassword> <newpassword>

 

This command is used for changing or modifying the user's own password. The size of the password should be between 6 and 10 characters (both inclusive) and also have the alphanumeric check. For more information, refer to FAQs -> CLI
Once the user changes the password, his / her password aging interval gets extended by the number of days configured in the "Password Aging" field. Suppose if the password aging value is configured as 10 days and if the user changes his / her password on the 4th day, then his password aging count will be reset and checking will be started newly for another 10 days.
This command will be available only when the CLI Security feature has been enabled in the CLI Agent.

      1. Example 1 : CLI>> editpasswd public Admin!6

         Password Edited Successfully !!!

 

note_nc.jpg

Note: From 6.4.0, the password field will be masked.

 CLI>> editpasswd public *******

 

Self Monitoring Commands

 

Self-Monitoring enables the CLI Agent to monitor the Agent details, such as the number of requests received, number of responses and autonomous messages sent, etc. The Agent details are automatically updated and monitored by the CLI Agent and their values can be retrieved whenever you require by sending the appropriate input messages.

 

Following are some of the Self Monitoring Commands :

 

1. Getting the Number of Commands Processed

 

The general format of the command is incount.

 

This command is used for getting the number of commands processed by the Agent.

      1. Example : CLI>> incount

        CLI>> 10

 

2. Getting the Number of Output Response sent

 

The general format of the command is outcount.

 

This command is used for getting the number of output responses sent by the Agent.

      1. Example : CLI>> outcount

        CLI>> 6

3. Getting the Number of Error Response sent

 

The general format of the command is errcount.

 

This command is used for getting the number of error responses sent by the Agent.

      1. Example : CLI>> errcount

        CLI>> 4

Authentication Commands

 

Following are some of the Authentication related Built-In Commands. These commands can be executed only by the persons who has Administrator privileges or for whom the appropriate roles has been assigned. These commands will be available only if the CLI Security feature has been enabled in the Agent Compiler -> Settings menu -> Project Settings -> Protocols -> CLI -> Security menu

 

1. Adding a New User

 

The general format of the command is adduser [-a account aging] [-g password aging ] [-i privilege] <user name> <pass word>.

 

This command is used for creating a new user account.

      1. Example : CLI>> adduser linux linus

         

        Response message for adduser

         

        User Added Successfully !!!

 

note_nc.jpg

Note: From 6.4.0, the password field will be masked.

 CLI>> adduser linux *****

 

2. Deleting an User Account

 

The general format of the command is deleteuser <user name>.

 

This command allows an administrator to delete a user account from the system.

 

      1. Example : CLI>> deleteuser linus

         

        Response message for deleteuser

         

        User Deleted Successfully !!!

3. Modifying an User Account

 

The general format of the command is edituser [-p newpassword] [-a account aging] [-g password aging] [-i privilege] <user name>.

 

This command allows an Administrator to modify the user account details.

      1. Example : CLI>> edituser -p travoldus linux

         

        Response message for edituser

         

        User Edited Successfully !!!

 

note_nc.jpg

Note: From 6.4.0, the password field will be masked.

 CLI>> edituser -p  travoldus *****

 

4. Getting the Details of the User

 

The general format of the command is who.

 

This command is used for getting the details of the login user.

      1. Example : CLI>> who

         

        +--------------------------------------------------------------------------------+

        |User Name |   Login Channel |             Login time           |

        +---------------------------------------------------------------------------------+

        |root            |     TELNET       | Wed Nov 23 16:15:53 2002|

        +----------------------------------------------------------------------------------+          

 

warning.jpg

Make the following changes when the CLI Agent is running in Windows OS and MicroSoft Visual Studio 8 / 2005 is used for compilation

  • Add "-D_USE_32BIT_TIME_T" macro next to "-DWINDOWS" value present in all the generated Makefile(s).

  • If Microsoft Visual Studio IDE is used for compilation, then add "-D_USE_32BIT_TIME_T" (along with WINDOWS macro definition) in Project Properties -> Configuration Properties -> C/C++ -> PreProcessor -> PreProcessor Defintions  in IDE.

 

 

5. Listing the Details of the User

 

The general format of the command is list user.

 

This command is used for listing the details of the user.

      1. Example : CLI>> list user

         

        +--------------------------------------------------------------------------------------------------+

        User Name | Password Aging(days) | Account Aging(days) | Privilege|

        +--------------------------------------------------------------------------------------------------+

        |root            |             60                  |           180                |ADMIN   |

        +--------------------------------------------------------------------------------------------------+

6. Adding New Role(s)

 

For adding or defining new roles and assigning the CLI commands in the CLI Agent, addrole command can be used.

The general format of the command is addrole <role name (STR)> <commands <STR>

 

Both the parameters are mandatory fields. The new role name can have single or multiple CLI commands. Multiple CLI commands can be specified by using "&" separator or de-limiter in between each CLI command.

      1. Example 1 : CLI>> addrole messagecount incount&outcount&errcount&logout

                    Role Added Successfully !!!

        Example 2 : CLI>> addrole rolemaint addrole&editrole&deleterole&list&logout

                    Role Added Successfully !!!

 

note_nc.jpg

Note: The CLI commands specified in the addrole command should be valid CLI command and is registered with the CLI Agent. If not, the CLI Agent will not add the new role name and will reply with an error message.

 

7. Listing the details of the role(s)

 

The general format of the command is list role

 

This command is used for listing the details of various roles / privileges available in the CLI Agent and the CLI commands associated with each role.

      1. Example 1 : CLI>> list role

        +----------------------------------------------------------------------------+
        | Roles       | Commands                                                     |
        +----------------------------------------------------------------------------+
        | ADVENTMAINT | incount&outcount&errcount&man&clear&prompt&logout&editpasswd |
        | messagecount| incount&outcount&errcount&logout                             |

        | rolemaint   | addrole&editrole&deleterole&list&logout                      |
        +----------------------------------------------------------------------------+

 

note_nc.jpg

Note: Table alignment will get changed based on the number of CLI commands registered against each role.

 

8. Editing / Modifying Role(s)

 

For changing or modifying the CLI commands associated with a role, editrole command can be used.  

The general format of the command is editrole <role name (STR)> <commands (STR)>

 

Both the parameters are mandatory fields. "Commands" field can have single or multiple CLI commands. Multiple CLI commands can be specified by using "&" separator or de-limiter in between each CLI command.

When modifying the CLI commands, the CLI agent will validate the CLI commands whether they are registered with the agent and will be assigned to the respective roles.

      1. Example 1 : CLI>> editrole messagecount incount&outcount&errcount&clear&logout

                    Role Edited Successfully !!!

 

note_nc.jpg

Note: Only the CLI commands associated with a role can be changed. Role name cannot be changed.

 

 

9. Deleting a Role

 

For deleting a role deleterole command can be used.

The general format of the command is deleterole <role name (STR)>

 

Role name field parameter is mandatory.

      1. Example 1 : CLI>> deleterole messagecount

                    Role Deleted Successfully !!!

 

note_nc.jpg

Note: Multiple Role deletion is not possible. Only one role name can be deleted at a time.

         If the role which is going to be deleted has been assigned to any user and is present in usersecurity.txt,  then the role cannot be deleted and the agent will return error.

 

10. Configuring Maximum number of invalid login limit

 

Maximum number of invalid login attempts can be configured by using the command named maxlogin.

Once the value configured for maxlogin is reached, the agent will be in a state of alert and will close that particular session / client

The general format of the command is maxlogin [<maxlogin param(INT)>]

 

The unit of maxlogin is number of times. Default value is 3 and the range of maxlogin is 1 to 10.

If the command is executed without specifying the value, then the agent will return the value configured for the maxlogin limit.
 

      1. Example 1 : CLI>> maxlogin

                    3

         

        Example 2 : CLI>> maxlogin 5

                    5

         

11. Printing the Security log file records.

 

This command can be used by an appropriate administrator to retrieve the following attributes associated with the security log allow or permit the system to print the events in the security log.

For more information, refer to Building CLI Agents -> Building CLI Agents in String Mode -> Security Log

 

 

Copyright © 2012, ZOHO Corp. All Rights Reserved.