Command Line Interface (CLI)The application provides a command line interface (CLI) for a configuration from the local network or remote via Telnet or SSH. One parameter after the other will be entered line by line via the CLI and stored in the opened profile. The modifications to the profile will not yet be effective in the running profile with this. The profile must still be activated, i.e. become the running profile, that the modifications to the configuration become effective. Activating the CLIBefore an access to the application via Telnet or SSH is possible, this must be configured accordingly in the Administration menu on the CLI page. For this, access via Telnet or SSH must be activated and, if the firewall in the router is active, an appropriate exceptional rule must be present and active. SyntaxThe syntax of a parameter is composed of the sections and the parameter, each separated by a full stop.
The sections correspond to the menu structure in the web interface.
The parameter Activate command line via SSH in the Administration menu on the CLI page has the following syntax for example: The available sections and parameters depend on the version of the application. These can easily be shown using auto-complete via tabulator key. Pressing the tabulator key shows all available sections of the first level (corresponds to the menus in the web interface). Entering the first letter(s) of a section fallowed by the tabulator key completes the section and pressing the tabulator key again shows all available sections of the next level (corresponds to the pages of this menu in the web interface). Pressing the tabulator key again shows possible further sections or available parameters. In case of lists, the opening square bracket ([) will be output automatically. If this is replaced by a full stop, another click on the tabulator key will output the available list functions. Lines starting with a hashtag#will be ignored and can be used as a comment. Activating a profileIf a profile has been modified using the CLI as described in the following, the modifications will become only effective, if the profile is activated, i.e. made the running profile. Reading out parameter valuesThe current value of a parameter is displayed by entering the parameter followed by the enter key. If only the section is entered, all subjacent parameters will be displayed. Example: Setting parameter valuesA new value is assigned to a parameter by entering the parameter followed by an equals sign and the new value. Example: Editing listsBesides fix parameters, the application has also endless lists like those for the users. The individual entries of a list are enumerated in sequence and can be addressed using this position number. The user name of the second entry of the user list for example is displayed using the command: Displaying a list sizeThe parameter size displays the number of list entries. Example for the number of users: Adding a list entryThe parameter add adds an entry to the end of a list. Example for adding another user: Deleting a list entryThe parameter delete=[x]deletes entry number [x] in the list. The parameter delete=all deletes all existing entries in the list. Example for deleting entry no 3 in the user list: Moving a list entry upwardsThe parameter sort_up=[x]moves entry number [x] by one position upwards in the list (to position [x-1]). Example for moving entry no 3 upwards in the user list: Moving a list entry downwardsThe parameter sort_down=[x] moves entry number [x] by one position downwards in the list (to position [x+1]). Example for moving entry no 3 downwards in the user list: Copying a list entryThe parameter copy=[x] copies entry number [x] in the list. An identical list entry will be appended to the end of the list. If the copied list entry has sub-elements, these will also be copied. If a Modbus device is being copied for example, not only its communication settings will be copied, but also all data points. Example for copying entry no 3 in the user list: Lists within listsSome application functions require lists within lists. Editing is along the lines of the higher-level lists on the respective sub-section level. Example for querying the type of data point 2 of Modbus device 1: Multi-line valuesIt is also possible to enter multi-line values within the CLI. This is required to upload certificates, keys, or e-mail and SMS texts for example. These values must then start with -----BEGIN[ID]----- and end with -----END[ID]-----. [ID] can be selected as desired, but must be the same for BEGIN and END. Example for the text of SMS message 1: Displaying current valuesThe values displayed in the Status menu on the Current values page of the existing data points can also be read out via CLI (individually or all). Example for displaying the current values of all data points: Displaying the log filesWhen displaying the log files, the logs to be displayed will be entered in the endless list view separated by commas as indices. If no log files are specified, all log files will be output. The last 10 lines of each selected log file will be output. Example: Filtering the log file outputThe program grep is available for filtering the log file output. The parameters available in grep are displayed with the parameter -h. They can also be combined. DebuggingManual triggering of an actionManual triggering of an action serves for testing its effect without having to wait until the configured event occurs. Depending on the action, certain parameters must be set before that are used to execute the action then. Example for starting timer 1: Analysis of the network connectionsThe debugging commands are handed over with the parameter tool as value. The five programs ping, ping6, traceroute, traceroute6 and nslookup are available for this. The own parameters of the debugging tool will be handed over again behind this. The syntax of the debugging tool will be displayed with the parameter -h. The results are displayed immediately. The execution of the commands can be aborted immediately with Esc or Ctrl + C. Example for sending 3 subsequent pings to the address 192.168.1.111: AbbreviationsAbbreviations for a (partial) repetition of the last command are available in addition to auto-complete to facilitate the command entry. The:(colon) replaces all sections of the last command until the last full stop. Each . (full stop) replaces one section of the last command at the position of the full stop. Examples: Lua modeFor executing Lua scripts in the application, these can be transmitted in ASCII configuration files or in the CLI. The Lua mode provides further commands besides the usual functional scope (see Lua 5.3 Reference Manual). The Lua mode will be entered and exited with -----LUA-----. The Lua mode allows to execute complex Lua scripts. The Lua function "require" allows to load and execute further Lua scripts contained in configuration files within a Lua script. The command cli transfers commands to the CLI within Lua. The following command activates Telnet access to the command line for example: The command ip_in_net can be used to query, whether a certain IP address is in a network. The following command for example can be used to check, whether the IP address 192.168.1.13 is in the network 192.168.1.0 (the network can be specified in CIDR format or with netmask): The command cidr_to_netmask can be used to convert a CIDR notation into a netmask Example: The command netmask_to_cidr can be used to convert a netmask into CIDR notation Example: The command sleep can be used to pause the execution of a Lua script by the number of seconds specified in the argument. The following command for example can delay the execution by 0.7 seconds: Closing the CLI sessionThe CLI session will be closed by entering exit followed by the enter key. |