> For the complete documentation index, see [llms.txt](https://docs.hostedgraphite.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hostedgraphite.com/hg-cli.md).

# HG-CLI

Our recommended command line tool that's fun and easy-to-use - for installing and configuring agents in your systems.

Contents

* [Intstallation](#installation)
  * [Quick Install](#quick-install)
  * [Homebrew](#homebrew)
  * [Linux](#installation)
  * [Windows (PowerShell)](#windows-powershell)
  * [Golang](#golang)
* [HG-CLI Commands](#hg-cli-commands)
* [Metrics and Visualizations](#metrics-and-visualizations)

Our HG command line tool is an interactive way to install an agent on your system, without ever needing to touch a configuration file! This tool currently supports [Telegraf installation](/agents-guide/telegraf.md) and  [OpenTelemetry](/agents-guide/opentelemetry.md) with more features on the roadmap, like Telegraf Plugin Configuration.

Once you've installed HG-CLI, you can run it as a **TUI** (Terminal User Interface) or in **CLI** (Command Line Interface) mode. See our list of commands below for all available installation options and command examples.

See our handy blog article [HERE](https://www.metricfire.com/blog/step-by-step-guide-for-using-the-hg-cli-agent-installation-tool/) for step-by-step details on how to get this up in running in just a couple of minutes.

## [Installation](#installation)

You can find all current [releases on GitHub](https://github.com/hostedgraphite/hg-cli/releases).&#x20;

### [Quick Install](#quick-install)

Run this command in your terminal (Linux/MacOS/Windows).&#x20;

```bash
curl -s "https://www.hostedgraphite.com/scripts/hg-cli/installer/" | sudo sh
```

This will install the latest released version's binaries into your /usr/local/bin directory.

### [Homebrew](#homebrew)

You can use Homebrew to tap and install the HG-CLI packages for MacOS/Linux. This method supports AMD64/ARM64 architectures and the official GitHub tap can be found [HERE](https://github.com/hostedgraphite/homebrew-hgcli).

Add tap:

```
brew tap hostedgraphite/hgcli
```

Install:

```
brew install hg-cli
```

### [Linux](#linux)

Locate the official release assets [HERE](https://github.com/hostedgraphite/hg-cli/releases/tag/v0.0.1-alpha), and below are some example installation commands:

**Ubuntu/Debian**

{% tabs %}
{% tab title="AMD64" %}

```
curl -LO https://github.com/hostedgraphite/hg-cli/releases/download/v0.2.0/hg-cli_0.2.0_linux_amd64.deb
sudo dpkg -i hg-cli_0.2.0_linux_amd64.deb
```

{% endtab %}

{% tab title="ARM64" %}

```
curl -LO https://github.com/hostedgraphite/hg-cli/releases/download/v0.2.0/hg-cli_0.2.0_linux_arm64.deb
sudo dpkg -i hg-cli_0.2.0_linux_arm64.deb
```

{% endtab %}
{% endtabs %}

**RedHat/CentOS/Fedora**

{% tabs %}
{% tab title="AMD64" %}

```
curl -LO https://github.com/hostedgraphite/hg-cli/releases/download/v0.2.0/hg-cli_0.2.0_linux_amd64.rpm
sudo rpm -i hg-cli_0.2.0_linux_amd64.rpm
```

{% endtab %}

{% tab title="ARM64" %}

```
curl -LO https://github.com/hostedgraphite/hg-cli/releases/download/v0.2.0/hg-cli_0.2.0_linux_arm64.rpm
sudo rpm -i hg-cli_0.2.0_linux_arm64.rpm
```

{% endtab %}
{% endtabs %}

### [Windows (PowerShell)](#windows-powershell)

Locate the official release assets [HERE](https://github.com/hostedgraphite/hg-cli/releases/tag/v0.0.1-alpha), and below are some example installation commands:

{% tabs %}
{% tab title="AMD64" %}

```powershell
Invoke-WebRequest -Uri "https://github.com/hostedgraphite/hg-cli/releases/download/v0.2.0/hg-cli_0.2.0_windows_amd64.zip" -OutFile "hg-cli.zip"
Expand-Archive -Path "hg-cli.zip" -DestinationPath "C:\Program Files\hg-cli"
```

{% endtab %}

{% tab title="ARM64" %}

```powershell
Invoke-WebRequest -Uri "https://github.com/hostedgraphite/hg-cli/releases/download/v0.2.0/hg-cli_0.2.0_windows_arm64.zip" -OutFile "hg-cli.zip"
Expand-Archive -Path "hg-cli.zip" -DestinationPath "C:\Program Files\hg-cli"
```

{% endtab %}
{% endtabs %}

\[Optional] Add to system PATH:

<pre class="language-powershell"><code class="lang-powershell">$env:BACKUPPATH = [Environment]::GetEnvironmentVariable("Path", "Machine")
<strong>$env:NEWPATH = [Environment]::GetEnvironmentVariable("Path", "Machine")
</strong>$env:NEWPATH += ";C:\Program Files\hg-cli"
[Environment]::SetEnvironmentVariable("Path", $env:NEWPATH, "Machine")
Update-SessionEnvironment
</code></pre>

### [Golang](#golang)

Install using `go install`

```
go install github.com/hostedgraphite/hg-cli
```

### [Manual (Binaries)](#manual-binaries)

To manually install, download a preferred version [releases page](https://github.com/hostedgraphite/hg-cli/releases) (that matches your OS & ARCH), extract and move the binary file into a desired install location.&#x20;

Example:

<pre class="language-sh"><code class="lang-sh"><strong>curl -L https://github.com/hostedgraphite/hg-cli/releases/download/&#x3C;version>/hg-cli_&#x3C;version>_&#x3C;os>_&#x3C;arch>.tar.gz
</strong>tar -xf hg-cli_&#x3C;version>_&#x3C;os>_&#x3C;arch>.tar.gz
mv hg-cli /install/path (eg. /usr/local/bin)
</code></pre>

### [Perform Checksum](#perform-checksum-on-downloaded-file)

{% hint style="info" %}
Optional Step
{% endhint %}

Download the checksum.txt file from the releases listed assets. &#x20;

{% tabs %}
{% tab title="Linux" %}

```
sha256sum --ignore-missing --check checksums.txt
```

{% endtab %}

{% tab title="MacOS" %}

```
shasum -a 256 --ignore-missing --check checksums.txt
```

{% endtab %}
{% endtabs %}

## [HG-CLI Commands](#hg-cli-commands)

Once HG-CLI is installed, you can run it as a **TUI** application, or in **CLI** mode (for automated installs). Below are all available options and command examples for using this tool.<br>

Run the interactive TUI application (**recommended**):

```
hg-cli tui
```

Run it in CLI mode with the **default** configuration:

```
hg-cli agent install telegraf --api-key <HG-API-KEY>
```

CLI mode for a custom install - to specify which plugins you want:

```
hg-cli agent install telegraf --api-key <HG-API-KEY> --plugins cpu,disk,mem
```

CLI mode to update an API key in an existing config (telegraf):

```
hg-cli agent update-apikey telegraf --api-key <HG-API-KEY> --config <config path>
```

To uninstall an agent (telegraf):

```
hg-cli agent uninstall telegraf
```

Available flags for CLI mode:

* \--api-key (required)
* \--plugins (plugins to be added during installation)
* \--config (config path for updating apikey - required)
* \--list (list available monitoring agents)

<figure><img src="https://495119770-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZtHmoGZNsmARIViZEdbz%2Fuploads%2FfdxfYG1YaXsGldAy4DjG%2Fhg-cli_tui_loopable.gif?alt=media&amp;token=24181ccc-6f25-494c-8a54-e0fe16352cf3" alt=""><figcaption><p>hg-cli TUI Demonstration</p></figcaption></figure>

### [Metrics and Visualizations](#metrics-and-visualizations)

Once you have run the HG-CLI and installed an agent, the terminal output will show you that the installation was successful, which plugins were enabled, where your configuration file is located, and the command needed to start the service (**required** for collecting and forwarding metrics to your HG account).

<figure><img src="https://495119770-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZtHmoGZNsmARIViZEdbz%2Fuploads%2Fz4g8DNlTTAU91JWdN1JE%2Fhgcli-output-v2.png?alt=media&amp;token=ca467b81-cc2d-470b-8059-f674d4496a98" alt="" width="563"><figcaption><p>HG-CLI Successful Output</p></figcaption></figure>

Once the agent service has been started, you'll be able to locate your system metrics in our Metrics Search UI (with the *telegraf* prefix). Once telegraf.\* or otel.\* metrics have been sent to your account, a Telegraf/OpenTelemetry dashboard will be automatically created and can be located in your HG account (Dashboards ⇒ Telegraf/OpenTelemetry). This auto-dash offers a great starting point and can be customized further!

<figure><img src="https://495119770-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZtHmoGZNsmARIViZEdbz%2Fuploads%2Fs2JNZ1i2K8ppkXUmcFJg%2Ftelegraf-auto-dash.png?alt=media&amp;token=5d4f1b9d-e02f-4f28-8f04-ba887f5fa6b0" alt=""><figcaption><p>Telegraf Auto-Dash</p></figcaption></figure>

<figure><img src="https://495119770-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZtHmoGZNsmARIViZEdbz%2Fuploads%2FWA8hs5v9KESUUNcMeX25%2Fotel-auto-dashboard.png?alt=media&amp;token=7c32cf75-fee5-427f-893c-86490f0809c6" alt=""><figcaption><p>OpenTelemetry Auto-Dash</p></figcaption></figure>

If you need help enabling additional plugins or have feedback on the HG-CLI tool, please send a message to <support@metricfire.com>

If you don't already have a Hosted Graphite account, you can start a 14-day free trial [here](https://www.hostedgraphite.com/accounts/signup/).

You can also [schedule a product demo here ](https://calendly.com/metricfire-sales/hostedgraphite-demo)to speak with a knowledgeable member of our team who can provide support and advice on getting up and running quickly.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.hostedgraphite.com/hg-cli.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
