1. Home
  2. Docs
  3. ConfigFiles
  4. Agent
  5. Command Line

Command Line

ConfigFIles agent, also known as a cm-agent, is an application that runs as a service on a database host and as a command-line interface to ConfigFiles API servers.

Configuration File

The command-line interface will look for the default configuration file at /etc/cm-agent.yaml. This path can be customized with -c or --config flag. As you can tell by looking at the file extension name, the configuration lines follow the YAML structure and it is automatically generated by a periodic pull from ConfigFiles API servers.

Command-Line Options

To get the list of supported command-line arguments and flags, simply run the command with --help flag:

$ /usr/sbin/cm-agent --help
cm-agent

Usage:
cm-agent [install|uninstall|upgrade|restart]

Subcommands:
install (i) Initialize the agent on the first installation and set it up as a service
uninstall (u) Uninstall the agent service & package
upgrade (p) Upgrade the agent to the latest version
restart (r) Restart the agent service

Flags:
--version Displays the program version string.
-h --help Displays help with available flag, subcommand, and positional value parameters.
-c --config Path to the configuration file. "/etc/cm-agent.yaml" by default. (default: /etc/cm-agent.yaml)
-d --db Database connection string, eg.
mysql://user:[email protected]:3306
postgres://user:[email protected]
mysql:/var/run/mysqld/mysqld.sock
-a --api-key API key

Looking at the output above, there are a number of subcommands and global flags available. For every subcommand, you can get further details on the available options and arguments positioning by appending help, for example:

$ cm-agent install help

Global Flags

The following table explains the global flags available for cm-agent:

Flag, shorthand Description
--version Displays the program version string.
--help, -h Displays help with the available flags, subcommands, and positional value parameters.
--config, -c Path to the configuration file. The default is /etc/cm-agent.yaml.
--db, -d Database connection string, for example, mysql://user:[email protected]:3306, postgres://user:[email protected], mysql:/var/run/mysqld/mysqld.sock
--api-key, -a API key.

Subcommand Usage and Examples

install (i)

Initialize the agent on the first installation and set it up as a service. The shorthand for this subcommand is i and it does not accept any argument.

Example:

$ /usr/sbin/cm-agent install

uninstall (u)

Uninstall the agent service & package. The shorthand for this subcommand is u and it does not accept any argument.

Example:

$ /usr/sbin/cm-agent uninstall

upgrade (p)

Upgrade the agent to the latest version. The upgrade procedure will include an automatic agent restart. The shorthand for this subcommand is p and it does not accept any argument.

Example:

$ /usr/sbin/cm-agent upgrade

restart (r)

Restart the agent service. This command is similar to the OS system restart, for example systemctl restart cm-agent. The shorthand for this subcommand is r and it does not accept any argument.

Example:

$ /usr/sbin/cm-agent restart
Was this article helpful to you? Yes No