Configure ECG for AutoStopping Rules
This topic describes how to configure ECG for the AutoStopping Rules. You can assume ECG as an event emitter for your rule. It sends usage records for the configured rules.
When the ECG is configured to watch a workload, AutoStopping Rule will not stop the resource until the workload finishes running. ECG comes with the following pre-installed watchers:
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.
In this topic:
- Before You Begin
- Metrics Watcher
- Process Watcher
- Configure ECG
Before You Begin
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.
cpu = "40"
memory = "5Gb"
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.
condition = "python*"
You can configure either metrics or process watcher for your rule.
Step 1: Install the ECG Agent
ECG is supported only for Unix-like machines. To install the agent,
- Download the ECG file from the S3 link:
- Unzip the file.
- Install the agent.
Step 2: Specify the Configuration Details
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
accountin the URL.
For example in the following URL, the account ID is
- 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. To obtain the hostname, do the following:
- In AutoStopping Rules, in Summary of Rules, click the rule for which you want to configure the ECG.
- Copy the hostname.
Assume your long-running job is a simple Python script:
> python trainmodel.py
The following example shows how to configure
ecg with the details:
# Configuration file for the ECG agent
accountID = "abcdSmUISimoRrJL6NL12w"
ruleHostName = "fluent-katydid-c6p67ucpv2dpsb76i66g.schedules-ce-dev.lightwingtest.com"
# For process based heartbeats configure the below section.
condition = "Python*"
# For metrics based heartbeats configure the below section.
#cpu = "40"
#memory = "5Gb"
Step 3: Restart the ECG Process
After making the configuration changes, restart the ECG process.
sudo systemctl restart ecg