From d711b90ec5f921d4dbb8c8c31ae28484a5e90391 Mon Sep 17 00:00:00 2001 From: Riley Snyder Date: Wed, 2 Oct 2024 13:33:27 -0500 Subject: [PATCH 1/2] Update 2-configure-ecg-for-auto-stopping-rules.md --- .../2-configure-ecg-for-auto-stopping-rules.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/cloud-cost-management/4-use-ccm-cost-optimization/1-optimize-cloud-costs-with-intelligent-cloud-auto-stopping-rules/2-configure-ecg-for-auto-stopping-rules.md b/docs/cloud-cost-management/4-use-ccm-cost-optimization/1-optimize-cloud-costs-with-intelligent-cloud-auto-stopping-rules/2-configure-ecg-for-auto-stopping-rules.md index e9b58ac6c78..16eea33632e 100644 --- a/docs/cloud-cost-management/4-use-ccm-cost-optimization/1-optimize-cloud-costs-with-intelligent-cloud-auto-stopping-rules/2-configure-ecg-for-auto-stopping-rules.md +++ b/docs/cloud-cost-management/4-use-ccm-cost-optimization/1-optimize-cloud-costs-with-intelligent-cloud-auto-stopping-rules/2-configure-ecg-for-auto-stopping-rules.md @@ -47,12 +47,15 @@ ECG is supported only for Unix-like machines. To install the agent, 1. Download the ECG file from the S3 link: [https://lightwing-downloads-temp.s3.ap-south-1.amazonaws.com/ecg/ecg_1.2.0_linux_amd64.zip](https://lightwing-downloads-temp.s3.ap-south-1.amazonaws.com/ecg/ecg_1.2.0_linux_amd64.zip) -2. Unzip the file. +2. Unzip the file and navigate into the resulting folder ``` -unzip ecg_1.1.0_linux_amd64.zip +unzip ecg_1.2.0_linux_amd64.zip +cd ecg_1.2.0_linux_amd64 ``` -3. Install the agent. +3. Check the contents of the installation script, make it executable, and execute it as root ``` +cat install.sh +chmod +x install.sh sudo ./install.sh ``` @@ -62,7 +65,8 @@ To configure ECG for your rule, provide the following configuration details: * **Account ID**: Account ID for which you want to enable ECG. You can copy the account ID from the Harness Manager. In Harness Manager's address bar, copy the **Harness account ID** from your Harness URL. The Harness account ID comes after `account` in the URL. -For example in the following URL, the account ID is `1a2b3c`: `https://app.harness.io/#/account/1a2b3c`. +For example in the following URL, the account ID is `1a2b3c`: `https://app.harness.io/ng/account/1a2b3c`. + * **Hostname of the AutoStopping Rule**: Hostname of the AutoStopping Rule for which you want to configure the ECG. You can copy the hostname from the [AutoStopping dashboard](../1-optimize-cloud-costs-with-intelligent-cloud-auto-stopping-rules/4-create-auto-stopping-rules/autostopping-dashboard.md). To obtain the hostname, do the following: 1. In **AutoStopping Rules**, in **Summary of Rules**, click the rule for which you want to configure the ECG. 2. Copy the hostname. From 7bb999f888f5a56114252d9436224967385231fe Mon Sep 17 00:00:00 2001 From: Riley Snyder Date: Wed, 16 Oct 2024 09:31:53 -0500 Subject: [PATCH 2/2] address feedback from customer --- ...2-configure-ecg-for-auto-stopping-rules.md | 58 +++++++++++++------ 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/docs/cloud-cost-management/4-use-ccm-cost-optimization/1-optimize-cloud-costs-with-intelligent-cloud-auto-stopping-rules/2-configure-ecg-for-auto-stopping-rules.md b/docs/cloud-cost-management/4-use-ccm-cost-optimization/1-optimize-cloud-costs-with-intelligent-cloud-auto-stopping-rules/2-configure-ecg-for-auto-stopping-rules.md index 16eea33632e..f70e8772276 100644 --- a/docs/cloud-cost-management/4-use-ccm-cost-optimization/1-optimize-cloud-costs-with-intelligent-cloud-auto-stopping-rules/2-configure-ecg-for-auto-stopping-rules.md +++ b/docs/cloud-cost-management/4-use-ccm-cost-optimization/1-optimize-cloud-costs-with-intelligent-cloud-auto-stopping-rules/2-configure-ecg-for-auto-stopping-rules.md @@ -17,26 +17,25 @@ When the ECG is configured to watch a workload, an AutoStopping Rule will not st By default, the AutoStopping Rule listens to HTTP/HTTPS traffic. On the other hand, a resource can be working on long-running background jobs like batch jobs. Nightly data updates or scheduled processing, for example. In this scenario, relying just on network traffic to detect resource idleness is not the ideal solution. For such scenarios, you can configure ECG for your AutoStopping Rules. - -### Metrics Watcher +## Metrics Watcher Metrics watcher is used to detect idleness based on CPU and memory of the resource. If the CPU and memory values are below the configured limit, AutoStopping will detect that as idleness for the resource and stop it. - ``` [metrics] cpu = "40" memory = "5Gb" ``` -### Process Watcher -Process watcher watches for the existence of processes that match the supplied condition. When a process with the matching condition is detected, AutoStopping will detect that as idleness for the resource and stop it. +## Process Watcher +Process watcher watches for the existence of processes that match the supplied condition. When a process with the matching condition is detected, AutoStopping will detect that as idleness for the resource and stop it. ``` [process] condition = "python*" ``` + ### Configure ECG You can configure either metrics or process watcher for your rule. @@ -47,12 +46,20 @@ ECG is supported only for Unix-like machines. To install the agent, 1. Download the ECG file from the S3 link: [https://lightwing-downloads-temp.s3.ap-south-1.amazonaws.com/ecg/ecg_1.2.0_linux_amd64.zip](https://lightwing-downloads-temp.s3.ap-south-1.amazonaws.com/ecg/ecg_1.2.0_linux_amd64.zip) + +``` +wget https://lightwing-downloads-temp.s3.ap-south-1.amazonaws.com/ecg/ecg_1.2.0_linux_amd64.zip +``` + 2. Unzip the file and navigate into the resulting folder + ``` unzip ecg_1.2.0_linux_amd64.zip cd ecg_1.2.0_linux_amd64 ``` + 3. Check the contents of the installation script, make it executable, and execute it as root + ``` cat install.sh chmod +x install.sh @@ -63,28 +70,45 @@ sudo ./install.sh To configure ECG for your rule, provide the following configuration details: -* **Account ID**: Account ID for which you want to enable ECG. You can copy the account ID from the Harness Manager. In Harness Manager's address bar, copy the **Harness account ID** from your Harness URL. The Harness account ID comes after `account` in the URL. +1. **Account ID**: Account ID for which you want to enable ECG. You can copy the account ID from the Harness Manager. In Harness Manager's address bar, copy the **Harness account ID** from your Harness URL. The Harness account ID comes after `account` in the URL. For example in the following URL, the account ID is `1a2b3c`: `https://app.harness.io/ng/account/1a2b3c`. -* **Hostname of the AutoStopping Rule**: Hostname of the AutoStopping Rule for which you want to configure the ECG. You can copy the hostname from the [AutoStopping dashboard](../1-optimize-cloud-costs-with-intelligent-cloud-auto-stopping-rules/4-create-auto-stopping-rules/autostopping-dashboard.md). To obtain the hostname, do the following: -1. In **AutoStopping Rules**, in **Summary of Rules**, click the rule for which you want to configure the ECG. -2. Copy the hostname. - +2. **Hostname of the AutoStopping Rule**: Hostname of the AutoStopping Rule for which you want to configure the ECG. You can copy the hostname from the [AutoStopping dashboard](../1-optimize-cloud-costs-with-intelligent-cloud-auto-stopping-rules/4-create-auto-stopping-rules/autostopping-dashboard.md). To obtain the hostname, do the following: + a. In **AutoStopping Rules**, in **Summary of Rules**, click the rule for which you want to configure the ECG. + b. Copy the hostname. ![](./static/configure-ecg-for-auto-stopping-rules-00.png) +3. [optional] **process**: A regex for the process to watch for. For example, if the process you want to watch is a simple python script `python trainmodel.py` we could specify `trainmodel.py`: + +``` +[process] +condition = "Python*" +``` + +4. [optional] **metrics**: A threshold for CPU and memory for determining "activity" on the instance. If you specify both, they will both need to be met to be concidered active. -##### Example +``` +[metrics] +cpu = "40" +memory = "2Gb" +``` -Assume your long-running job is a simple Python script: +*You will need to specify at least one of `[metrics]` or `[process]`.* +#### Example + +Assume your long-running job is a simple Python script: + ``` > python trainmodel.py ``` -The following example shows how to configure `ecg` with the details: +And your threshold for resource useage is 50% CPU and 1G memory. + +The following example shows how to configure `ecg` with the above details: ``` # Configuration file for the ECG agent @@ -95,19 +119,19 @@ ruleHostName = "fluent-katydid-c6p67ucpv2dpsb76i66g.schedules-ce-dev.lightwingte # For process based heartbeats configure the below section. [process] -condition = "Python*" +condition = "trainmodel.py" # For metrics based heartbeats configure the below section. #[metrics] -#cpu = "40" -#memory = "5Gb" +#cpu = "50" +#memory = "1Gb" ``` + #### Step 3: Restart the ECG Process After making the configuration changes, restart the ECG process. - ``` sudo systemctl restart ecg ```