> For the complete documentation index, see [llms.txt](https://elastiflow.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://elastiflow.gitbook.io/docs/additional-guides/hsflowd.md).

# hsflowd

`hsflowd` is an open-source host sFlow agent designed to monitor servers, virtual machines, and containers. It provides resource usage statistics, performance metrics, and network traffic data by leveraging the sFlow standard. Here's how to configure `hsflowd`:

### Install hsflowd

First, you need to install the `hsflowd` package. The installation process varies depending on your operating system. For example, on a Debian-based system like Ubuntu, you can use the following commands:

```shell
sudo apt-get update
sudo apt-get install hsflowd
```

For other systems, you may need to download and compile the source code from the official GitHub repository: <https://github.com/sflow/host-sflow>

### Edit hsflowd configuration file

After installation, locate the hsflowd configuration file, typically found at `/etc/hsflowd.conf`. Open the file with a text editor of your choice, such as `nano` or `vi`.

```shell
sudo nano /etc/hsflowd.conf
```

### Configure sFlow settings

In the configuration file, you'll find several settings that need to be configured, such as the collector's IP address, port, sampling rate, and polling intervals. The configuration file uses an XML-like syntax. Here's an example of a basic configuration:

```xml
<sFlow>
  <sFlowSettings>
    <sampling>400</sampling>
    <polling>20</polling>
    <header>128</header>
    <datagram>1400</datagram>
    <agent>AGENT_IP_ADDRESS</agent>
  </sFlowSettings>
  <collectors>
    <collector>
      <ip>x.x.x.x</ip>
      <udpport>6343</udpport>
    </collector>
  </collectors>
</sFlow>
```

Replace `AGENT_IP_ADDRESS` with the IP address of the sFlow agent (typically the host's IP address) and `x.x.x.x` with the IP address of your ElastiFlow Unified Flow Collector. You can adjust the sampling, polling, header, and datagram values as needed.

### Save and exit

After configuring the sFlow settings, save and exit the configuration file.

### Restart hsflowd

To apply the changes, restart the hsflowd service. The command varies depending on your operating system. For a Debian-based system like Ubuntu, use the following command:

```shell
sudo systemctl restart hsflowd
```

### Verify the configuration

To verify that hsflowd is running and exporting sFlow data, use the following command:

```shell
sudo systemctl status hsflowd
```

This command should display the status of the hsflowd service, indicating it's running and active.

Once you've completed these steps, your server will start exporting sFlow data to the specified flow collector. Make sure your ElastiFlow Unified Flow Collector is set up to receive and process the exported data for analysis and monitoring purposes.
