# collectd: Send metrics to collectd

The `collectd()` destination uses the [unixsock plugin of the collectd application](<https://www.collectd.org/documentation/manpages/collectd-unixsock.html>) to send log messages to the [collectd system statistics collection daemon](<https://collectd.org>). You must install and configure collectd separately before using this destination.

Available in AxoSyslog version 3.20 and later.

## Declaration:
```
       collectd();
    
```
```
       destination d_collectd {
          collectd(
            socket("<path-to-collectd-socket>"),
            host("${HOST}"),
            plugin("${PROGRAM}"),
            type("<type-of-the-collected-metric>"),
            values("<metric-sent-to-collectd>"),
          );
        };
    
```

## Example: Using the collectd() driver

The following example uses the name of the application sending the log message as the plugin name, and the value of the ${SEQNUM} macro as the value of the metric sent to collectd.
```
 
       destination d_collectd {
          collectd(
            socket("/var/run/collectd-unixsock"),
            host("${HOST}"),
            plugin("${PROGRAM}"),
            type("gauge"),
            type_instance("seqnum"),
            values("${SEQNUM}"),
          );
        };
    
```

To use the `collectd()` driver, the `scl.conf` file must be included in your AxoSyslog configuration:
```
 
       @include "scl.conf"
    
```

The `collectd()` driver is actually a reusable configuration snippet configured to send log messages using the `unix-stream()` driver. For details on using or writing such configuration snippets, see [Reusing configuration blocks](../../docs/axosyslog-core/chapter-configuration-file/large-configs/config-blocks/index.md). You can find the source of this configuration snippet on [GitHub](<https://github.com/axoflow/axosyslog/blob/master/scl/collectd/plugin.conf>).

* * *

[collectd() destination options](../../docs/axosyslog-core/chapter-destinations/destination-collectd/destination-collectd-options/index.md)

Last modified November 20, 2024: [Broken link updates (5644de9)](<https://github.com/axoflow/axosyslog-core-docs/commit/5644de9a8069da37e3bebf0ed5a4e73cf958a66b>)