Use the Mend CLI to Run a Unified Agent Scan
Overview
The Mend CLI serves as a wrapper for the Unified Agent, allowing users to run the Unified Agent via the Mend CLI using the mend ua
command.
This capability was developed to allow Mend.io customers, who still rely on the Unified Agent for SCA, to continue using the Unified Agent while getting accustomed to the Mend CLI and reaping some of its benefits. This change lays the groundwork for a seamless migration to the Mend CLI while retaining the configuration and user experience of the Unified Agent.
Getting it done
Downloading the Mend CLI
If you are new to the Mend CLI, please start by reading Download the Mend CLI
The ‘mend ua’ CLI Command
Unified Agent Configuration Parameters
The mend ua
command accepts any number of arguments and passes them to the Unified Agent, retaining the experience of using the Unified Agent.
Example:
You can follow up the mend ua
command with -c
, an argument which allows you to specify the location of the Unified Agent’s configuration file:
For a full list of Unified Agent configuration parameters, please refer to the Unified Agent Configuration Parameters document.
Note:
The Unified Agent can also be configured via environment variables. The
mend ua
command does not override the environment variables; they will be passed to the Unified Agent “as-is”.The Mend CLI will always update the Unified Agent to the latest version.
Authentication Considerations
If you’re already authenticated through the Mend CLI, no additional authentication steps will be required; the Unified Agent will reuse the credentials specified in the Mend CLI authentication.
If Unified Agent authentication credentials are provided (either via config file, environment variables or command line arguments), they will take precedence over Mend CLI credentials.
If neither Unified Agent nor Mend CLI authentication configuration exists then the
mend ua
command will print an error to the console and will exit with an invalid configuration exit code (1).
Unified Agent Logs
Using the mend ua
CLI command streams the Unified Agent console logs to the CLI.
The command also streams the Unified Agent exit code to the Mend CLI. For example:
If the Unified Agent exited with exit code (5) then the Mend CLI will also exit with exit code (5).
Java Considerations
The Mend CLI wraps the Unified Agent, including a JRE to run it. Consequently, there’s no need to have a JRE installed in your environment, to use
mend ua
.
Controlling the Java heap size is possible by setting the Java environment variable
JAVA_TOOL_OPTIONS
.
Example:JAVA_TOOL_OPTIONS=-Xmx3000m
.
Limitations
Reachability is not supported in the wrapped version of the Unified Agent.