This document shows you the commands that you can use to modify the
configuration of Google Cloud's Agent for SAP. These commands are supported from
version 3.2 of the agent.

The configuration commands are an alternative to editing the agent's
configuration file: `/etc/google-cloud-sap-agent/configuration.json`. Up to
version 3.6 of the agent, running any configuration command also restarts the
agent to make sure that the change takes effect. From version 3.7 of the agent,
the updated configuration is automatically applied within 30 seconds of the
change.

## Agent restart limit

You can restart Google Cloud's Agent for SAP up to 3 times in 60 seconds. During
this timeframe, while you can continue configuring the agent by running the
configuration commands, all auto-restart operations beyond this limit fail with
the output: `Could not restart the agent`.

If you see this output, then after running all the required configuration
commands, you need to manually restart the agent for the changes to take effect.
For instructions, see [Restart the agent](https://docs.cloud.google.com/sap/docs/agent-for-sap/latest/operations.md.txt#agent4sap-restart).

## Help commands

- To print a summary help for the `google_cloud_sap_agent configure` command of the agent and exit:

  <br />

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -help
  ```
- To print the status of the features of your agent instance:<br />

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -showall
  ```
- To print the version of your agent instance:<br />

  ```bash
  sudo /usr/bin/google_cloud_sap_agent version
  ```

For information about the arguments supported by the
`google_cloud_sap_agent configure` command, see
[Supported arguments](https://docs.cloud.google.com/sap/docs/agent-for-sap/latest/config-commands.md.txt#supported_arguments).

## For top-level settings

- To configure the agent for a Bare Metal Solution server:

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -setting=bare_metal -enable
  ```

  <br />

  To configure the agent for a Compute Engine instance:

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -setting=bare_metal -disable
  ```
- To set the logging level of the agent:<br />

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -loglevel=LOG_LEVEL
  ```

  Replace `LOG_LEVEL` with one of the supported log
  levels: `debug`, `info`, `warn`, or
  `error`.

## For SAP system discovery

- To let the agent collect the names and versions of the SAP products used by your SAP system:<br />

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=workload_discovery -enable
  ```

  To stop the agent from collecting the names and versions of the SAP products
  used by your SAP system:

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=workload_discovery -disable
  ```
- To let the agent send the discovered SAP system information to Cloud Logging, and to Workload Manager if [Workload Manager API](https://console.cloud.google.com/apis/library/workloadmanager.googleapis.com) is enabled in your Google Cloud project:

  <br />

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=sap_discovery -enable
  ```

  To stop the agent from sending the discovered information to Cloud Logging
  and Workload Manager:

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=sap_discovery -disable
  ```

## For SAP Host Agent metrics collection

- To allow the agent to collect the [SAP Host Agent metrics](https://docs.cloud.google.com/sap/docs/agent-for-sap/latest/planning.md.txt#sap_host_agent_metrics):

  <br />

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=host_metrics -enable
  ```

  To stop the collection of the SAP Host Agent metrics:

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=host_metrics -disable
  ```

## For Agent health metrics collection

- To enable the collection of the agent health metrics:

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=agent_metrics -enable
  ```

  <br />

  To disable the collection of the agent health metrics:

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=agent_metrics -disable
  ```

  <br />

- To modify the frequency at which the agent collects the CPU and memory usage
  of its daemon process and sends them to Cloud Monitoring:

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=agent_metrics -agent_metrics_frequency=FREQUENCY
  ```

  Replace `FREQUENCY` with the required value, in
  seconds. The frequency must not be less than 5 seconds.

  <br />

- To modify the frequency at which the agent checks its operational health and
  sends that information to Cloud Monitoring:

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=agent_metrics -agent_health_frequency=FREQUENCY
  ```

  <br />

## For Process monitoring metrics collection

- To allow the agent to collect the [Process Monitoring metrics](https://docs.cloud.google.com/sap/docs/agent-for-sap/latest/process-monitoring.md.txt):

  <br />

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=process_metrics -enable
  ```

  To stop the collection of the Process Monitoring metrics:

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=process_metrics -disable
  ```
- To modify the frequency at which agent must collect the fast-changing Process Monitoring metrics:<br />

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=process_metrics -process_metrics_frequency=FREQUENCY
  ```

  To modify the frequency at which agent must collect the slow-changing Process
  Monitoring metrics:

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=process_metrics -slow_process_metrics_frequency=FREQUENCY
  ```

  Replace `FREQUENCY` with the frequency, in seconds, at
  which the agent must collect the metrics.
- To stop the collection of any Process Monitoring metrics:<br />

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=process_metrics -process_metrics_to_skip="LIST_OF_METRICS" -add
  ```

  To resume the collection of any Process Monitoring metrics that you had the
  agent stop:

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=process_metrics -process_metrics_to_skip="LIST_OF_METRICS" -remove
  ```

  Replace `LIST_OF_METRICS` with the names of the Process
  Monitoring metrics that you want the agent to resume collecting. Use a comma to
  separate the metric names.

## For Workload Manager evaluation metrics collection

- To let the agent collect the [Workload Manager evaluation metrics](https://docs.cloud.google.com/sap/docs/agent-for-sap/latest/planning.md.txt#wlm_evaluation_metrics):

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=workload_evaluation -enable
  ```
- To stop the collection of the Workload Manager evaluation metrics:<br />

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=workload_evaluation -disable
  ```
- To modify the frequency at which agent must collect the Workload Manager evaluation metrics:<br />

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=workload_evaluation -workload_evaluation_metrics_frequency=FREQUENCY
  ```

  Replace `FREQUENCY` with the frequency, in seconds, at
  which the agent must collect the Workload Manager evaluation
  metrics.
- To modify the frequency at which agent must collect the SAP HANA database metrics, for Workload Manager evaluation:<br />

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=workload_evaluation -workload_evaluation_db_metrics_frequency=FREQUENCY
  ```

  Replace `FREQUENCY` with the frequency, in seconds, at
  which the agent must collect the SAP HANA database metrics for
  Workload Manager evaluation.

## For SAP HANA monitoring metrics collection

- To allow the agent to collect the [SAP HANA monitoring metrics](https://docs.cloud.google.com/sap/docs/agent-for-sap/latest/monitoring-sap-hana.md.txt):

  <br />

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=hana_monitoring -enable
  ```

  To stop the collection of the SAP HANA monitoring metrics:

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=hana_monitoring -disable
  ```
- To modify the sample interval at which the agent must collect the SAP HANA Monitoring metrics:<br />

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=hana_monitoring -sample_interval_sec=SAMPLE_INTERNAL
  ```

  Replace `SAMPLE_INTERNAL` with the interval, in
  seconds. The interval must be 5 seconds or longer.
- To modify the timeout value for a query made to your SAP HANA instance:<br />

  ```bash
  sudo /usr/bin/google_cloud_sap_agent configure -feature=hana_monitoring -query_timeout_sec=QUERY_TIMEOUT
  ```

  Replace `QUERY_TIMEOUT` with a value, in seconds.

## Supported arguments


The following table describes the arguments that you can use with the
`google_cloud_sap_agent configure` command:

| Argument | Description |
|---|---|
| `-add` | This argument makes the agent stop collecting the [Process Monitoring metrics](https://docs.cloud.google.com/sap/docs/agent-for-sap/latest/process-monitoring.md.txt) that you specify for the `-process_metrics_to_skip` argument. |
| `-disable` | Disables the specified feature or parameter of the agent. |
| `-enable` | Enables the specified feature or parameter of the agent. |
| `-f`=`FEATURE_NAME` or `-feature`=`FEATURE_NAME` | `STRING` Sets the agent feature that you want to configure. The following are the supported values: - `host_metrics` - `process_metrics` - `agent_metrics` - `hana_monitoring` - `workload_evaluation` - `sap_discovery` |
| `-h` or `-help` | Displays help information for the command. |
| `-loglevel`=`LOG_LEVEL` | `STRING` Sets the logging level for the agent. The supported values are: `debug`, `info`, `warn`, and `error`. |
| `-process_metrics_to_skip`="`LIST_OF_METRICS`" | `STRING` Specifies the [Process Monitoring metrics](https://docs.cloud.google.com/sap/docs/agent-for-sap/latest/process-monitoring.md.txt) that the agent must stop collecting. Use a comma to separate the metric names. Use the `-add` and `-remove` arguments with `-process_metrics_to_skip`. |
| `-process_metrics_frequency`=`FREQUENCY` | `INT` Sets the frequency at which the agent collects fast-changing [Process Monitoring metrics](https://docs.cloud.google.com/sap/docs/agent-for-sap/latest/process-monitoring.md.txt#pm_metric_types). The default value is `30` seconds. |
| `-slow_process_metrics_frequency`=`FREQUENCY` | `INT` Sets the frequency at which the agent collects slow-changing [Process Monitoring metrics](https://docs.cloud.google.com/sap/docs/agent-for-sap/latest/process-monitoring.md.txt#pm_metric_types). The default value is `120` seconds. |
| `-query_timeout_sec`=`TIMEOUT` | `INT` Sets the query timeout, in seconds, for the collection of the SAP HANA monitoring metrics. |
| `-remove` | This argument makes the agent resume the collection of the [Process Monitoring metrics](https://docs.cloud.google.com/sap/docs/agent-for-sap/latest/process-monitoring.md.txt) that you stopped using the `-process_metrics_to_skip` argument. |
| `-sample_interval_sec`=`INTERVAL` | `INT` Sets the frequency, in seconds, at which the agent queries your SAP HANA instance and collects the [SAP HANA monitoring metrics](https://docs.cloud.google.com/sap/docs/agent-for-sap/latest/monitoring-sap-hana.md.txt). |
| `-setting`=`SETTING` | `STRING` Specifies the agent setting that you want configure. |
| `-showall` | Prints the status of the features of your agent instance. |
| `-slow_process_metrics_frequency`=`FREQUENCY` | `INT` Sets the collection frequency of the slow-changing [Process Monitoring metrics](https://docs.cloud.google.com/sap/docs/agent-for-sap/latest/process-monitoring.md.txt), in seconds. |
| `-workload_evaluation_metrics_frequency`=`FREQUENCY` | `INT` Sets the frequency at which the agent collects the Workload Manager evaluation metrics. |
| `-workload_evaluation_db_metrics_frequency`=`FREQUENCY` | `INT` Sets the frequency at which the agent collects the SAP HANA database metrics for Workload Manager evaluation. |

<br />