Skip to content

cla clax - ClaX Agent Utilities

cla clax: ping, info and upgrade remote ClaX agents

Clax global configuration:

If all your clax agents need some special configuration (different port, basic_auth with the same user, ssl authentication, etc.) you can configure the agents options globally in the Clarive yml config file.

These are the config parameters:

clax:
  port: <port number>
  basic_auth: 0 | 1
  basic_user: <user name>
  basic_pass: <encrypted password>
  ssl_auth: 0 | 1
  ssl_verify: 0 | 1
  ssl_ca: <path to CA file>
  ssl_cert: <path to cert file>
  ssl_key: <path to key file>
  timeout: <timeout in seconds>

Important

The basic authentication password needs to be encrypted with the configuration secret. To get the correct value you have to get the encrypted value with the command cla trans-encrypt -s 'mypassword' -c <myconfig>

Available options:

  • --timeout <num> - set the ping timeout, default is 5 seconds
  • --mid <mid> - filter clax agents by resource MID (either generic_server or clax_agent MIDs accepted), use commas for more than one MID.
  • --name <mid> - filter clax agents by resource name (either generic_server or clax_agent resources accepted), use commas for more than one name ie ag1,ag2,ag3.
  • --all - list all resources (default)
  • --os <win|unix|mvs> - filter agents by OS
  • --active <1|0|all> - pick only active resources (default) or all
  • --exec COMMAND - run a command remotely

File copying

  • --local LOCAL_FILE - local file to copy to/from
  • --remote REMOTE_FILE - remote file to copy to/from

Basic Authentication:

  • --user - sets the basic auth password for the agent.
  • --password [password] - set the ClaX basic auth password. Leave it blank to type it in securely.

SSL Authentication:

  • --ssl_cert <cert_file_path> - set the certificate file path
  • --ssl_ca <ca_file_path> - set the certificate authority file path
  • --ssl_key <key_file_path> - sets the key to the certificate

Subcommands

clax-ps (default)

Ping all or a list of ClaX agents.

clax-info

Retrieves server information from a list or all ClaX servers.

clax-exec

Runs command in the agent and returns the results.

cla clax-exec -c myconfig --exec 'ls /tmp/'

clax-put

Copy a file to the remote server(s).

cla clax-put -c myconfig --local /tmp/hello --remote 'c:\tmp\hello' server1

clax-get

Copy a file from the remote server(s) to a local file.

cla clax-put -c myconfig --local /tmp/hello --remote 'c:\tmp\hello' server1

If the operation is run on many agents/servers, the files will have a suffix with the name of the agent resource:

/tmp/hello.txt.server1
/tmp/hello.txt.server2

clax-upgrade

Upgrades the ClaX binary.

  • --exe CLAX_BINARY - path to the ClaX binary to be copied remotely.
  • --dry-run - does all remote process PID and service detection previous to the upgrade, but does not remotely copy, stop/start or upgrade anything.

Important

To upgrade ClaX on a remote server/node, the agent needs to be already running. This procedure currently does NOT upgrade if no agent is present, configured AND running.

Steps:

  • Before running the command, download the desired version of the clax agent from the public repository at https://github.com/clarive/clax

  • Once you have the binary, choose the appropriate OS for each upgrade using the --os version

  • Run the cla clax-upgrade --exe <path_to_binary_file> [--os <win|unix> | --name AGENT_NAME]

The procedure will do the following steps.

  1. Determine the remote ClaX Process ID (PID) by checking the PID that LISTENs to the agent port remotely, by default 11801.

  2. Create a remote directory in the ClaX server machine, under the directory the ClaX server resides, ie. /opt/clax/clax-upgrade-<TIMESTAMP> or c:\clax\clax-upgrade-<TIMESTAMP> and send the upgrade payload files there. With each upgrade attempt, a new directory is created.

  3. Run the upgrade script remotely (a .sh or .bat file)

  4. The script will attempt to stop the ClaX service (Windows) or just kill the process (unix/linux/macos), and then overwrite the remote binary executable file using the one supplied in the --exe option

  5. Start the Windows Service or Linux/Macos command server with clax -l LOGFILE -c INIFILE

  6. The result of the upgrade procedure will be written to a log file under the upgrade directory cla_upgrade.log

Examples

cla clax-ps -c myconfig
cla clax-ps -c myconfig --active
cla clax-ps -c myconfig --os win
cla clax-ps -c myconfig --os unix
cla clax-info -c myconfig server1 server2
cla clax-info -c myconfig --name server1,server2   ### same as above
cla clax-upgrade -c myconfig --exe clax-ubuntu-v1.38.0  --user myuser --password --name myserver