Monitoring TCP Connection state with collectd

Follow this guide to fetch TCP Connection State metrics with collectd for monitoring, graphing and alerting purposes.

TCP Connection State Monitoring

We use the tcpconns collectd plugin to fetch these metrics, and this plugin is included by default in our collectd distribution.

Simply place monitor-tcp-connections.conf in your collectd additional config directory; for example /opt/wormly/collectd/etc/collectd.d/. You may wish to edit this file to specify the remote and local TCP ports you are interested in.

Here's an example configuration from our Github repo:

LoadPlugin tcpconns
<Plugin "tcpconns">
    ListeningPorts false

    # Locally listening ports; i.e. the servers we're running:
    LocalPort "22"
    LocalPort "25"
    LocalPort "80"
    LocalPort "443"
    LocalPort "3306"

    # Outbound connections; i.e. the servers we're connecting to:
    RemotePort "80"
    RemotePort "443"
    RemotePort "25"
</Plugin>

Test your collectd configuration:

collectd-wormly -T

No errors and {"ok":true} shown on the console? Reload the daemon to commence data collection:

service collectd-wormly restart

Downtime Hurts. Start monitoring and stop worrying.

Our monitoring service continually tests your servers & web sites to keep you online and performing fast. Fully-featured plans start from just $44 / month.

But don't listen to our spiel - Decide for yourself with a free trial »