Name

sga-rc — Aitia Remote CLI

Synopsis

sga-rc COMMAND

sga-rc [OPTIONS] COMMAND

sga-rc [OPTIONS]

instancename COMMAND

DESCRIPTION

sga-rc is a tool for sending control commands - one at a time - to Aitia daemons. The tool waits for the daemons' response and prints it on standard output, or on standard error in case of receives error message.

Target daemon should be selected on first use or in case of targeting different daemon as targeted for last call. The application stores selected daemon for subsequent calls. Running daemons can be listed using the remote listing options. The daemon can be selected by either:

  • IP address and port, however the port alone is sufficent for local addresses;
  • instance name, which is deduced from the daemon config file name;
  • or by ID, which is the adhoc ID assigned for the listed daemon. The ID is not permanent, it can change in case of any handled daemon exits or starts.

OPTIONS

Command consists of one or more tokens separated by whitespace. This command will be sent to the daemon. For the list of available commands send list command to the daemon.

Note

sga-rc is supplied with bash tab completion support for commands and command parameters.

List of available options:

COMMAND
command to be sent to the selected daemon
-l, --list
list available daemons
-a, --address
select daemon by IP address:port or port
-i, --id
select daemon by id from daemon list
-n, --name
select daemon by instance-name
-h, --help
print this help
-v, --version
print version number
-b, --bash
print bash code of aliases for running daemons
-s, --nosel
supresses the selection change with a, i, n command
-j, --jsondoc
print documentation in json format

COMMANDS

sga-rc offers additional commands over the default command set of the daemon for human readable queries of its states.

Note

Some command (see below) supports globbing in parameter. If glob parameter is omitted, the parameter defaults to match all.

Note

If a glob pattern matches any file in the actual folder, bash will expand it before forwarding it to sga-rc. To prevent this, use quotes around the glob pattern or use the supplied bash profile (see below).

List of available commands:

configs.help <Counter>

Prints descriptions of config parameters in ascii table format.

<Counter>
config name or glob pattern
configs.print
Prints active config in RC file format.
configs.show <Counter>

Prints values of config parameters in ascii table format.

<Counter>
config name or glob pattern
help <Command>

Shows the help message for the specified remote or rc command. Glob pattern can be used to list help of multiple commands.

<Command>

name of the command or glob pattern.

(available values: configs.help, configs.print, configs.show, help, info.show, list, vars.help, vars.show)

info.show
Returns general application info in ascii table format.
list <Command>

Lists every available remote and rc command.

<Command>

name of the command or glob pattern.

(available values: configs.help, configs.print, configs.show, help, info.show, list, vars.help, vars.show)

vars.help <Counter>

Prints counter descriptions in ascii table format.

<Counter>
counter name or glob pattern
vars.show <Counter>

Prints counter values in ascii table format.

<Counter>
counter name or glob pattern

BASH PROFILE

sga-rc shipped with a bash profile file containing various sga-rc related features for bash in the form of bash functions. In a login shell it will be loaded automatically by bash. In a non-login shell, the profile can be loaded manually with the following command:

source /etc/profile.d/sga-rc-profile.sh

Note: for permanent use add this line to ~/.bashrc.

Available bash functions:

sga-rc
The profile defines a wrapper around sga-rc command where the bash glob expansion is switched off preventing bash to expand file names for glob patterns in sga-rc command parameters intended to parsed by the daemon instead.
sga-rc-prompt
Changes the bash prompt to show the name of the selected daemon instance, which sga-rc will send the command for.
sga-rc-update-aliases
Generates separate bash aliases for sga-rc targeting each available daemons as shown on the last usage version. The alias name will be the daemons' instance name. This enables a more convenient way to use sga-rc for a permanent daemon setup.

EXAMPLES

Listing all running aitia demons:

sga-rc --list

The command above will output a list like this, marking the currently selected daemon for sga-rc with an asterisk (*):

Remotes:
 * 0. PID12003 127.0.0.1:16001 msgwriter (db0)
   1. PID12060 127.0.0.1:16002 inetasm (inet4pfcp)
   2. PID12076 127.0.0.1:16003 msgwriter (db1)

Setting the prompt to show the selected daemon:

~& sga-rc-prompt
~ (db0)&

Changing the currently selected daemon can be achived by either using the list number, the address or the user specified instance name. The following commands are selecting the same instance:

sga-rc -i 2
sga-rc -a 16002
sga-rc -n db1

The selection change can be suppressed with the -s/--nosel option:

sga-rc -i -s 2
sga-rc -a -s 16002
sga-rc -n -s db1

When a daemon is selected, sga-rc can be used to control the daemon.

Checking the whole configuration, part of it or individual parameters:

sga-rc configs.show
sga-rc configs.show "**"
sga-rc configs.show writer.**
sga-rc configs.show writer.data.path

Note: the glob pattern is quoted in the second example because if the actual folder is not empty, bash will expand it to the file list of the folder.

Listing all or a subset of the counters:

sga-rc vars.show
sga-rc vars.show msg.**

Replacing an input channel:

sga-rc process.stop
sga-rc io.close in input1
sga-rc io.open in socket-adg://123.45.67.89:18000
sga-rc process.start

Saving the states and closing the daemon:

sga-rc process.stop
sga-rc state.save /home/sga/msgwriter.db1.tar
sga-rc app.quit

Json handling in io.open (in rc config file space is not supported):

sga-rc -a 16002 io.open in http2-avro://127.0.0.1:12345?resp='{"foo":"foo"}'

BUGS

Report bug at http://tsplab.hu/redmine.

COPYING

Copyright © 2020 Aitia International Inc.