# 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 NetObserv Flow. 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 NetObserv Flow is set up to receive and process the exported data for analysis and monitoring purposes.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.elastiflow.com/additional-resources-reference-articles/guides/configuring-flow-logs-on-devices/device_flow_hsflowd.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
